Sync from Piper @427369078
PROTOBUF_SYNC_PIPER
diff --git a/BUILD b/BUILD
index df62e9e..8a84954 100644
--- a/BUILD
+++ b/BUILD
@@ -28,9 +28,7 @@
################################################################################
MSVC_COPTS = [
- "/wd4018", # -Wno-sign-compare
"/wd4065", # switch statement contains 'default' but no 'case' labels
- "/wd4146", # unary minus operator applied to unsigned type, result still unsigned
"/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data
"/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
"/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data
@@ -48,7 +46,6 @@
":msvc": MSVC_COPTS,
"//conditions:default": [
"-DHAVE_ZLIB",
- "-Wmissing-field-initializers",
"-Woverloaded-virtual",
"-Wno-sign-compare",
],
@@ -163,7 +160,6 @@
"src/google/protobuf/arenastring.cc",
"src/google/protobuf/extension_set.cc",
"src/google/protobuf/generated_enum_util.cc",
- "src/google/protobuf/generated_message_table_driven_lite.cc",
"src/google/protobuf/generated_message_tctable_lite.cc",
"src/google/protobuf/generated_message_util.cc",
"src/google/protobuf/implicit_weak_message.cc",
@@ -225,7 +221,6 @@
"src/google/protobuf/field_mask.pb.cc",
"src/google/protobuf/generated_message_bases.cc",
"src/google/protobuf/generated_message_reflection.cc",
- "src/google/protobuf/generated_message_table_driven.cc",
"src/google/protobuf/generated_message_tctable_full.cc",
"src/google/protobuf/io/gzip_stream.cc",
"src/google/protobuf/io/printer.cc",
@@ -501,6 +496,8 @@
"src/google/protobuf/compiler/plugin.cc",
"src/google/protobuf/compiler/plugin.pb.cc",
"src/google/protobuf/compiler/python/python_generator.cc",
+ "src/google/protobuf/compiler/python/python_helpers.cc",
+ "src/google/protobuf/compiler/python/python_pyi_generator.cc",
"src/google/protobuf/compiler/ruby/ruby_generator.cc",
"src/google/protobuf/compiler/subprocess.cc",
"src/google/protobuf/compiler/zip_writer.cc",
diff --git a/CHANGES.txt b/CHANGES.txt
index ea9e6af..6a1e8b9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -9,6 +9,78 @@
* Unknown enums for proto2 protos now properly implement proto2's behavior of
putting such values in unknown fields.
+ Java
+ * Don't support map fields in DynamicMessage.Builder.{getFieldBuilder,getRepeatedFieldBuilder}
+ * Fix parseFrom to only throw InvalidProtocolBufferException
+ * InvalidProtocolBufferException now allows arbitrary wrapped Exception types.
+ * Fix bug in `FieldSet.Builder.mergeFrom`
+ * Flush CodedOutputStream also flushes underlying OutputStream
+ * When oneof case is the same and the field type is Message, merge the
+ subfield. (previously it was replaced.)’
+ * add @CheckReturnValue to some protobuf types
+ * Report original exceptions when parsing JSON
+ * Add more info to @deprecated javadoc for set/get/has methods
+ * Fix initialization bug in doc comment line numbers
+
+ Kotlin
+ * Add orNull extensions for optional message fields in Kotlin.
+
+ Python
+ * Fix type annotations of some Duration and Timestamp methods.
+ * Repeated field containers are now generic in field types and could be used
+ in type annotations.
+ * Protobuf python generated codes are simplified. Descriptors and message
+ classes' definitions are now dynamic created in internal/builder.py.
+ Insertion Points for messages classes are discarded.
+ * protoc is now able to generate python stub (.pyi) by --gen_pyi
+ * has_presence is added for FieldDescriptor in python
+ * Loosen indexing type requirements to allow valid __index__() implementations
+ rather than only PyLongObjects.
+ * Fix the deepcopy bug caused by not copying message_listener.
+ * Added python JSON parse recursion limit (default 100)
+ * path info is added for python JSON parse errors
+ * Pure python repeated scalar fields will not able to pickle. Convert to list
+ first.
+ * Timestamp.ToDatetime() now accepts an optional tzinfo parameter. If
+ specified, the function returns a timezone-aware datetime in the given time
+ zone. If omitted or None, the function returns a timezone-naive UTC datetime
+ (as previously).
+ * Adds client_streaming and server_streaming fields to MethodDescriptor.
+
+ Compiler
+ * Migrate IsDefault(const std::string*) and UnsafeSetDefault(const std::string*)
+ * Implement strong qualified tags for TaggedPtr
+ * Rework allocations to power-of-two byte sizes.
+ * Migrate IsDefault(const std::string*) and UnsafeSetDefault(const std::string*)
+ * Implement strong qualified tags for TaggedPtr
+ * Make TaggedPtr Set...() calls explicitly spell out the content type.
+ * Check for parsing error before verifying UTF8.
+ * Enforce a maximum message nesting limit of 32 in the descriptor builder to
+ guard against stack overflows
+ * Fixed bugs in operators for RepeatedPtrIterator
+ * Assert a maximum map alignment for allocated values
+ * Fix proto1 group extension protodb parsing error
+ * Do not log/report the same descriptor symbol multiple times if it contains
+ more than one invalid character.
+ * Add UnknownFieldSet::SerializeToString and SerializeToCodedStream.
+
+ Arenas
+ * Change Repeated*Field to reuse memory when using arenas.
+ * Implements pbarenaz for profiling proto arenas
+ * Introduce CreateString() and CreateArenaString() for cleaner semantics
+ * Fix unreferenced parameter for MSVC builds
+ * Add UnsafeSetAllocated to be used for one-of string fields.
+ * Make Arena::AllocateAligned() a public function.
+ * Determine if ArenaDtor related code generation is necessary in one place.
+ * Implement on demand register ArenaDtor for InlinedStringField
+
+ C++
+ * manually *struct Cord fields to work better with arenas.
+ * manually destruct map fields.
+ * Generate narrower code
+ * Fix https://github.com/protocolbuffers/protobuf/issues/9378 by removing
+ shadowed _cached_size_ field
+
2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Python
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index b8d97fc..c2da98f 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -100,3 +100,8 @@
Andrew Paprocki <andrew@ishiboo.com>
* Fixed minor IBM xlC compiler build issues
* Added atomicops for AIX (POWER)
+ Nipunn Koorapati <nipunn1313@gmail.com>
+ * Provide a type alias field ValueType on EnumTypeWrapper
+ * Match service argument names to abstract interface
+
+
diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc
index 07b4150..2c856f5 100644
--- a/conformance/conformance_test.cc
+++ b/conformance/conformance_test.cc
@@ -350,7 +350,17 @@
StringAppendF(&output_, "\n");
if (!write_to_file.empty()) {
- std::ofstream os(write_to_file);
+ std::string full_filename;
+ const std::string* filename = &write_to_file;
+ if (!output_dir_.empty()) {
+ full_filename = output_dir_;
+ if (*output_dir_.rbegin() != '/') {
+ full_filename.push_back('/');
+ }
+ full_filename += write_to_file;
+ filename = &full_filename;
+ }
+ std::ofstream os(*filename);
if (os) {
for (std::set<string>::const_iterator iter = set_to_check.begin();
iter != set_to_check.end(); ++iter) {
@@ -358,7 +368,7 @@
}
} else {
StringAppendF(&output_, "Failed to open file: %s\n",
- write_to_file.c_str());
+ filename->c_str());
}
}
diff --git a/conformance/conformance_test.h b/conformance/conformance_test.h
index 76bd1bc..2861598 100644
--- a/conformance/conformance_test.h
+++ b/conformance/conformance_test.h
@@ -174,6 +174,11 @@
failure_list_flag_name_ = failure_list_flag_name;
}
+ // Sets the path of the output directory.
+ void SetOutputDir(const char* output_dir) {
+ output_dir_ = output_dir;
+ }
+
// Run all the conformance tests against the given test runner.
// Test output will be stored in "output".
//
@@ -296,6 +301,7 @@
bool verbose_;
bool enforce_recommended_;
std::string output_;
+ std::string output_dir_;
std::string failure_list_flag_name_;
std::string failure_list_filename_;
diff --git a/conformance/conformance_test_runner.cc b/conformance/conformance_test_runner.cc
index 19222c7..2aac35c 100644
--- a/conformance/conformance_test_runner.cc
+++ b/conformance/conformance_test_runner.cc
@@ -141,6 +141,9 @@
" strictly conforming to protobuf\n");
fprintf(stderr,
" spec.\n");
+ fprintf(stderr,
+ " --output_dir <dirname> Directory to write\n"
+ " output files.\n");
exit(1);
}
@@ -208,6 +211,9 @@
suite->SetVerbose(true);
} else if (strcmp(argv[arg], "--enforce_recommended") == 0) {
suite->SetEnforceRecommended(true);
+ } else if (strcmp(argv[arg], "--output_dir") == 0) {
+ if (++arg == argc) UsageError();
+ suite->SetOutputDir(argv[arg]);
} else if (argv[arg][0] == '-') {
bool recognized_flag = false;
for (ConformanceTestSuite* suite : suites) {
diff --git a/conformance/failure_list_js.txt b/conformance/failure_list_js.txt
index e69de29..591cbbe 100644
--- a/conformance/failure_list_js.txt
+++ b/conformance/failure_list_js.txt
@@ -0,0 +1,104 @@
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED64[2].ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[2].ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[2].ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[2].ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT64[2].ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED64[2].ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[2].ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED64[2].ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[2].ProtobufOutput
+Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT64[2].ProtobufOutput
+Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput
+Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataScalar.FIXED64[2].ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataScalar.INT64[2].ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[2].ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[2].ProtobufOutput
+Required.Proto2.ProtobufInput.ValidDataScalar.UINT64[2].ProtobufOutput
+Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput
+Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataScalar.FIXED64[2].ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataScalar.INT64[2].ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[2].ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[2].ProtobufOutput
+Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[2].ProtobufOutput
diff --git a/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs b/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs
index 15debc1..f3e5af2 100644
--- a/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs
+++ b/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs
@@ -139,6 +139,29 @@
}
[Test]
+ public void TestClone_LengthDelimited()
+ {
+ var unknownVarintField = new UnknownField();
+ unknownVarintField.AddVarint(99);
+
+ var unknownLengthDelimitedField1 = new UnknownField();
+ unknownLengthDelimitedField1.AddLengthDelimited(ByteString.CopyFromUtf8("some data"));
+
+ var unknownLengthDelimitedField2 = new UnknownField();
+ unknownLengthDelimitedField2.AddLengthDelimited(ByteString.CopyFromUtf8("some more data"));
+
+ var destUnknownFieldSet = new UnknownFieldSet();
+ destUnknownFieldSet.AddOrReplaceField(997, unknownVarintField);
+ destUnknownFieldSet.AddOrReplaceField(999, unknownLengthDelimitedField1);
+ destUnknownFieldSet.AddOrReplaceField(999, unknownLengthDelimitedField2);
+
+ var clone = UnknownFieldSet.Clone(destUnknownFieldSet);
+
+ Assert.IsTrue(clone.HasField(997));
+ Assert.IsTrue(clone.HasField(999));
+ }
+
+ [Test]
[TestCaseSource(typeof(Data), "Messages")]
public void TestDiscardUnknownFields(IMessage message)
{
diff --git a/java/core/BUILD b/java/core/BUILD
index a698fc8..cf4ae7c 100644
--- a/java/core/BUILD
+++ b/java/core/BUILD
@@ -27,6 +27,7 @@
"src/main/java/com/google/protobuf/CodedInputStreamReader.java",
"src/main/java/com/google/protobuf/CodedOutputStream.java",
"src/main/java/com/google/protobuf/CodedOutputStreamWriter.java",
+ "src/main/java/com/google/protobuf/CompileTimeConstant.java",
"src/main/java/com/google/protobuf/DoubleArrayList.java",
"src/main/java/com/google/protobuf/ExperimentalApi.java",
"src/main/java/com/google/protobuf/ExtensionLite.java",
@@ -41,6 +42,7 @@
"src/main/java/com/google/protobuf/FloatArrayList.java",
"src/main/java/com/google/protobuf/GeneratedMessageInfoFactory.java",
"src/main/java/com/google/protobuf/GeneratedMessageLite.java",
+ "src/main/java/com/google/protobuf/InlineMe.java",
"src/main/java/com/google/protobuf/IntArrayList.java",
"src/main/java/com/google/protobuf/Internal.java",
"src/main/java/com/google/protobuf/InvalidProtocolBufferException.java",
diff --git a/java/core/generate-test-sources-build.xml b/java/core/generate-test-sources-build.xml
index db44a15..bad6f19 100644
--- a/java/core/generate-test-sources-build.xml
+++ b/java/core/generate-test-sources-build.xml
@@ -4,6 +4,7 @@
<arg value="--java_out=${generated.testsources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${test.proto.dir}"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/map_lite_unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_custom_options.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_enormous_descriptor.proto"/>
@@ -22,6 +23,7 @@
<arg value="${test.proto.dir}/com/google/protobuf/any_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/cached_field_size_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/deprecated_file.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/dynamic_message_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/field_presence_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/lazy_fields_lite.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/lite_equals_and_hash.proto"/>
diff --git a/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java b/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java
index 65bbfd1..0fc88ae 100644
--- a/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java
+++ b/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java
@@ -45,14 +45,15 @@
*/
@CheckReturnValue
final class ArrayDecoders {
+
+ private ArrayDecoders() {
+ }
+
/**
* A helper used to return multiple values in a Java function. Java doesn't natively support
* returning multiple values in a function. Creating a new Object to hold the return values will
* be too expensive. Instead, we pass a Registers instance to functions that want to return
* multiple values and let the function set the return value in this Registers instance instead.
- *
- * <p>TODO(xiaofeng): This could be merged into CodedInputStream or CodedInputStreamReader which
- * is already being passed through all the parsing routines.
*/
static final class Registers {
public int int1;
diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
index f5cf885..20da4d8 100644
--- a/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
+++ b/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
@@ -692,7 +692,7 @@
// The wire format for MessageSet is:
// message MessageSet {
// repeated group Item = 1 {
- // required int32 typeId = 2;
+ // required uint32 typeId = 2;
// required bytes message = 3;
// }
// }
diff --git a/java/core/src/main/java/com/google/protobuf/Internal.java b/java/core/src/main/java/com/google/protobuf/Internal.java
index f2f194f..b6bbcb1 100644
--- a/java/core/src/main/java/com/google/protobuf/Internal.java
+++ b/java/core/src/main/java/com/google/protobuf/Internal.java
@@ -259,7 +259,9 @@
/** Helper method for implementing {@link Message#equals(Object)} for bytes field. */
public static boolean equals(List<byte[]> a, List<byte[]> b) {
- if (a.size() != b.size()) return false;
+ if (a.size() != b.size()) {
+ return false;
+ }
for (int i = 0; i < a.size(); ++i) {
if (!Arrays.equals(a.get(i), b.get(i))) {
return false;
diff --git a/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java b/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
index 71ccb14..7f36e09 100644
--- a/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
+++ b/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
@@ -55,6 +55,14 @@
super(description, e);
}
+ public InvalidProtocolBufferException(IOException e) {
+ super(e.getMessage(), e);
+ }
+
+ public InvalidProtocolBufferException(String description, IOException e) {
+ super(description, e);
+ }
+
/**
* Attaches an unfinished message to the exception to support best-effort parsing in {@code
* Parser} interface.
diff --git a/java/core/src/main/java/com/google/protobuf/MessageReflection.java b/java/core/src/main/java/com/google/protobuf/MessageReflection.java
index 6741e1c..b7f5d52 100644
--- a/java/core/src/main/java/com/google/protobuf/MessageReflection.java
+++ b/java/core/src/main/java/com/google/protobuf/MessageReflection.java
@@ -882,7 +882,7 @@
// The wire format for MessageSet is:
// message MessageSet {
// repeated group Item = 1 {
- // required int32 typeId = 2;
+ // required uint32 typeId = 2;
// required bytes message = 3;
// }
// }
diff --git a/java/core/src/main/java/com/google/protobuf/MessageSetSchema.java b/java/core/src/main/java/com/google/protobuf/MessageSetSchema.java
index 71ad750..8525dda 100644
--- a/java/core/src/main/java/com/google/protobuf/MessageSetSchema.java
+++ b/java/core/src/main/java/com/google/protobuf/MessageSetSchema.java
@@ -300,7 +300,7 @@
// The wire format for MessageSet is:
// message MessageSet {
// repeated group Item = 1 {
- // required int32 typeId = 2;
+ // required uint32 typeId = 2;
// required bytes message = 3;
// }
// }
diff --git a/java/core/src/main/java/com/google/protobuf/TextFormat.java b/java/core/src/main/java/com/google/protobuf/TextFormat.java
index 6aeb565..d974489 100644
--- a/java/core/src/main/java/com/google/protobuf/TextFormat.java
+++ b/java/core/src/main/java/com/google/protobuf/TextFormat.java
@@ -51,7 +51,7 @@
/**
* Provide text parsing and formatting support for proto2 instances. The implementation largely
- * follows google/protobuf/text_format.cc.
+ * follows text_format.cc.
*
* @author wenboz@google.com Wenbo Zhu
* @author kenton@google.com Kenton Varda
@@ -2309,7 +2309,7 @@
* Un-escape a byte sequence as escaped using {@link #escapeBytes(ByteString)}. Two-digit hex
* escapes (starting with "\x") are also recognized.
*/
- public static ByteString unescapeBytes(final CharSequence charString)
+ public static ByteString unescapeBytes(CharSequence charString)
throws InvalidEscapeSequenceException {
// First convert the Java character sequence to UTF-8 bytes.
ByteString input = ByteString.copyFromUtf8(charString.toString());
@@ -2445,9 +2445,10 @@
+ "' is not a valid code point value");
}
Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(codepoint);
- if (unicodeBlock.equals(Character.UnicodeBlock.LOW_SURROGATES)
+ if (unicodeBlock != null
+ && (unicodeBlock.equals(Character.UnicodeBlock.LOW_SURROGATES)
|| unicodeBlock.equals(Character.UnicodeBlock.HIGH_SURROGATES)
- || unicodeBlock.equals(Character.UnicodeBlock.HIGH_PRIVATE_USE_SURROGATES)) {
+ || unicodeBlock.equals(Character.UnicodeBlock.HIGH_PRIVATE_USE_SURROGATES))) {
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\U"
+ input.substring(i, i + 8).toStringUtf8()
diff --git a/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java b/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java
index 2501ec9..4e3eb76 100644
--- a/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java
+++ b/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java
@@ -30,7 +30,24 @@
package com.google.protobuf;
-/** Provide text format escaping support for proto2 instances. */
+/**
+ * Provide text format escaping of proto instances. These ASCII characters are escaped:
+ *
+ * ASCII #7 (bell) --> \a
+ * ASCII #8 (backspace) --> \b
+ * ASCII #9 (horizontal tab) --> \t
+ * ASCII #10 (linefeed) --> \n
+ * ASCII #11 (vertical tab) --> \v
+ * ASCII #13 (carriage return) --> \r
+ * ASCII #12 (formfeed) --> \f
+ * ASCII #34 (apostrophe) --> \'
+ * ASCII #39 (straight double quote) --> \"
+ * ASCII #92 (backslash) --> \\
+ *
+ * Other printable ASCII characters between 32 and 127 inclusive are output as is, unescaped.
+ * Other ASCII characters less than 32 and all Unicode characters 128 or greater are
+ * first encoded as UTF-8, then each byte is escaped individually as a 3-digit octal escape.
+ */
final class TextFormatEscaper {
private TextFormatEscaper() {}
@@ -41,17 +58,13 @@
}
/**
- * Escapes bytes in the format used in protocol buffer text format, which is the same as the
- * format used for C string literals. All bytes that are not printable 7-bit ASCII characters are
- * escaped, as well as backslash, single-quote, and double-quote characters. Characters for which
- * no defined short-hand escape sequence is defined will be escaped using 3-digit octal sequences.
+ * Backslash escapes bytes in the format used in protocol buffer text format.
*/
- static String escapeBytes(final ByteSequence input) {
+ static String escapeBytes(ByteSequence input) {
final StringBuilder builder = new StringBuilder(input.size());
for (int i = 0; i < input.size(); i++) {
- final byte b = input.byteAt(i);
+ byte b = input.byteAt(i);
switch (b) {
- // Java does not recognize \a or \v, apparently.
case 0x07:
builder.append("\\a");
break;
@@ -100,10 +113,7 @@
}
/**
- * Escapes bytes in the format used in protocol buffer text format, which is the same as the
- * format used for C string literals. All bytes that are not printable 7-bit ASCII characters are
- * escaped, as well as backslash, single-quote, and double-quote characters. Characters for which
- * no defined short-hand escape sequence is defined will be escaped using 3-digit octal sequences.
+ * Backslash escapes bytes in the format used in protocol buffer text format.
*/
static String escapeBytes(final ByteString input) {
return escapeBytes(
@@ -137,16 +147,14 @@
}
/**
- * Like {@link #escapeBytes(ByteString)}, but escapes a text string. Non-ASCII characters are
- * first encoded as UTF-8, then each byte is escaped individually as a 3-digit octal escape. Yes,
- * it's weird.
+ * Like {@link #escapeBytes(ByteString)}, but escapes a text string.
*/
- static String escapeText(final String input) {
+ static String escapeText(String input) {
return escapeBytes(ByteString.copyFromUtf8(input));
}
/** Escape double quotes and backslashes in a String for unicode output of a message. */
- static String escapeDoubleQuotesAndBackslashes(final String input) {
+ static String escapeDoubleQuotesAndBackslashes(String input) {
return input.replace("\\", "\\\\").replace("\"", "\\\"");
}
}
diff --git a/java/core/src/main/java/com/google/protobuf/Utf8.java b/java/core/src/main/java/com/google/protobuf/Utf8.java
index c878751..3130a31 100644
--- a/java/core/src/main/java/com/google/protobuf/Utf8.java
+++ b/java/core/src/main/java/com/google/protobuf/Utf8.java
@@ -64,9 +64,9 @@
* <em>Well Formed UTF-8 Byte Sequences</em>.
*
* <p>This class supports decoding of partial byte sequences, so that the bytes in a complete UTF-8
- * byte sequences can be stored in multiple segments. Methods typically return {@link #MALFORMED} if
- * the partial byte sequence is definitely not well-formed, {@link #COMPLETE} if it is well-formed
- * in the absence of additional input, or if the byte sequence apparently terminated in the middle
+ * byte sequence can be stored in multiple segments. Methods typically return {@link #MALFORMED} if
+ * the partial byte sequence is definitely not well-formed; {@link #COMPLETE} if it is well-formed
+ * in the absence of additional input; or, if the byte sequence apparently terminated in the middle
* of a character, an opaque integer "state" value containing enough information to decode the
* character when passed to a subsequent invocation of a partial decoding method.
*
diff --git a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
index 32ca8a8..7f018ca 100644
--- a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
+++ b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
@@ -170,6 +170,13 @@
assertThat(javaText).isEqualTo(ALL_FIELDS_SET_TEXT);
}
+ @Test
+ // https://github.com/protocolbuffers/protobuf/issues/9447
+ public void testCharacterNotInUnicodeBlock() throws TextFormat.InvalidEscapeSequenceException {
+ ByteString actual = TextFormat.unescapeBytes("\\U000358da");
+ assertThat(actual.size()).isEqualTo(4);
+ }
+
/** Print TestAllTypes as Builder and compare with golden file. */
@Test
public void testPrintMessageBuilder() throws Exception {
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/Anies.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/Anies.kt
new file mode 100644
index 0000000..64ac019
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/Anies.kt
@@ -0,0 +1,45 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.kotlin
+
+import com.google.protobuf.Any as ProtoAny
+import com.google.protobuf.Message
+
+/** Returns `true` if this [com.google.protobuf.Any] contains a message of type `T`. */
+inline fun <reified T : Message> ProtoAny.isA(): Boolean = this.`is`(T::class.java)
+
+/**
+ * Returns the message of type `T` encoded in this [com.google.protobuf.Any].
+ *
+ * @throws InvalidProtocolBufferException if this [com.google.protobuf.Any] does not contain a `T`
+ * message.
+ */
+inline fun <reified T : Message> ProtoAny.unpack(): T = unpack(T::class.java)
diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt
new file mode 100644
index 0000000..808c644
--- /dev/null
+++ b/java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt
@@ -0,0 +1,70 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf.kotlin
+
+import com.google.common.truth.Truth.assertThat
+import com.google.protobuf.Any as ProtoAny
+import com.google.protobuf.InvalidProtocolBufferException
+import protobuf_unittest.UnittestProto.BoolMessage
+import protobuf_unittest.UnittestProto.Int32Message
+import protobuf_unittest.int32Message
+import kotlin.test.assertFailsWith
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+/** Tests for extension methods on [ProtoAny]. */
+@RunWith(JUnit4::class)
+class AniesTest {
+ companion object {
+ val anAny = ProtoAny.pack(int32Message { data = 5 })
+ }
+
+ @Test
+ fun isA_Positive() {
+ assertThat(anAny.isA<Int32Message>()).isTrue()
+ }
+
+ @Test
+ fun isA_Negative() {
+ assertThat(anAny.isA<BoolMessage>()).isFalse()
+ }
+
+ @Test
+ fun unpackValid() {
+ assertThat(anAny.unpack<Int32Message>().data).isEqualTo(5)
+ }
+
+ @Test
+ fun unpackInvalid() {
+ assertFailsWith<InvalidProtocolBufferException> { anAny.unpack<BoolMessage>() }
+ }
+}
diff --git a/java/lite/generate-test-sources-build.xml b/java/lite/generate-test-sources-build.xml
index 365194e..8123efb 100644
--- a/java/lite/generate-test-sources-build.xml
+++ b/java/lite/generate-test-sources-build.xml
@@ -5,6 +5,7 @@
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${protobuf.basedir}/java/core/${test.proto.dir}"/>
<arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/map_lite_unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import_lite.proto"/>
diff --git a/java/lite/pom.xml b/java/lite/pom.xml
index 901ae67..c19d596 100644
--- a/java/lite/pom.xml
+++ b/java/lite/pom.xml
@@ -105,6 +105,7 @@
<include>CodedInputStreamReader.java</include>
<include>CodedOutputStream.java</include>
<include>CodedOutputStreamWriter.java</include>
+ <include>CompileTimeConstant.java</include>
<include>DoubleArrayList.java</include>
<include>ExperimentalApi.java</include>
<include>ExtensionLite.java</include>
@@ -119,6 +120,7 @@
<include>FloatArrayList.java</include>
<include>GeneratedMessageInfoFactory.java</include>
<include>GeneratedMessageLite.java</include>
+ <include>InlineMe.java</include>
<include>IntArrayList.java</include>
<include>Internal.java</include>
<include>InvalidProtocolBufferException.java</include>
diff --git a/kokoro/linux/dockerfile/test/java_stretch/Dockerfile b/kokoro/linux/dockerfile/test/java_stretch/Dockerfile
index b9f562a..7e1feea 100644
--- a/kokoro/linux/dockerfile/test/java_stretch/Dockerfile
+++ b/kokoro/linux/dockerfile/test/java_stretch/Dockerfile
@@ -1,4 +1,7 @@
-FROM debian:stretch
+# Despite the name of this image, we are no longer on stretch.
+# We should consider renaming this image, and/or evaluating what
+# software versions we actually need.
+FROM debian:bullseye
# Install dependencies. We start with the basic ones required to build protoc
# and the C++ build
@@ -22,9 +25,11 @@
wget \
# Java dependencies
maven \
- openjdk-8-jdk \
+ openjdk-11-jdk \
+ # Required for the gtest build.
+ python2 \
# Python dependencies
python3-setuptools \
python3-pip \
- virtualenv \
+ python3-venv \
&& apt-get clean
diff --git a/kokoro/linux/dockerfile/test/php80/Dockerfile b/kokoro/linux/dockerfile/test/php80/Dockerfile
index 8093eae..5b382d0 100644
--- a/kokoro/linux/dockerfile/test/php80/Dockerfile
+++ b/kokoro/linux/dockerfile/test/php80/Dockerfile
@@ -1,4 +1,4 @@
-FROM debian:jessie
+FROM debian:stretch
# Install dependencies. We start with the basic ones require to build protoc
# and the C++ build
@@ -29,7 +29,7 @@
# Install php dependencies
RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
- php5 \
+ php \
libcurl4-openssl-dev \
libgmp-dev \
libgmp3-dev \
@@ -90,6 +90,34 @@
&& cp phpunit /usr/local/php-8.0/bin \
&& mv phpunit /usr/local/php-8.0-zts/bin
+# php 8.1
+RUN cd php-src \
+ && git checkout php-8.1.2 \
+ && ./buildconf --force
+RUN cd php-src \
+ && ./configure \
+ --enable-bcmath \
+ --enable-mbstring \
+ --with-gmp \
+ --with-openssl \
+ --with-zlib \
+ --prefix=/usr/local/php-8.1 \
+ && make \
+ && make install \
+ && make clean
+RUN cd php-src \
+ && ./configure \
+ --enable-bcmath \
+ --enable-mbstring \
+ --enable-maintainer-zts \
+ --with-gmp \
+ --with-openssl \
+ --with-zlib \
+ --prefix=/usr/local/php-8.1-zts \
+ && make \
+ && make install \
+ && make clean
+
# Install php dependencies
RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
valgrind \
diff --git a/kokoro/linux/python36/build.sh b/kokoro/linux/python36/build.sh
deleted file mode 100755
index a483efc..0000000
--- a/kokoro/linux/python36/build.sh
+++ /dev/null
@@ -1,18 +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 DOCKERHUB_ORGANIZATION=protobuftesting
-export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/python36
-export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
-export OUTPUT_DIR=testoutput
-export TEST_SET="python36"
-./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/python36/continuous.cfg b/kokoro/linux/python36/continuous.cfg
deleted file mode 100644
index ee7f488..0000000
--- a/kokoro/linux/python36/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/python36/build.sh"
-timeout_mins: 120
-
-action {
- define_artifacts {
- regex: "**/sponge_log.xml"
- }
-}
diff --git a/kokoro/linux/python36/presubmit.cfg b/kokoro/linux/python36/presubmit.cfg
deleted file mode 100644
index ee7f488..0000000
--- a/kokoro/linux/python36/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/python36/build.sh"
-timeout_mins: 120
-
-action {
- define_artifacts {
- regex: "**/sponge_log.xml"
- }
-}
diff --git a/kokoro/linux/python36_cpp/build.sh b/kokoro/linux/python36_cpp/build.sh
deleted file mode 100755
index eb71bda..0000000
--- a/kokoro/linux/python36_cpp/build.sh
+++ /dev/null
@@ -1,18 +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 DOCKERHUB_ORGANIZATION=protobuftesting
-export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/python36
-export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
-export OUTPUT_DIR=testoutput
-export TEST_SET="python36_cpp"
-./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/python36_cpp/continuous.cfg b/kokoro/linux/python36_cpp/continuous.cfg
deleted file mode 100644
index df9e714..0000000
--- a/kokoro/linux/python36_cpp/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/python36_cpp/build.sh"
-timeout_mins: 120
-
-action {
- define_artifacts {
- regex: "**/sponge_log.xml"
- }
-}
diff --git a/kokoro/linux/python36_cpp/presubmit.cfg b/kokoro/linux/python36_cpp/presubmit.cfg
deleted file mode 100644
index df9e714..0000000
--- a/kokoro/linux/python36_cpp/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/python36_cpp/build.sh"
-timeout_mins: 120
-
-action {
- define_artifacts {
- regex: "**/sponge_log.xml"
- }
-}
diff --git a/kokoro/release/python/windows/build_artifacts.bat b/kokoro/release/python/windows/build_artifacts.bat
index a8f8f78..121283a 100644
--- a/kokoro/release/python/windows/build_artifacts.bat
+++ b/kokoro/release/python/windows/build_artifacts.bat
@@ -40,16 +40,6 @@
REM Build wheel
-SET PYTHON=C:\python36_32bit
-SET PYTHON_VERSION=3.6
-SET PYTHON_ARCH=32
-CALL build_single_artifact.bat || goto :error
-
-SET PYTHON=C:\python36
-SET PYTHON_VERSION=3.6
-SET PYTHON_ARCH=64
-CALL build_single_artifact.bat || goto :error
-
SET PYTHON=C:\python37_32bit
SET PYTHON_VERSION=3.7
SET PYTHON_ARCH=32
diff --git a/kokoro/release/python/windows/build_single_artifact.bat b/kokoro/release/python/windows/build_single_artifact.bat
index 8d3cd0c..af2d265 100644
--- a/kokoro/release/python/windows/build_single_artifact.bat
+++ b/kokoro/release/python/windows/build_single_artifact.bat
@@ -1,11 +1,5 @@
setlocal
-if %PYTHON%==C:\python36_32bit set generator=Visual Studio 14
-if %PYTHON%==C:\python36_32bit set vcplatform=Win32
-
-if %PYTHON%==C:\python36 set generator=Visual Studio 14 Win64
-if %PYTHON%==C:\python36 set vcplatform=x64
-
if %PYTHON%==C:\python37_32bit set generator=Visual Studio 14
if %PYTHON%==C:\python37_32bit set vcplatform=Win32
diff --git a/objectivec/README.md b/objectivec/README.md
index 9aedb21..b0278f2 100644
--- a/objectivec/README.md
+++ b/objectivec/README.md
@@ -133,8 +133,8 @@
from a proto file (classes (from message), enums, the Root for extension
support).
-If not set, the generation option `use_package_as_prefix` (documented below)
-controls what is used instead. Since Objective C uses a global namespace for all
+If not set, the generation options `default_objc_class_prefix` and `use_package_as_prefix`
+(documented below) control what is used instead. Since Objective C uses a global namespace for all
of its classes, there can be collisions. `use_package_as_prefix=yes` should
avoid collisions since proto package are used to scope/name things in other
languages, but this option can be used to get shorter names instead. Convention
@@ -182,6 +182,12 @@
having to add the runtime directory to the header search path since the
generate `#import` will be more complete.
+ * `default_objc_class_prefix`: The default ObjC prefix value to use when
+ generating sources. The generator will use this if the `objc_class_prefix`
+ file option is not set. This option can be useful if multiple iOS apps
+ consume the same proto file but wish to use a different prefix for their
+ generated sources.
+
* `use_package_as_prefix` and `proto_package_prefix_exceptions_path`: The
`value` for `use_package_as_prefix` can be `yes` or `no`, and indicates
if a prefix should be derived from the proto package for all the symbols
diff --git a/php/ext/google/protobuf/array.c b/php/ext/google/protobuf/array.c
index 2c9a710..9c290f7 100644
--- a/php/ext/google/protobuf/array.c
+++ b/php/ext/google/protobuf/array.c
@@ -287,7 +287,7 @@
}
/**
- * RepeatedField::offsetExists()
+ * RepeatedField::offsetExists(): bool
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@@ -309,7 +309,7 @@
}
/**
- * RepeatedField::offsetGet()
+ * RepeatedField::offsetGet(): mixed
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@@ -341,7 +341,7 @@
}
/**
- * RepeatedField::offsetSet()
+ * RepeatedField::offsetSet(): void
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@@ -386,7 +386,7 @@
}
/**
- * RepeatedField::offsetUnset()
+ * RepeatedField::offsetUnset(): void
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@@ -416,7 +416,7 @@
}
/**
- * RepeatedField::count()
+ * RepeatedField::count(): int
*
* Implements the Countable interface. Invoked when PHP code calls:
*
@@ -436,7 +436,7 @@
}
/**
- * RepeatedField::getIterator()
+ * RepeatedField::getIterator(): Traversable
*
* Implements the IteratorAggregate interface. Invoked when PHP code calls:
*
@@ -459,24 +459,38 @@
ZEND_ARG_INFO(0, newval)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetGet, 0, 0, 1)
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetExists, 0, 0, _IS_BOOL, 0)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetSet, 0, 0, 2)
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_offsetGet, 0, 0, IS_MIXED, 1)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetSet, 0, 2, IS_VOID, 0)
ZEND_ARG_INFO(0, index)
ZEND_ARG_INFO(0, newval)
ZEND_END_ARG_INFO()
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetUnset, 0, 0, IS_VOID, 0)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_count, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getIterator, 0, 0, Traversable, 0)
+ZEND_END_ARG_INFO()
+
static zend_function_entry repeated_field_methods[] = {
- PHP_ME(RepeatedField, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedField, append, arginfo_append, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedField, offsetExists, arginfo_offsetGet, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedField, offsetUnset, arginfo_offsetGet, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedField, count, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedField, getIterator, arginfo_void, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedField, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedField, append, arginfo_append, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedField, offsetExists, arginfo_offsetExists, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedField, offsetUnset, arginfo_offsetUnset, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedField, count, arginfo_count, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedField, getIterator, arginfo_getIterator, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
@@ -550,7 +564,7 @@
*/
/**
- * RepeatedFieldIter::rewind()
+ * RepeatedFieldIter::rewind(): void
*
* Implements the Iterator interface. Sets the iterator to the first element.
*/
@@ -560,7 +574,7 @@
}
/**
- * RepeatedFieldIter::current()
+ * RepeatedFieldIter::current(): mixed
*
* Implements the Iterator interface. Returns the current value.
*/
@@ -583,7 +597,7 @@
}
/**
- * RepeatedFieldIter::key()
+ * RepeatedFieldIter::key(): mixed
*
* Implements the Iterator interface. Returns the current key.
*/
@@ -593,7 +607,7 @@
}
/**
- * RepeatedFieldIter::next()
+ * RepeatedFieldIter::next(): void
*
* Implements the Iterator interface. Advances to the next element.
*/
@@ -603,7 +617,7 @@
}
/**
- * RepeatedFieldIter::valid()
+ * RepeatedFieldIter::valid(): bool
*
* Implements the Iterator interface. Returns true if this is a valid element.
*/
@@ -613,12 +627,27 @@
RETURN_BOOL(intern->position < upb_array_size(field->array));
}
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_current, 0, 0, IS_MIXED, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_key, 0, 0, IS_MIXED, 0)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_next, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_valid, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rewind, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
static zend_function_entry repeated_field_iter_methods[] = {
- PHP_ME(RepeatedFieldIter, rewind, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedFieldIter, current, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedFieldIter, key, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedFieldIter, next, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(RepeatedFieldIter, valid, arginfo_void, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedFieldIter, rewind, arginfo_rewind, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedFieldIter, current, arginfo_current, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedFieldIter, key, arginfo_key, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedFieldIter, next, arginfo_next, ZEND_ACC_PUBLIC)
+ PHP_ME(RepeatedFieldIter, valid, arginfo_valid, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
diff --git a/php/ext/google/protobuf/map.c b/php/ext/google/protobuf/map.c
index bbdfe29..252b1f5 100644
--- a/php/ext/google/protobuf/map.c
+++ b/php/ext/google/protobuf/map.c
@@ -305,7 +305,7 @@
}
/**
- * MapField::offsetExists()
+ * MapField::offsetExists(): bool
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@@ -329,7 +329,7 @@
}
/**
- * MapField::offsetGet()
+ * MapField::offsetGet(): mixed
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@@ -361,7 +361,7 @@
}
/**
- * MapField::offsetSet()
+ * MapField::offsetSet(): void
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@@ -389,7 +389,7 @@
}
/**
- * MapField::offsetUnset()
+ * MapField::offsetUnset(): void
*
* Implements the ArrayAccess interface. Invoked when PHP code calls:
*
@@ -413,7 +413,7 @@
}
/**
- * MapField::count()
+ * MapField::count(): int
*
* Implements the Countable interface. Invoked when PHP code calls:
*
@@ -433,7 +433,7 @@
}
/**
- * MapField::getIterator()
+ * MapField::getIterator(): Traversable
*
* Implements the IteratorAggregate interface. Invoked when PHP code calls:
*
@@ -453,23 +453,38 @@
ZEND_ARG_INFO(0, value_class)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetGet, 0, 0, 1)
+
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_offsetGet, 0, 0, IS_MIXED, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetSet, 0, 0, 2)
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetSet, 0, 2, IS_VOID, 0)
ZEND_ARG_INFO(0, index)
ZEND_ARG_INFO(0, newval)
ZEND_END_ARG_INFO()
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetUnset, 0, 0, IS_VOID, 0)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_offsetExists, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getIterator, 0, 0, Traversable, 0)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_count, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
static zend_function_entry MapField_methods[] = {
- PHP_ME(MapField, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
- PHP_ME(MapField, offsetExists, arginfo_offsetGet, ZEND_ACC_PUBLIC)
- PHP_ME(MapField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
- PHP_ME(MapField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
- PHP_ME(MapField, offsetUnset, arginfo_offsetGet, ZEND_ACC_PUBLIC)
- PHP_ME(MapField, count, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(MapField, getIterator, arginfo_void, ZEND_ACC_PUBLIC)
+ PHP_ME(MapField, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(MapField, offsetExists, arginfo_offsetExists, ZEND_ACC_PUBLIC)
+ PHP_ME(MapField, offsetGet, arginfo_offsetGet, ZEND_ACC_PUBLIC)
+ PHP_ME(MapField, offsetSet, arginfo_offsetSet, ZEND_ACC_PUBLIC)
+ PHP_ME(MapField, offsetUnset, arginfo_offsetUnset, ZEND_ACC_PUBLIC)
+ PHP_ME(MapField, count, arginfo_count, ZEND_ACC_PUBLIC)
+ PHP_ME(MapField, getIterator, arginfo_getIterator, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
@@ -547,7 +562,7 @@
*/
/**
- * MapFieldIter::rewind()
+ * MapFieldIter::rewind(): void
*
* Implements the Iterator interface. Sets the iterator to the first element.
*/
@@ -559,7 +574,7 @@
}
/**
- * MapFieldIter::current()
+ * MapFieldIter::current(): mixed
*
* Implements the Iterator interface. Returns the current value.
*/
@@ -587,7 +602,7 @@
}
/**
- * MapFieldIter::next()
+ * MapFieldIter::next(): void
*
* Implements the Iterator interface. Advances to the next element.
*/
@@ -598,7 +613,7 @@
}
/**
- * MapFieldIter::valid()
+ * MapFieldIter::valid(): bool
*
* Implements the Iterator interface. Returns true if this is a valid element.
*/
@@ -609,12 +624,27 @@
RETURN_BOOL(!done);
}
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rewind, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_current, 0, 0, IS_MIXED, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_key, 0, 0, IS_MIXED, 0)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_next, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_valid, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
static zend_function_entry map_field_iter_methods[] = {
- PHP_ME(MapFieldIter, rewind, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(MapFieldIter, current, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(MapFieldIter, key, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(MapFieldIter, next, arginfo_void, ZEND_ACC_PUBLIC)
- PHP_ME(MapFieldIter, valid, arginfo_void, ZEND_ACC_PUBLIC)
+ PHP_ME(MapFieldIter, rewind, arginfo_rewind, ZEND_ACC_PUBLIC)
+ PHP_ME(MapFieldIter, current, arginfo_current, ZEND_ACC_PUBLIC)
+ PHP_ME(MapFieldIter, key, arginfo_key, ZEND_ACC_PUBLIC)
+ PHP_ME(MapFieldIter, next, arginfo_next, ZEND_ACC_PUBLIC)
+ PHP_ME(MapFieldIter, valid, arginfo_valid, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
index 41ae271..fdee117 100644
--- a/php/ext/google/protobuf/protobuf.h
+++ b/php/ext/google/protobuf/protobuf.h
@@ -82,6 +82,42 @@
// PHP 7.2.0.
#if PHP_VERSION_ID < 70200
#define zend_ce_countable spl_ce_Countable
+#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \
+ ZEND_BEGIN_ARG_INFO_EX(name, return_reference, required_num_args, allow_null)
+#endif
+
+// polyfill for ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX, which changes between 7.1 and 7.2
+#if PHP_VERSION_ID < 70200
+#define PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, /*class_name*/ 0, allow_null)
+#else
+#define PROTOBUF_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null)
+#endif
+
+// In PHP 8.1, mismatched tentative return types emit a deprecation notice.
+// https://wiki.php.net/rfc/internal_method_return_types
+//
+// When compiling for earlier php versions, the return type is dropped.
+#if PHP_VERSION_ID < 80100
+#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+ ZEND_BEGIN_ARG_INFO_EX(name, return_reference, required_num_args, allow_null)
+#endif
+
+#ifndef IS_VOID
+#define IS_VOID 99
+#endif
+
+#ifndef IS_MIXED
+#define IS_MIXED 99
+#endif
+
+#ifndef _IS_BOOL
+#define _IS_BOOL 99
+#endif
+
+#ifndef IS_LONG
+#define IS_LONG 99
#endif
ZEND_BEGIN_ARG_INFO(arginfo_void, 0)
diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php
index 1dd6645..b71246e 100644
--- a/php/src/Google/Protobuf/Internal/GPBUtil.php
+++ b/php/src/Google/Protobuf/Internal/GPBUtil.php
@@ -37,6 +37,7 @@
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\MapField;
+use function bccomp;
function camel2underscore($input) {
preg_match_all(
diff --git a/php/src/Google/Protobuf/Internal/GPBWire.php b/php/src/Google/Protobuf/Internal/GPBWire.php
index 2956953..034f5df 100644
--- a/php/src/Google/Protobuf/Internal/GPBWire.php
+++ b/php/src/Google/Protobuf/Internal/GPBWire.php
@@ -146,7 +146,7 @@
return bcsub(bcmul(bcsub(0, $int64), 2), 1);
}
} else {
- return ($int64 << 1) ^ ($int64 >> 63);
+ return ((int)$int64 << 1) ^ ((int)$int64 >> 63);
}
}
diff --git a/php/src/Google/Protobuf/Internal/MapField.php b/php/src/Google/Protobuf/Internal/MapField.php
index 719fb35..86463a9 100644
--- a/php/src/Google/Protobuf/Internal/MapField.php
+++ b/php/src/Google/Protobuf/Internal/MapField.php
@@ -37,6 +37,8 @@
namespace Google\Protobuf\Internal;
+use Traversable;
+
/**
* MapField is used by generated protocol message classes to manipulate map
* fields. It can be used like native PHP array.
@@ -134,6 +136,7 @@
* @throws \ErrorException Invalid type for index.
* @throws \ErrorException Non-existing index.
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($key)
{
return $this->container[$key];
@@ -151,6 +154,7 @@
* @throws \ErrorException Invalid type for value.
* @throws \ErrorException Non-existing key.
*/
+ #[\ReturnTypeWillChange]
public function offsetSet($key, $value)
{
$this->checkKey($this->key_type, $key);
@@ -209,6 +213,7 @@
* @return void
* @throws \ErrorException Invalid type for key.
*/
+ #[\ReturnTypeWillChange]
public function offsetUnset($key)
{
$this->checkKey($this->key_type, $key);
@@ -224,7 +229,7 @@
* @return bool True if the element at the given key exists.
* @throws \ErrorException Invalid type for key.
*/
- public function offsetExists($key)
+ public function offsetExists($key): bool
{
$this->checkKey($this->key_type, $key);
return isset($this->container[$key]);
@@ -233,7 +238,7 @@
/**
* @ignore
*/
- public function getIterator()
+ public function getIterator(): Traversable
{
return new MapFieldIter($this->container, $this->key_type);
}
@@ -245,7 +250,7 @@
*
* @return integer The number of stored elements.
*/
- public function count()
+ public function count(): int
{
return count($this->container);
}
diff --git a/php/src/Google/Protobuf/Internal/MapFieldIter.php b/php/src/Google/Protobuf/Internal/MapFieldIter.php
index 4e18005..a3c834b 100644
--- a/php/src/Google/Protobuf/Internal/MapFieldIter.php
+++ b/php/src/Google/Protobuf/Internal/MapFieldIter.php
@@ -68,9 +68,10 @@
*
* @return void
*/
+ #[\ReturnTypeWillChange]
public function rewind()
{
- return reset($this->container);
+ reset($this->container);
}
/**
@@ -78,6 +79,7 @@
*
* @return object The element at the current position.
*/
+ #[\ReturnTypeWillChange]
public function current()
{
return current($this->container);
@@ -88,6 +90,7 @@
*
* @return object The current key.
*/
+ #[\ReturnTypeWillChange]
public function key()
{
$key = key($this->container);
@@ -117,9 +120,10 @@
*
* @return void
*/
+ #[\ReturnTypeWillChange]
public function next()
{
- return next($this->container);
+ next($this->container);
}
/**
@@ -127,7 +131,7 @@
*
* @return bool True if there are more elements to iterate.
*/
- public function valid()
+ public function valid(): bool
{
return key($this->container) !== null;
}
diff --git a/php/src/Google/Protobuf/Internal/RepeatedField.php b/php/src/Google/Protobuf/Internal/RepeatedField.php
index c0331ff..704123a 100644
--- a/php/src/Google/Protobuf/Internal/RepeatedField.php
+++ b/php/src/Google/Protobuf/Internal/RepeatedField.php
@@ -39,6 +39,7 @@
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
+use Traversable;
/**
* RepeatedField is used by generated protocol message classes to manipulate
@@ -121,6 +122,7 @@
* @throws \ErrorException Invalid type for index.
* @throws \ErrorException Non-existing index.
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset];
@@ -138,6 +140,7 @@
* @throws \ErrorException Non-existing index.
* @throws \ErrorException Incorrect type of the element.
*/
+ #[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
switch ($this->type) {
@@ -209,6 +212,7 @@
* @throws \ErrorException The element to be removed is not at the end of the
* RepeatedField.
*/
+ #[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$count = count($this->container);
@@ -230,7 +234,7 @@
* @return bool True if the element at the given offset exists.
* @throws \ErrorException Invalid type for index.
*/
- public function offsetExists($offset)
+ public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
@@ -238,7 +242,7 @@
/**
* @ignore
*/
- public function getIterator()
+ public function getIterator(): Traversable
{
return new RepeatedFieldIter($this->container);
}
@@ -250,7 +254,7 @@
*
* @return integer The number of stored elements.
*/
- public function count()
+ public function count(): int
{
return count($this->container);
}
diff --git a/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php b/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php
index 2b6f823..3c85869 100644
--- a/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php
+++ b/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php
@@ -71,6 +71,7 @@
*
* @return void
*/
+ #[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
@@ -81,6 +82,7 @@
*
* @return object The element at the current position.
*/
+ #[\ReturnTypeWillChange]
public function current()
{
return $this->container[$this->position];
@@ -91,6 +93,7 @@
*
* @return integer The current position.
*/
+ #[\ReturnTypeWillChange]
public function key()
{
return $this->position;
@@ -101,6 +104,7 @@
*
* @return void
*/
+ #[\ReturnTypeWillChange]
public function next()
{
++$this->position;
@@ -111,7 +115,7 @@
*
* @return bool True if there are more elements to iterate.
*/
- public function valid()
+ public function valid(): bool
{
return isset($this->container[$this->position]);
}
diff --git a/python/README.md b/python/README.md
index f0c9ce4..27f22c8 100644
--- a/python/README.md
+++ b/python/README.md
@@ -26,7 +26,7 @@
Installation
============
-1) Make sure you have Python 3.5 or newer. If in doubt, run:
+1) Make sure you have Python 3.7 or newer. If in doubt, run:
$ python -V
diff --git a/python/google/protobuf/internal/descriptor_pool_test.py b/python/google/protobuf/internal/descriptor_pool_test.py
index e59cf9b..501c9a6 100644
--- a/python/google/protobuf/internal/descriptor_pool_test.py
+++ b/python/google/protobuf/internal/descriptor_pool_test.py
@@ -541,7 +541,13 @@
pool._AddExtensionDescriptor(
file_descriptor.extensions_by_name['optional_int32_extension'])
pool.Add(unittest_fd)
- pool.Add(conflict_fd)
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter('always')
+ pool.Add(conflict_fd)
+ self.assertTrue(len(w))
+ self.assertIs(w[0].category, RuntimeWarning)
+ self.assertIn('Conflict register for file "other_file": ',
+ str(w[0].message))
pool.FindFileByName(unittest_fd.name)
with self.assertRaises(TypeError):
pool.FindFileByName(conflict_fd.name)
diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py
index bf2a17d..5024ed8 100644
--- a/python/google/protobuf/json_format.py
+++ b/python/google/protobuf/json_format.py
@@ -95,7 +95,8 @@
sort_keys=False,
use_integers_for_enums=False,
descriptor_pool=None,
- float_precision=None):
+ float_precision=None,
+ ensure_ascii=True):
"""Converts protobuf message to JSON format.
Args:
@@ -114,6 +115,8 @@
descriptor_pool: A Descriptor Pool for resolving types. If None use the
default.
float_precision: If set, use this to specify float field valid digits.
+ ensure_ascii: If True, strings with non-ASCII characters are escaped.
+ If False, Unicode strings are returned unchanged.
Returns:
A string containing the JSON formatted protocol buffer message.
@@ -124,7 +127,7 @@
use_integers_for_enums,
descriptor_pool,
float_precision=float_precision)
- return printer.ToJsonString(message, indent, sort_keys)
+ return printer.ToJsonString(message, indent, sort_keys, ensure_ascii)
def MessageToDict(
@@ -190,9 +193,10 @@
else:
self.float_format = None
- def ToJsonString(self, message, indent, sort_keys):
+ def ToJsonString(self, message, indent, sort_keys, ensure_ascii):
js = self._MessageToJsonObject(message)
- return json.dumps(js, indent=indent, sort_keys=sort_keys)
+ return json.dumps(
+ js, indent=indent, sort_keys=sort_keys, ensure_ascii=ensure_ascii)
def _MessageToJsonObject(self, message):
"""Converts message to an object according to Proto3 JSON Specification."""
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc
index f7a69a7..3a33824 100644
--- a/python/google/protobuf/pyext/message.cc
+++ b/python/google/protobuf/pyext/message.cc
@@ -1002,7 +1002,7 @@
}
}
- Arena* arena = Arena::InternalHelper<Message>::GetArenaForAllocation(message);
+ Arena* arena = Arena::InternalGetArenaForAllocation(message);
GOOGLE_DCHECK_EQ(arena, nullptr)
<< "python protobuf is expected to be allocated from heap";
// Remove items, starting from the end.
diff --git a/python/google/protobuf/pyext/unknown_fields.cc b/python/google/protobuf/pyext/unknown_fields.cc
index 00ac67a..fbfee3d 100644
--- a/python/google/protobuf/pyext/unknown_fields.cc
+++ b/python/google/protobuf/pyext/unknown_fields.cc
@@ -137,8 +137,9 @@
reinterpret_cast<CMessage*>(self->parent)->unknown_field_set = nullptr;
}
Py_CLEAR(self->parent);
+ auto* py_type = Py_TYPE(pself);
self->~PyUnknownFields();
- Py_TYPE(pself)->tp_free(pself);
+ py_type->tp_free(pself);
}
static PySequenceMethods SqMethods = {
diff --git a/python/tox.ini b/python/tox.ini
index 7142b86..b923a4a 100644
--- a/python/tox.ini
+++ b/python/tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
- py{35,36,37,38,39,310}-{cpp,python}
+ py{37,38,39,310}-{cpp,python}
[testenv]
usedevelop=true
@@ -14,7 +14,7 @@
commands =
python setup.py -q build_py
python: python setup.py -q build
- py{35,36,37,38,39,310}-cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
+ py{37,38,39,310}-cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
python: python setup.py -q test -q
cpp: python setup.py -q test -q --cpp_implementation
python: python setup.py -q test_conformance
diff --git a/src/google/protobuf/any.cc b/src/google/protobuf/any.cc
index 8d37008..346fa19 100644
--- a/src/google/protobuf/any.cc
+++ b/src/google/protobuf/any.cc
@@ -49,10 +49,8 @@
bool AnyMetadata::PackFrom(Arena* arena, const Message& message,
StringPiece type_url_prefix) {
type_url_->Set(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString(),
GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena);
- return message.SerializeToString(
- value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena));
+ return message.SerializeToString(value_->Mutable(arena));
}
bool AnyMetadata::UnpackTo(Message* message) const {
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc
index 5539413..e1d129f 100644
--- a/src/google/protobuf/any.pb.cc
+++ b/src/google/protobuf/any.pb.cc
@@ -119,18 +119,18 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_type_url().empty()) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(),
+ type_url_.Set(from._internal_type_url(),
GetArenaForAllocation());
}
value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_value().empty()) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
+ value_.Set(from._internal_value(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
@@ -139,11 +139,11 @@
inline void Any::SharedCtor() {
type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
@@ -158,8 +158,8 @@
inline void Any::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ type_url_.Destroy();
+ value_.Destroy();
}
void Any::SetCachedSize(int size) const {
@@ -325,12 +325,10 @@
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&type_url_, lhs_arena,
&other->type_url_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&value_, lhs_arena,
&other->value_, rhs_arena
);
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index 034b7e1..b5c7ac9 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -275,7 +275,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Any::set_type_url(ArgT0&& arg0, ArgT... args) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
}
inline std::string* Any::mutable_type_url() {
@@ -288,15 +288,15 @@
}
inline void Any::_internal_set_type_url(const std::string& value) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ type_url_.Set(value, GetArenaForAllocation());
}
inline std::string* Any::_internal_mutable_type_url() {
- return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return type_url_.Mutable(GetArenaForAllocation());
}
inline std::string* Any::release_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Any.type_url)
- return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return type_url_.Release();
}
inline void Any::set_allocated_type_url(std::string* type_url) {
if (type_url != nullptr) {
@@ -304,11 +304,10 @@
} else {
}
- type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
- GetArenaForAllocation());
+ type_url_.SetAllocated(type_url, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (type_url_.IsDefault()) {
- type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_url_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
@@ -326,7 +325,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Any::set_value(ArgT0&& arg0, ArgT... args) {
- value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ value_.SetBytes(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Any.value)
}
inline std::string* Any::mutable_value() {
@@ -339,15 +338,15 @@
}
inline void Any::_internal_set_value(const std::string& value) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ value_.Set(value, GetArenaForAllocation());
}
inline std::string* Any::_internal_mutable_value() {
- return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return value_.Mutable(GetArenaForAllocation());
}
inline std::string* Any::release_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Any.value)
- return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return value_.Release();
}
inline void Any::set_allocated_value(std::string* value) {
if (value != nullptr) {
@@ -355,11 +354,10 @@
} else {
}
- value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
- GetArenaForAllocation());
+ value_.SetAllocated(value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (value_.IsDefault()) {
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
diff --git a/src/google/protobuf/any_lite.cc b/src/google/protobuf/any_lite.cc
index d66a485..f283a31 100644
--- a/src/google/protobuf/any_lite.cc
+++ b/src/google/protobuf/any_lite.cc
@@ -55,10 +55,8 @@
bool AnyMetadata::InternalPackFrom(Arena* arena, const MessageLite& message,
StringPiece type_url_prefix,
StringPiece type_name) {
- type_url_->Set(&::google::protobuf::internal::GetEmptyString(),
- GetTypeUrl(type_name, type_url_prefix), arena);
- return message.SerializeToString(
- value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena));
+ type_url_->Set(GetTypeUrl(type_name, type_url_prefix), arena);
+ return message.SerializeToString(value_->Mutable(arena));
}
bool AnyMetadata::InternalUnpackTo(StringPiece type_name,
diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc
index 604a231..f2baf91 100644
--- a/src/google/protobuf/api.pb.cc
+++ b/src/google/protobuf/api.pb.cc
@@ -204,18 +204,18 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
version_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ version_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_version().empty()) {
- version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_version(),
+ version_.Set(from._internal_version(),
GetArenaForAllocation());
}
if (from._internal_has_source_context()) {
@@ -230,11 +230,11 @@
inline void Api::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ version_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
@@ -253,8 +253,8 @@
inline void Api::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
+ version_.Destroy();
if (this != internal_default_instance()) delete source_context_;
}
@@ -574,12 +574,10 @@
options_.InternalSwap(&other->options_);
mixins_.InternalSwap(&other->mixins_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&version_, lhs_arena,
&other->version_, rhs_arena
);
@@ -619,26 +617,26 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
request_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ request_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_request_type_url().empty()) {
- request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_request_type_url(),
+ request_type_url_.Set(from._internal_request_type_url(),
GetArenaForAllocation());
}
response_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ response_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_response_type_url().empty()) {
- response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_response_type_url(),
+ response_type_url_.Set(from._internal_response_type_url(),
GetArenaForAllocation());
}
::memcpy(&request_streaming_, &from.request_streaming_,
@@ -650,15 +648,15 @@
inline void Method::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
request_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ request_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
response_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ response_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&request_streaming_) - reinterpret_cast<char*>(this)),
@@ -677,9 +675,9 @@
inline void Method::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- request_type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- response_type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
+ request_type_url_.Destroy();
+ response_type_url_.Destroy();
}
void Method::SetCachedSize(int size) const {
@@ -984,17 +982,14 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
options_.InternalSwap(&other->options_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&request_type_url_, lhs_arena,
&other->request_type_url_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&response_type_url_, lhs_arena,
&other->response_type_url_, rhs_arena
);
@@ -1029,18 +1024,18 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
root_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ root_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_root().empty()) {
- root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_root(),
+ root_.Set(from._internal_root(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin)
@@ -1049,11 +1044,11 @@
inline void Mixin::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
root_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ root_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
@@ -1068,8 +1063,8 @@
inline void Mixin::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- root_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
+ root_.Destroy();
}
void Mixin::SetCachedSize(int size) const {
@@ -1240,12 +1235,10 @@
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&root_, lhs_arena,
&other->root_, rhs_arena
);
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index fd834c7..48d41aa 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -739,7 +739,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Api::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Api.name)
}
inline std::string* Api::mutable_name() {
@@ -752,15 +752,15 @@
}
inline void Api::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* Api::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* Api::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Api.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return name_.Release();
}
inline void Api::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -768,11 +768,10 @@
} else {
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
@@ -867,7 +866,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Api::set_version(ArgT0&& arg0, ArgT... args) {
- version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ version_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Api.version)
}
inline std::string* Api::mutable_version() {
@@ -880,15 +879,15 @@
}
inline void Api::_internal_set_version(const std::string& value) {
- version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ version_.Set(value, GetArenaForAllocation());
}
inline std::string* Api::_internal_mutable_version() {
- return version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return version_.Mutable(GetArenaForAllocation());
}
inline std::string* Api::release_version() {
// @@protoc_insertion_point(field_release:google.protobuf.Api.version)
- return version_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return version_.Release();
}
inline void Api::set_allocated_version(std::string* version) {
if (version != nullptr) {
@@ -896,11 +895,10 @@
} else {
}
- version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version,
- GetArenaForAllocation());
+ version_.SetAllocated(version, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (version_.IsDefault()) {
- version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ version_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
@@ -977,8 +975,7 @@
}
if (source_context) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
- ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context));
if (message_arena != submessage_arena) {
source_context = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
@@ -1068,7 +1065,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Method::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.name)
}
inline std::string* Method::mutable_name() {
@@ -1081,15 +1078,15 @@
}
inline void Method::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* Method::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return name_.Release();
}
inline void Method::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1097,11 +1094,10 @@
} else {
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
@@ -1119,7 +1115,7 @@
inline PROTOBUF_ALWAYS_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..., GetArenaForAllocation());
+ request_type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url)
}
inline std::string* Method::mutable_request_type_url() {
@@ -1132,15 +1128,15 @@
}
inline void Method::_internal_set_request_type_url(const std::string& value) {
- request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ request_type_url_.Set(value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_request_type_url() {
- return request_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return request_type_url_.Mutable(GetArenaForAllocation());
}
inline std::string* Method::release_request_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url)
- return request_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return request_type_url_.Release();
}
inline void Method::set_allocated_request_type_url(std::string* request_type_url) {
if (request_type_url != nullptr) {
@@ -1148,11 +1144,10 @@
} else {
}
- request_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), request_type_url,
- GetArenaForAllocation());
+ request_type_url_.SetAllocated(request_type_url, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (request_type_url_.IsDefault()) {
- request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ request_type_url_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
@@ -1190,7 +1185,7 @@
inline PROTOBUF_ALWAYS_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..., GetArenaForAllocation());
+ response_type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url)
}
inline std::string* Method::mutable_response_type_url() {
@@ -1203,15 +1198,15 @@
}
inline void Method::_internal_set_response_type_url(const std::string& value) {
- response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ response_type_url_.Set(value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_response_type_url() {
- return response_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return response_type_url_.Mutable(GetArenaForAllocation());
}
inline std::string* Method::release_response_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url)
- return response_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return response_type_url_.Release();
}
inline void Method::set_allocated_response_type_url(std::string* response_type_url) {
if (response_type_url != nullptr) {
@@ -1219,11 +1214,10 @@
} else {
}
- response_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), response_type_url,
- GetArenaForAllocation());
+ response_type_url_.SetAllocated(response_type_url, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (response_type_url_.IsDefault()) {
- response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ response_type_url_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
@@ -1322,7 +1316,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Mixin::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Mixin.name)
}
inline std::string* Mixin::mutable_name() {
@@ -1335,15 +1329,15 @@
}
inline void Mixin::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* Mixin::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* Mixin::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Mixin.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return name_.Release();
}
inline void Mixin::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1351,11 +1345,10 @@
} else {
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
@@ -1373,7 +1366,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Mixin::set_root(ArgT0&& arg0, ArgT... args) {
- root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ root_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Mixin.root)
}
inline std::string* Mixin::mutable_root() {
@@ -1386,15 +1379,15 @@
}
inline void Mixin::_internal_set_root(const std::string& value) {
- root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ root_.Set(value, GetArenaForAllocation());
}
inline std::string* Mixin::_internal_mutable_root() {
- return root_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return root_.Mutable(GetArenaForAllocation());
}
inline std::string* Mixin::release_root() {
// @@protoc_insertion_point(field_release:google.protobuf.Mixin.root)
- return root_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return root_.Release();
}
inline void Mixin::set_allocated_root(std::string* root) {
if (root != nullptr) {
@@ -1402,11 +1395,10 @@
} else {
}
- root_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root,
- GetArenaForAllocation());
+ root_.SetAllocated(root, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (root_.IsDefault()) {
- root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ root_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h
index 2b93a41..3165fc9 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -413,27 +413,10 @@
template <typename T>
class InternalHelper {
- public:
+ private:
// Provides access to protected GetOwningArena to generated messages.
static Arena* GetOwningArena(const T* p) { return p->GetOwningArena(); }
- // Provides access to protected GetArenaForAllocation to generated messages.
- static Arena* GetArenaForAllocation(const T* p) {
- return GetArenaForAllocationInternal(
- p, std::is_convertible<T*, MessageLite*>());
- }
-
- // Creates message-owned arena.
- static Arena* CreateMessageOwnedArena() {
- return new Arena(internal::MessageOwned{});
- }
-
- // Checks whether the given arena is message-owned.
- static bool IsMessageOwnedArena(Arena* arena) {
- return arena->IsMessageOwned();
- }
-
- private:
static Arena* GetArenaForAllocationInternal(
const T* p, std::true_type /*is_derived_from<MessageLite>*/) {
return p->GetArenaForAllocation();
@@ -516,6 +499,29 @@
friend class TestUtil::ReflectionTester;
};
+ // Provides access to protected GetOwningArena to generated messages. For
+ // internal use only.
+ template <typename T>
+ static Arena* InternalGetOwningArena(const T* p) {
+ return InternalHelper<T>::GetOwningArena(p);
+ }
+
+ // Provides access to protected GetArenaForAllocation to generated messages.
+ // For internal use only.
+ template <typename T>
+ static Arena* InternalGetArenaForAllocation(const T* p) {
+ return InternalHelper<T>::GetArenaForAllocationInternal(
+ p, std::is_convertible<T*, MessageLite*>());
+ }
+
+ // Creates message-owned arena. For internal use only.
+ static Arena* InternalCreateMessageOwnedArena() {
+ return new Arena(internal::MessageOwned{});
+ }
+
+ // Checks whether this arena is message-owned. For internal use only.
+ bool InternalIsMessageOwnedArena() { return IsMessageOwned(); }
+
// Helper typetraits that indicates support for arenas in a type T at compile
// time. This is public only to allow construction of higher-level templated
// utilities.
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index 0a38352..e80e0e8 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -547,13 +547,11 @@
TEST(ArenaTest, GetOwningArena) {
Arena arena;
auto* m1 = Arena::CreateMessage<TestAllTypes>(&arena);
- EXPECT_EQ(Arena::InternalHelper<TestAllTypes>::GetOwningArena(m1), &arena);
- EXPECT_EQ(
- &arena,
- Arena::InternalHelper<RepeatedPtrField<ForeignMessage>>::GetOwningArena(
- m1->mutable_repeated_foreign_message()));
- EXPECT_EQ(&arena, Arena::InternalHelper<RepeatedField<int>>::GetOwningArena(
- m1->mutable_repeated_int32()));
+ EXPECT_EQ(Arena::InternalGetOwningArena(m1), &arena);
+ EXPECT_EQ(&arena, Arena::InternalGetOwningArena(
+ m1->mutable_repeated_foreign_message()));
+ EXPECT_EQ(&arena,
+ Arena::InternalGetOwningArena(m1->mutable_repeated_int32()));
}
TEST(ArenaTest, SwapBetweenArenasUsingReflection) {
diff --git a/src/google/protobuf/arenastring.cc b/src/google/protobuf/arenastring.cc
index 4c19c91..4ad82f6 100644
--- a/src/google/protobuf/arenastring.cc
+++ b/src/google/protobuf/arenastring.cc
@@ -30,6 +30,7 @@
#include <google/protobuf/arenastring.h>
+#include <cstddef>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/io/coded_stream.h>
@@ -109,13 +110,7 @@
return new_string;
}
-void ArenaStringPtr::DestroyNoArenaSlowPath() {
- GOOGLE_DCHECK(tagged_ptr_.IsAllocated());
- delete UnsafeMutablePointer();
-}
-
-void ArenaStringPtr::Set(const std::string*, ConstStringParam value,
- ::google::protobuf::Arena* arena) {
+void ArenaStringPtr::Set(ConstStringParam value, Arena* arena) {
if (IsDefault()) {
// If we're not on an arena, skip straight to a true string to avoid
// possible copy cost later.
@@ -125,8 +120,8 @@
UnsafeMutablePointer()->assign(value.data(), value.length());
}
}
-void ArenaStringPtr::Set(const std::string*, std::string&& value,
- ::google::protobuf::Arena* arena) {
+
+void ArenaStringPtr::Set(std::string&& value, Arena* arena) {
if (IsDefault()) {
NewString(arena, std::move(value));
} else if (IsFixedSizeArena()) {
@@ -139,47 +134,26 @@
}
}
-void ArenaStringPtr::Set(EmptyDefault, ConstStringParam value,
- ::google::protobuf::Arena* arena) {
- Set(&GetEmptyStringAlreadyInited(), value, arena);
-}
-
-void ArenaStringPtr::Set(EmptyDefault, std::string&& value,
- ::google::protobuf::Arena* arena) {
- Set(&GetEmptyStringAlreadyInited(), std::move(value), arena);
-}
-
-void ArenaStringPtr::Set(NonEmptyDefault, ConstStringParam value,
- ::google::protobuf::Arena* arena) {
- Set(nullptr, value, arena);
-}
-
-void ArenaStringPtr::Set(NonEmptyDefault, std::string&& value,
- ::google::protobuf::Arena* arena) {
- Set(nullptr, std::move(value), arena);
-}
-
-std::string* ArenaStringPtr::Mutable(EmptyDefault, ::google::protobuf::Arena* arena) {
- if (!IsFixedSizeArena() && !IsDefault()) {
- return UnsafeMutablePointer();
+std::string* ArenaStringPtr::Mutable(Arena* arena) {
+ if (tagged_ptr_.IsMutable()) {
+ return tagged_ptr_.Get();
} else {
return MutableSlow(arena);
}
}
std::string* ArenaStringPtr::Mutable(const LazyString& default_value,
- ::google::protobuf::Arena* arena) {
- if (!IsFixedSizeArena() && !IsDefault()) {
- return UnsafeMutablePointer();
+ Arena* arena) {
+ if (tagged_ptr_.IsMutable()) {
+ return tagged_ptr_.Get();
} else {
return MutableSlow(arena, default_value);
}
}
-std::string* ArenaStringPtr::MutableNoCopy(const std::string*,
- ::google::protobuf::Arena* arena) {
- if (!IsFixedSizeArena() && !IsDefault()) {
- return UnsafeMutablePointer();
+std::string* ArenaStringPtr::MutableNoCopy(Arena* arena) {
+ if (tagged_ptr_.IsMutable()) {
+ return tagged_ptr_.Get();
} else {
GOOGLE_DCHECK(IsDefault());
// Allocate empty. The contents are not relevant.
@@ -194,45 +168,24 @@
return NewString(arena, lazy_default.get()...);
}
-std::string* ArenaStringPtr::Release(const std::string* default_value,
- ::google::protobuf::Arena* arena) {
- if (IsDefault()) {
- return nullptr;
- } else {
- return ReleaseNonDefault(default_value, arena);
+std::string* ArenaStringPtr::Release() {
+ if (IsDefault()) return nullptr;
+
+ std::string* released = tagged_ptr_.Get();
+ if (!tagged_ptr_.IsAllocated()) {
+ released = tagged_ptr_.IsMutable() ? new std::string(std::move(*released))
+ : new std::string(*released);
}
+ InitDefault();
+ return released;
}
-std::string* ArenaStringPtr::ReleaseNonDefault(const std::string* default_value,
- ::google::protobuf::Arena* arena) {
- GOOGLE_DCHECK(!IsDefault());
-
- if (!IsFixedSizeArena()) {
- std::string* released;
- if (arena != nullptr) {
- released = new std::string;
- released->swap(*UnsafeMutablePointer());
- } else {
- released = UnsafeMutablePointer();
- }
- tagged_ptr_.SetDefault(default_value);
- return released;
- } else /* IsFixedSizeArena() */ {
- GOOGLE_DCHECK(arena != nullptr);
- std::string* released = new std::string(Get());
- tagged_ptr_.SetDefault(default_value);
- return released;
- }
-}
-
-void ArenaStringPtr::SetAllocated(const std::string* default_value,
- std::string* value, ::google::protobuf::Arena* arena) {
+void ArenaStringPtr::SetAllocated(std::string* value, Arena* arena) {
// Release what we have first.
- if (arena == nullptr && !IsDefault()) {
- delete UnsafeMutablePointer();
- }
+ Destroy();
+
if (value == nullptr) {
- tagged_ptr_.SetDefault(default_value);
+ InitDefault();
} else {
#ifndef NDEBUG
// On debug builds, copy the string so the address differs. delete will
@@ -246,23 +199,12 @@
}
}
-void ArenaStringPtr::Destroy(const std::string*, ::google::protobuf::Arena* arena) {
- if (arena == nullptr) {
- GOOGLE_DCHECK(!IsFixedSizeArena());
- if (!IsDefault()) {
- delete UnsafeMutablePointer();
- }
+void ArenaStringPtr::Destroy() {
+ if (tagged_ptr_.IsAllocated()) {
+ delete tagged_ptr_.Get();
}
}
-void ArenaStringPtr::Destroy(EmptyDefault, ::google::protobuf::Arena* arena) {
- Destroy(&GetEmptyStringAlreadyInited(), arena);
-}
-
-void ArenaStringPtr::Destroy(NonEmptyDefault, ::google::protobuf::Arena* arena) {
- Destroy(nullptr, arena);
-}
-
void ArenaStringPtr::ClearToEmpty() {
if (IsDefault()) {
// Already set to default -- do nothing.
diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h
index 9d2eab0..a56ba6e 100644
--- a/src/google/protobuf/arenastring.h
+++ b/src/google/protobuf/arenastring.h
@@ -187,7 +187,7 @@
}
inline T* TagAs(Type type, T* p) {
- GOOGLE_DCHECK(type == kDefault || p != nullptr);
+ GOOGLE_DCHECK(p != nullptr);
assert_aligned(p);
ptr_ = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(p) | type);
return p;
@@ -232,84 +232,84 @@
struct EmptyDefault {};
struct NonEmptyDefault {};
- void Set(const std::string* default_value, ConstStringParam value,
- ::google::protobuf::Arena* arena);
- void Set(const std::string* default_value, std::string&& value,
- ::google::protobuf::Arena* arena);
- void Set(EmptyDefault, ConstStringParam value, ::google::protobuf::Arena* arena);
- 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,
+ // Called from generated code / reflection runtime only. Resets value to point
+ // to a default string pointer, with the semantics that this ArenaStringPtr
+ // does not own the pointed-to memory. Disregards initial value of ptr_ (so
+ // this is the *ONLY* safe method to call after construction or when
+ // reinitializing after becoming the active field in a oneof union).
+ inline void InitDefault();
+
+ // Similar to `InitDefault` except that it allows the default value to be
+ // initialized to an externally owned string. This method is called from
+ // parsing code. `str` must not be null and outlive this instance.
+ inline void InitExternal(const std::string* str);
+
+ // Called from generated code / reflection runtime only. Resets the value of
+ // this instances to the heap allocated value in `str`. `str` must not be
+ // null. Invokes `arena->Own(str)` to transfer ownership into the arena if
+ // `arena` is not null, else, `str` will be owned by ArenaStringPtr. This
+ // function should only be used to initialize a ArenaStringPtr or on an
+ // instance known to not carry any heap allocated value.
+ inline void InitAllocated(std::string* str, Arena* arena);
+
+ void Set(ConstStringParam value, Arena* arena);
+ void Set(std::string&& value, Arena* arena);
+ void Set(const char* s, Arena* arena);
+ void Set(const char* s, size_t n, Arena* arena);
+
+ void SetBytes(ConstStringParam value, Arena* arena);
+ void SetBytes(std::string&& value, Arena* arena);
+ void SetBytes(const char* s, Arena* arena);
+ void SetBytes(const void* p, size_t n, Arena* arena);
+
+ template <typename RefWrappedType>
+ void Set(std::reference_wrapper<RefWrappedType> const_string_ref,
::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);
+ Set(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);
- }
+ // Returns a mutable std::string reference.
+ // The version accepting a `LazyString` value is used in the generated code to
+ // initialize mutable copies for fields with a non-empty default where the
+ // default value is lazily initialized.
+ std::string* Mutable(Arena* arena);
+ std::string* Mutable(const LazyString& default_value, Arena* arena);
+
+ // Gets a mutable pointer with unspecified contents.
+ // This function is identical to Mutable(), except it is optimized for the
+ // case where the caller is not interested in the current contents. For
+ // example, if the current field is not mutable, it will re-initialize the
+ // value with an empty string rather than a (non-empty) default value.
+ // Likewise, if the current value is a fixed size arena string with contents,
+ // it will be initialized into an empty mutable arena string.
+ std::string* MutableNoCopy(Arena* arena);
// Basic accessors.
PROTOBUF_NDEBUG_INLINE const std::string& Get() const {
// Unconditionally mask away the tag.
return *tagged_ptr_.Get();
}
- PROTOBUF_NDEBUG_INLINE const std::string* GetPointer() const {
- // Unconditionally mask away the tag.
+
+ // Returns a pointer to the stored contents for this instance.
+ // This method is for internal debugging and tracking purposes only.
+ PROTOBUF_NDEBUG_INLINE const std::string* UnsafeGetPointer() const
+ PROTOBUF_RETURNS_NONNULL {
return tagged_ptr_.Get();
}
- // For fields with an empty default value.
- std::string* Mutable(EmptyDefault, ::google::protobuf::Arena* arena);
- // For fields with a non-empty default value.
- std::string* Mutable(const LazyString& default_value, ::google::protobuf::Arena* arena);
-
// Release returns a std::string* instance that is heap-allocated and is not
// Own()'d by any arena. If the field is not set, this returns nullptr. The
- // caller retains ownership. Clears this field back to nullptr state. Used to
- // implement release_<field>() methods on generated classes.
- PROTOBUF_NODISCARD std::string* Release(const std::string* default_value,
- ::google::protobuf::Arena* arena);
- PROTOBUF_NODISCARD std::string* ReleaseNonDefault(
- const std::string* default_value, ::google::protobuf::Arena* arena);
+ // caller retains ownership. Clears this field back to the default state.
+ // Used to implement release_<field>() methods on generated classes.
+ PROTOBUF_NODISCARD std::string* Release();
// Takes a std::string that is heap-allocated, and takes ownership. The
// std::string's destructor is registered with the arena. Used to implement
// set_allocated_<field> in generated classes.
- void SetAllocated(const std::string* default_value, std::string* value,
- ::google::protobuf::Arena* arena);
-
- // Swaps internal pointers. Arena-safety semantics: this is guarded by the
- // logic in Swap()/UnsafeArenaSwap() at the message level, so this method is
- // 'unsafe' if called directly.
- inline PROTOBUF_NDEBUG_INLINE static void InternalSwap(
- const std::string* default_value, ArenaStringPtr* rhs, Arena* rhs_arena,
- ArenaStringPtr* lhs, Arena* lhs_arena);
+ void SetAllocated(std::string* value, Arena* arena);
// Frees storage (if not on an arena).
- void Destroy(const std::string* default_value, ::google::protobuf::Arena* arena);
- void Destroy(EmptyDefault, ::google::protobuf::Arena* arena);
- void Destroy(NonEmptyDefault, ::google::protobuf::Arena* arena);
+ void Destroy();
// Clears content, but keeps allocated std::string, to avoid the overhead of
// heap operations. After this returns, the content (as seen by the user) will
@@ -326,37 +326,109 @@
// (as seen by the user) will always be equal to |default_value|.
void ClearToDefault(const LazyString& default_value, ::google::protobuf::Arena* arena);
- // Called from generated code / reflection runtime only. Resets value to point
- // to a default string pointer, with the semantics that this ArenaStringPtr
- // does not own the pointed-to memory. Disregards initial value of ptr_ (so
- // this is the *ONLY* safe method to call after construction or when
- // reinitializing after becoming the active field in a oneof union).
- // This function allows an explicit default value other than the default
- // global empty string. This is used in unit tests and by fields with
- // explicit non-empty default string values using null defaults.
- inline void InitDefault();
- inline void InitDefault(const std::string* str);
+ // Swaps internal pointers. Arena-safety semantics: this is guarded by the
+ // logic in Swap()/UnsafeArenaSwap() at the message level, so this method is
+ // 'unsafe' if called directly.
+ inline PROTOBUF_NDEBUG_INLINE static void InternalSwap(ArenaStringPtr* rhs,
+ Arena* rhs_arena,
+ ArenaStringPtr* lhs,
+ Arena* lhs_arena);
- // Called from generated code / reflection runtime only. Resets the value of
- // this instances to the heap allocated value in `str`. `str` must not be
- // null. Invokes `arena->Own(str)` to transfer ownership into the arena if
- // `arena` is not null, else, `str` will be owned by ArenaStringPtr. This
- // function should only be used to initialize a ArenaStringPtr or on an
- // instance known to not carry any heap allocated value.
- inline void InitAllocated(std::string* str, Arena* arena);
+ // --------------------------------------------------------
+ // Below functions will be removed in subsequent code change
+ // --------------------------------------------------------
+#ifdef DEPRECATED_METHODS_TO_BE_DELETED
+ PROTOBUF_NDEBUG_INLINE const std::string* GetPointer() const {
+ return UnsafeGetPointer();
+ }
- // Returns a mutable pointer, but doesn't initialize the string to the
- // default value.
- std::string* MutableNoArenaNoDefault(const std::string* default_value);
+ template <typename DefaultArg>
+ void Set(DefaultArg, ConstStringParam value, Arena* arena) {
+ return Set(value, arena);
+ }
+ template <typename DefaultArg>
+ void Set(DefaultArg, std::string&& value, Arena* arena) {
+ return Set(std::move(value), arena);
+ }
+ template <typename DefaultArg>
+ void Set(DefaultArg, const char* s, Arena* arena) {
+ return Set(ConstStringParam{s}, arena);
+ }
+ template <typename DefaultArg>
+ void Set(DefaultArg, const char* s, size_t n, Arena* arena) {
+ return Set(ConstStringParam{s, n}, arena);
+ }
- // Get a mutable pointer with unspecified contents.
- // Similar to `MutableNoArenaNoDefault`, but also handles the arena case.
- // If the value was donated, the contents are discarded.
- std::string* MutableNoCopy(const std::string* default_value,
- ::google::protobuf::Arena* arena);
+ void SetBytes(EmptyDefault, ConstStringParam value, Arena* arena) {
+ return Set(value, arena);
+ }
+ void SetBytes(NonEmptyDefault, ConstStringParam value, Arena* arena) {
+ return Set(value, arena);
+ }
+ void SetBytes(const std::string*, ConstStringParam value, Arena* arena) {
+ return Set(value, arena);
+ }
+ void SetBytes(EmptyDefault, std::string&& value, Arena* arena) {
+ return Set(std::move(value), arena);
+ }
+ void SetBytes(NonEmptyDefault, std::string&& value, Arena* arena) {
+ return Set(std::move(value), arena);
+ }
+ void SetBytes(const std::string*, std::string&& value, Arena* arena) {
+ return Set(std::move(value), arena);
+ }
+ void SetBytes(EmptyDefault, const char* s, Arena* arena) {
+ return Set(s, arena);
+ }
+ void SetBytes(NonEmptyDefault, const char* s, Arena* arena) {
+ return Set(s, arena);
+ }
+ void SetBytes(const std::string*, const char* s, Arena* arena) {
+ return Set(s, arena);
+ }
+ void SetBytes(EmptyDefault, const void* p, size_t n, Arena* arena) {
+ return SetBytes(p, n, arena);
+ }
+ void SetBytes(NonEmptyDefault, const void* p, size_t n, Arena* arena) {
+ return SetBytes(p, n, arena);
+ }
+ void SetBytes(const std::string*, const void* p, size_t n, Arena* arena) {
+ return SetBytes(p, n, arena);
+ }
- // Destroy the string. Assumes `arena == nullptr`.
- void DestroyNoArena(const std::string* default_value);
+ std::string* Mutable(EmptyDefault, Arena* arena) { return Mutable(arena); }
+ std::string* MutableNoArenaNoDefault(const std::string*) {
+ return Mutable(nullptr);
+ }
+ std::string* MutableNoCopy(const std::string*, ::google::protobuf::Arena* arena) {
+ return MutableNoCopy(arena);
+ }
+
+ PROTOBUF_NODISCARD std::string* Release(const std::string*, Arena* arena) {
+ return Release();
+ }
+ PROTOBUF_NODISCARD std::string* ReleaseNonDefault(const std::string*,
+ Arena* arena) {
+ return Release();
+ }
+
+ void SetAllocated(const std::string*, std::string* value, Arena* arena) {
+ SetAllocated(value, arena);
+ }
+
+ void Destroy(const std::string*, ::google::protobuf::Arena* arena) { Destroy(); }
+ void Destroy(EmptyDefault, ::google::protobuf::Arena* arena) { Destroy(); }
+ void Destroy(NonEmptyDefault, ::google::protobuf::Arena* arena) { Destroy(); }
+ void DestroyNoArena(const std::string*) { Destroy(); }
+
+ inline PROTOBUF_NDEBUG_INLINE static void InternalSwap(const std::string*,
+ ArenaStringPtr* rhs,
+ Arena* rhs_arena,
+ ArenaStringPtr* lhs,
+ Arena* lhs_arena) {
+ InternalSwap(rhs, rhs_arena, lhs, lhs_arena);
+ }
+#endif // DEPRECATED_METHODS_TO_BE_DELETED
// Internal setter used only at parse time to directly set a donated string
// value.
@@ -407,9 +479,6 @@
// Sets value to a newly allocated string and returns it
std::string* SetAndReturnNewString();
- // Destroys the non-default string value out-of-line
- void DestroyNoArenaSlowPath();
-
friend class EpsCopyInputStream;
};
@@ -417,7 +486,7 @@
tagged_ptr_ = TaggedPtr<std::string>(&fixed_address_empty_string);
}
-inline void ArenaStringPtr::InitDefault(const std::string* str) {
+inline void ArenaStringPtr::InitExternal(const std::string* str) {
tagged_ptr_.SetDefault(str);
}
@@ -430,9 +499,32 @@
}
}
+inline void ArenaStringPtr::Set(const char* s, Arena* arena) {
+ Set(ConstStringParam{s}, arena);
+}
+
+inline void ArenaStringPtr::Set(const char* s, size_t n, Arena* arena) {
+ Set(ConstStringParam{s, n}, arena);
+}
+
+inline void ArenaStringPtr::SetBytes(ConstStringParam value, Arena* arena) {
+ Set(value, arena);
+}
+
+inline void ArenaStringPtr::SetBytes(std::string&& value, Arena* arena) {
+ Set(std::move(value), arena);
+}
+
+inline void ArenaStringPtr::SetBytes(const char* s, Arena* arena) {
+ Set(s, arena);
+}
+
+inline void ArenaStringPtr::SetBytes(const void* p, size_t n, Arena* arena) {
+ Set(ConstStringParam{static_cast<const char*>(p), n}, arena);
+}
+
// Make sure rhs_arena allocated rhs, and lhs_arena allocated lhs.
inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( //
- const std::string*, //
ArenaStringPtr* rhs, Arena* rhs_arena, //
ArenaStringPtr* lhs, Arena* lhs_arena) {
// Silence unused variable warnings in release buildls.
@@ -466,28 +558,6 @@
tagged_ptr_.Get()->clear();
}
-inline std::string* ArenaStringPtr::MutableNoArenaNoDefault(
- const std::string* /* default_value */) {
- // VERY IMPORTANT for performance and code size: this will reduce to a member
- // variable load, a pointer check (against |default_value|, in practice a
- // static global) and a branch to the slowpath (which calls operator new and
- // the ctor). DO NOT add any tagged-pointer operations here.
- GOOGLE_DCHECK(!tagged_ptr_.IsArena());
- if (IsDefault()) {
- return SetAndReturnNewString();
- } else {
- return UnsafeMutablePointer();
- }
-}
-
-inline void ArenaStringPtr::DestroyNoArena(
- const std::string* /* default_value */) {
- GOOGLE_DCHECK(!tagged_ptr_.IsArena());
- if (!IsDefault()) {
- DestroyNoArenaSlowPath();
- }
-}
-
inline std::string* ArenaStringPtr::UnsafeMutablePointer() {
GOOGLE_DCHECK(tagged_ptr_.IsMutable());
GOOGLE_DCHECK(tagged_ptr_.Get() != nullptr);
diff --git a/src/google/protobuf/arenastring_unittest.cc b/src/google/protobuf/arenastring_unittest.cc
index bb48309..bf91620 100644
--- a/src/google/protobuf/arenastring_unittest.cc
+++ b/src/google/protobuf/arenastring_unittest.cc
@@ -34,6 +34,7 @@
#include <cstdlib>
#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include <google/protobuf/stubs/logging.h>
@@ -72,37 +73,36 @@
TEST_P(SingleArena, GetSet) {
auto arena = GetArena();
ArenaStringPtr field;
- field.InitDefault(empty_default);
+ field.InitDefault();
EXPECT_EQ("", field.Get());
- field.Set(empty_default, "Test short", arena.get());
+ field.Set("Test short", arena.get());
EXPECT_EQ("Test short", field.Get());
- field.Set(empty_default, "Test long long long long value", arena.get());
+ field.Set("Test long long long long value", arena.get());
EXPECT_EQ("Test long long long long value", field.Get());
- field.Set(empty_default, "", arena.get());
- field.Destroy(empty_default, arena.get());
+ field.Set("", arena.get());
+ field.Destroy();
}
TEST_P(SingleArena, MutableAccessor) {
auto arena = GetArena();
ArenaStringPtr field;
- const std::string* empty_default = &internal::GetEmptyString();
- field.InitDefault(empty_default);
+ field.InitDefault();
- std::string* mut = field.Mutable(EmptyDefault{}, arena.get());
- EXPECT_EQ(mut, field.Mutable(EmptyDefault{}, arena.get()));
+ std::string* mut = field.Mutable(arena.get());
+ EXPECT_EQ(mut, field.Mutable(arena.get()));
EXPECT_EQ(mut, &field.Get());
EXPECT_NE(empty_default, mut);
EXPECT_EQ("", *mut);
*mut = "Test long long long long value"; // ensure string allocates storage
EXPECT_EQ("Test long long long long value", field.Get());
- field.Destroy(empty_default, arena.get());
+ field.Destroy();
}
TEST_P(SingleArena, NullDefault) {
auto arena = GetArena();
ArenaStringPtr field;
- field.InitDefault(nullptr);
+ field.InitDefault();
std::string* mut = field.Mutable(nonempty_default, arena.get());
EXPECT_EQ(mut, field.Mutable(nonempty_default, arena.get()));
EXPECT_EQ(mut, &field.Get());
@@ -110,7 +110,7 @@
EXPECT_EQ("default", *mut);
*mut = "Test long long long long value"; // ensure string allocates storage
EXPECT_EQ("Test long long long long value", field.Get());
- field.Destroy(nullptr, arena.get());
+ field.Destroy();
}
class DualArena : public testing::TestWithParam<std::tuple<bool, bool>> {
@@ -131,23 +131,22 @@
TEST_P(DualArena, Swap) {
auto lhs_arena = GetLhsArena();
ArenaStringPtr lhs;
- lhs.InitDefault(empty_default);
+ lhs.InitDefault();
ArenaStringPtr rhs;
- rhs.InitDefault(empty_default);
+ rhs.InitDefault();
{
auto rhs_arena = GetRhsArena();
- lhs.Set(empty_default, "lhs value that has some heft", lhs_arena.get());
- rhs.Set(empty_default, "rhs value that has some heft", rhs_arena.get());
- ArenaStringPtr::InternalSwap(empty_default, //
- &lhs, lhs_arena.get(), //
+ lhs.Set("lhs value that has some heft", lhs_arena.get());
+ rhs.Set("rhs value that has some heft", rhs_arena.get());
+ ArenaStringPtr::InternalSwap(&lhs, lhs_arena.get(), //
&rhs, rhs_arena.get());
EXPECT_EQ("rhs value that has some heft", lhs.Get());
EXPECT_EQ("lhs value that has some heft", rhs.Get());
- lhs.Destroy(empty_default, rhs_arena.get());
+ lhs.Destroy();
}
EXPECT_EQ("lhs value that has some heft", rhs.Get());
- rhs.Destroy(empty_default, lhs_arena.get());
+ rhs.Destroy();
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
index b27ed1e..4df91c6 100644
--- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
@@ -91,7 +91,7 @@
Formatter format(printer, variables_);
format(
"inline $type$ $classname$::_internal_$name$() const {\n"
- " return static_cast< $type$ >($name$_);\n"
+ " return static_cast< $type$ >($field$);\n"
"}\n"
"inline $type$ $classname$::$name$() const {\n"
"$annotate_get$"
@@ -104,7 +104,7 @@
}
format(
" $set_hasbit$\n"
- " $name$_ = value;\n"
+ " $field$ = value;\n"
"}\n"
"inline void $classname$::set_$name$($type$ value) {\n"
" _internal_set_$name$(value);\n"
@@ -115,7 +115,7 @@
void EnumFieldGenerator::GenerateClearingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_ = $default$;\n");
+ format("$field$ = $default$;\n");
}
void EnumFieldGenerator::GenerateMergingCode(io::Printer* printer) const {
@@ -125,7 +125,7 @@
void EnumFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
- format("swap($name$_, other->$name$_);\n");
+ format("swap($field$, other->$field$);\n");
}
void EnumFieldGenerator::GenerateConstructorCode(io::Printer* printer) const {
@@ -177,7 +177,7 @@
format(
"inline $type$ $classname$::_internal_$name$() const {\n"
" if (_internal_has_$name$()) {\n"
- " return static_cast< $type$ >($field_member$);\n"
+ " return static_cast< $type$ >($field$);\n"
" }\n"
" return static_cast< $type$ >($default$);\n"
"}\n"
@@ -195,7 +195,7 @@
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" }\n"
- " $field_member$ = value;\n"
+ " $field$ = value;\n"
"}\n"
"inline void $classname$::set_$name$($type$ value) {\n"
" _internal_set_$name$(value);\n"
@@ -206,7 +206,7 @@
void EnumOneofFieldGenerator::GenerateClearingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$field_member$ = $default$;\n");
+ format("$field$ = $default$;\n");
}
void EnumOneofFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
@@ -264,7 +264,7 @@
Formatter format(printer, variables_);
format(
"inline $type$ $classname$::_internal_$name$(int index) const {\n"
- " return static_cast< $type$ >($name$_.Get(index));\n"
+ " return static_cast< $type$ >($field$.Get(index));\n"
"}\n"
"inline $type$ $classname$::$name$(int index) const {\n"
"$annotate_get$"
@@ -276,7 +276,7 @@
format(" assert($type$_IsValid(value));\n");
}
format(
- " $name$_.Set(index, value);\n"
+ " $field$.Set(index, value);\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
@@ -285,7 +285,7 @@
format(" assert($type$_IsValid(value));\n");
}
format(
- " $name$_.Add(value);\n"
+ " $field$.Add(value);\n"
"}\n"
"inline void $classname$::add_$name$($type$ value) {\n"
" _internal_add_$name$(value);\n"
@@ -296,11 +296,11 @@
"$classname$::$name$() const {\n"
"$annotate_list$"
" // @@protoc_insertion_point(field_list:$full_name$)\n"
- " return $name$_;\n"
+ " return $field$;\n"
"}\n"
"inline ::$proto_ns$::RepeatedField<int>*\n"
"$classname$::_internal_mutable_$name$() {\n"
- " return &$name$_;\n"
+ " return &$field$;\n"
"}\n"
"inline ::$proto_ns$::RepeatedField<int>*\n"
"$classname$::mutable_$name$() {\n"
@@ -313,19 +313,19 @@
void RepeatedEnumFieldGenerator::GenerateClearingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.Clear();\n");
+ format("$field$.Clear();\n");
}
void RepeatedEnumFieldGenerator::GenerateMergingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.MergeFrom(from.$name$_);\n");
+ format("$field$.MergeFrom(from.$field$);\n");
}
void RepeatedEnumFieldGenerator::GenerateSwappingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.InternalSwap(&other->$name$_);\n");
+ format("$field$.InternalSwap(&other->$field$);\n");
}
void RepeatedEnumFieldGenerator::GenerateConstructorCode(
@@ -344,7 +344,7 @@
"_$name$_cached_byte_size_.load(std::memory_order_relaxed);\n"
" if (byte_size > 0) {\n"
" target = stream->WriteEnumPacked(\n"
- " $number$, $name$_, byte_size, target);\n"
+ " $number$, $field$, byte_size, target);\n"
" }\n"
"}\n");
} else {
@@ -375,7 +375,8 @@
format(
"if (data_size > 0) {\n"
" total_size += $tag_size$ +\n"
- " ::_pbi::WireFormatLite::Int32Size(static_cast<$int32$>(data_size));\n"
+ " "
+ "::_pbi::WireFormatLite::Int32Size(static_cast<$int32$>(data_size));\n"
"}\n"
"int cached_size = ::_pbi::ToCachedSize(data_size);\n"
"_$name$_cached_byte_size_.store(cached_size,\n"
diff --git a/src/google/protobuf/compiler/cpp/cpp_field.cc b/src/google/protobuf/compiler/cpp/cpp_field.cc
index 143102d..0cf3d68 100644
--- a/src/google/protobuf/compiler/cpp/cpp_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_field.cc
@@ -81,7 +81,7 @@
std::string field_name = google::protobuf::compiler::cpp::FieldName(descriptor);
std::string field_pointer =
descriptor->options().ctype() == google::protobuf::FieldOptions::STRING
- ? "$0.GetPointer()"
+ ? "$0.UnsafeGetPointer()"
: "$0";
if (descriptor->default_value_string().empty()) {
@@ -114,7 +114,7 @@
if (descriptor->options().ctype() == google::protobuf::FieldOptions::STRING) {
return strings::Substitute(
- "$0.IsDefault() ? &$1.get() : $0.GetPointer()", field_member,
+ "$0.IsDefault() ? &$1.get() : $0.UnsafeGetPointer()", field_member,
MakeDefaultName(descriptor));
}
@@ -241,7 +241,12 @@
(*variables)["number"] = StrCat(descriptor->number());
(*variables)["classname"] = ClassName(FieldScope(descriptor), false);
(*variables)["declared_type"] = DeclaredTypeMethodName(descriptor->type());
+ // TODO(b/218325252): convert all usages of "field_member" to "field" and
+ // remove this. The former may unnecessarily cause line breaks in protoc code.
+ // Note that the length of variables has no effect on the generated code. It
+ // only affects the readability of code template in protoc.
(*variables)["field_member"] = FieldMemberName(descriptor);
+ (*variables)["field"] = FieldMemberName(descriptor);
(*variables)["tag_size"] = StrCat(
WireFormat::TagSize(descriptor->number(), descriptor->type()));
diff --git a/src/google/protobuf/compiler/cpp/cpp_generator.cc b/src/google/protobuf/compiler/cpp/cpp_generator.cc
index 5abcd45..824edc1 100644
--- a/src/google/protobuf/compiler/cpp/cpp_generator.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_generator.cc
@@ -82,6 +82,12 @@
// FOO_EXPORT is a macro which should expand to __declspec(dllexport) or
// __declspec(dllimport) depending on what is being compiled.
//
+ // If the proto_h option is passed to the compiler, we will generate all
+ // classes and enums so that they can be forward-declared from files that
+ // need them from imports.
+ //
+ // If the lite option is passed to the compiler, we will generate the
+ // current files and all transitive dependencies using the LITE runtime.
Options file_options;
file_options.opensource_runtime = opensource_runtime_;
@@ -111,6 +117,8 @@
file_options.num_cc_files =
strto32(options[i].second.c_str(), nullptr, 10);
}
+ } else if (options[i].first == "proto_h") {
+ file_options.proto_h = true;
} else if (options[i].first == "annotate_accessor") {
file_options.annotate_accessor = true;
} else if (options[i].first == "inject_field_listener_events") {
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index 030fc4b..d161377 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -1240,12 +1240,13 @@
} else {
format(
"inline int $classname$::_internal_$name$_size() const {\n"
- " return $name$_$1$.size();\n"
+ " return $1$$2$.size();\n"
"}\n"
"inline int $classname$::$name$_size() const {\n"
"$annotate_size$"
" return _internal_$name$_size();\n"
"}\n",
+ FieldMemberName(field),
IsImplicitWeakField(field, options_, scc_analyzer_) &&
field->message_type()
? ".weak"
@@ -1391,8 +1392,7 @@
if (EnableMessageOwnedArena(descriptor_, options_)) {
format(
"inline $classname$() : $classname$("
- "::$proto_ns$::Arena::InternalHelper<$classname$>::\n"
- " CreateMessageOwnedArena(), true) {}\n");
+ "::$proto_ns$::Arena::InternalCreateMessageOwnedArena(), true) {}\n");
} else {
format("inline $classname$() : $classname$(nullptr) {}\n");
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
index 845dc05..85b1066 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
@@ -182,14 +182,13 @@
// If we're not on an arena, free whatever we were holding before.
// (If we are on arena, we can just forget the earlier pointer.)
" if (GetArenaForAllocation() == nullptr) {\n"
- " delete reinterpret_cast<::$proto_ns$::MessageLite*>($name$_);\n"
+ " delete reinterpret_cast<::$proto_ns$::MessageLite*>($field$);\n"
" }\n");
if (implicit_weak_field_) {
format(
- " $name$_ = "
- "reinterpret_cast<::$proto_ns$::MessageLite*>($name$);\n");
+ " $field$ = reinterpret_cast<::$proto_ns$::MessageLite*>($name$);\n");
} else {
- format(" $name$_ = $name$;\n");
+ format(" $field$ = $name$;\n");
}
format(
" if ($name$) {\n"
@@ -207,7 +206,7 @@
"$annotate_release$"
" $clear_hasbit$\n"
" $type$* temp = $casted_member$;\n"
- " $name$_ = nullptr;\n"
+ " $field$ = nullptr;\n"
"#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE\n"
" auto* old = reinterpret_cast<::$proto_ns$::MessageLite*>(temp);\n"
" temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n"
@@ -225,7 +224,7 @@
"$type_reference_function$"
" $clear_hasbit$\n"
" $type$* temp = $casted_member$;\n"
- " $name$_ = nullptr;\n"
+ " $field$ = nullptr;\n"
" return temp;\n"
"}\n");
@@ -233,12 +232,12 @@
"inline $type$* $classname$::_internal_mutable_$name$() {\n"
"$type_reference_function$"
" $set_hasbit$\n"
- " if ($name$_ == nullptr) {\n"
+ " if ($field$ == nullptr) {\n"
" auto* p = CreateMaybeMessage<$type$>(GetArenaForAllocation());\n");
if (implicit_weak_field_) {
- format(" $name$_ = reinterpret_cast<::$proto_ns$::MessageLite*>(p);\n");
+ format(" $field$ = reinterpret_cast<::$proto_ns$::MessageLite*>(p);\n");
} else {
- format(" $name$_ = p;\n");
+ format(" $field$ = p;\n");
}
format(
" }\n"
@@ -259,9 +258,9 @@
format(" if (message_arena == nullptr) {\n");
if (IsCrossFileMessage(descriptor_)) {
format(
- " delete reinterpret_cast< ::$proto_ns$::MessageLite*>($name$_);\n");
+ " delete reinterpret_cast< ::$proto_ns$::MessageLite*>($field$);\n");
} else {
- format(" delete $name$_;\n");
+ format(" delete $field$;\n");
}
format(
" }\n"
@@ -271,14 +270,13 @@
// isn't defined in this file.
format(
" ::$proto_ns$::Arena* submessage_arena =\n"
- " ::$proto_ns$::Arena::InternalHelper<\n"
- " ::$proto_ns$::MessageLite>::GetOwningArena(\n"
+ " ::$proto_ns$::Arena::InternalGetOwningArena(\n"
" reinterpret_cast<::$proto_ns$::MessageLite*>("
"$name$));\n");
} else {
format(
" ::$proto_ns$::Arena* submessage_arena =\n"
- " ::$proto_ns$::Arena::InternalHelper<$type$>::GetOwningArena("
+ " ::$proto_ns$::Arena::InternalGetOwningArena("
"$name$);\n");
}
format(
@@ -291,9 +289,9 @@
" $clear_hasbit$\n"
" }\n");
if (implicit_weak_field_) {
- format(" $name$_ = reinterpret_cast<MessageLite*>($name$);\n");
+ format(" $field$ = reinterpret_cast<MessageLite*>($name$);\n");
} else {
- format(" $name$_ = $name$;\n");
+ format(" $field$ = $name$;\n");
}
format(
"$annotate_set$"
@@ -328,8 +326,8 @@
format(
"const ::$proto_ns$::MessageLite& $classname$::_Internal::$name$(\n"
" const $classname$* msg) {\n"
- " if (msg->$field_member$ != nullptr) {\n"
- " return *msg->$field_member$;\n"
+ " if (msg->$field$ != nullptr) {\n"
+ " return *msg->$field$;\n"
" } else {\n"
" return *$type_default_instance_ptr$;\n"
" }\n"
@@ -341,7 +339,7 @@
format(" msg->$set_hasbit$\n");
}
if (descriptor_->real_containing_oneof() == nullptr) {
- format(" if (msg->$field_member$ == nullptr) {\n");
+ format(" if (msg->$field$ == nullptr) {\n");
} else {
format(
" if (!msg->_internal_has_$name$()) {\n"
@@ -349,10 +347,10 @@
" msg->set_has_$name$();\n");
}
format(
- " msg->$field_member$ = $type_default_instance_ptr$->New(\n"
+ " msg->$field$ = $type_default_instance_ptr$->New(\n"
" msg->GetArenaForAllocation());\n"
" }\n"
- " return msg->$field_member$;\n"
+ " return msg->$field$;\n"
"}\n");
} else {
// This inline accessor directly returns member field and is used in
@@ -361,7 +359,7 @@
format(
"const $type$&\n"
"$classname$::_Internal::$name$(const $classname$* msg) {\n"
- " return *msg->$field_member$;\n"
+ " return *msg->$field$;\n"
"}\n");
}
}
@@ -374,12 +372,12 @@
// If we don't have has-bits, message presence is indicated only by ptr !=
// nullptr. Thus on clear, we need to delete the object.
format(
- "if (GetArenaForAllocation() == nullptr && $name$_ != nullptr) {\n"
- " delete $name$_;\n"
+ "if (GetArenaForAllocation() == nullptr && $field$ != nullptr) {\n"
+ " delete $field$;\n"
"}\n"
- "$name$_ = nullptr;\n");
+ "$field$ = nullptr;\n");
} else {
- format("if ($name$_ != nullptr) $name$_->Clear();\n");
+ format("if ($field$ != nullptr) $field$->Clear();\n");
}
}
@@ -392,14 +390,14 @@
// If we don't have has-bits, message presence is indicated only by ptr !=
// nullptr. Thus on clear, we need to delete the object.
format(
- "if (GetArenaForAllocation() == nullptr && $name$_ != nullptr) {\n"
- " delete $name$_;\n"
+ "if (GetArenaForAllocation() == nullptr && $field$ != nullptr) {\n"
+ " delete $field$;\n"
"}\n"
- "$name$_ = nullptr;\n");
+ "$field$ = nullptr;\n");
} else {
format(
- "$DCHK$($name$_ != nullptr);\n"
- "$name$_->Clear();\n");
+ "$DCHK$($field$ != nullptr);\n"
+ "$field$->Clear();\n");
}
}
@@ -422,7 +420,7 @@
GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
Formatter format(printer, variables_);
- format("swap($name$_, other->$name$_);\n");
+ format("swap($field$, other->$field$);\n");
}
void MessageFieldGenerator::GenerateDestructorCode(io::Printer* printer) const {
@@ -487,7 +485,7 @@
format(
"total_size += $tag_size$ +\n"
" ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n"
- " *$field_member$);\n");
+ " *$field$);\n");
}
void MessageFieldGenerator::GenerateIsInitialized(io::Printer* printer) const {
@@ -498,7 +496,7 @@
Formatter format(printer, variables_);
format(
"if (_internal_has_$name$()) {\n"
- " if (!$name$_->IsInitialized()) return false;\n"
+ " if (!$field$->IsInitialized()) return false;\n"
"}\n");
}
@@ -532,15 +530,13 @@
// isn't defined in this file.
format(
" ::$proto_ns$::Arena* submessage_arena =\n"
- " ::$proto_ns$::Arena::InternalHelper<\n"
- " ::$proto_ns$::MessageLite>::GetOwningArena(\n"
+ " ::$proto_ns$::Arena::InternalGetOwningArena(\n"
" reinterpret_cast<::$proto_ns$::MessageLite*>("
"$name$));\n");
} else {
format(
" ::$proto_ns$::Arena* submessage_arena =\n"
- " ::$proto_ns$::Arena::InternalHelper<"
- "$type$>::GetOwningArena($name$);\n");
+ " ::$proto_ns$::Arena::InternalGetOwningArena($name$);\n");
}
format(
" if (message_arena != submessage_arena) {\n"
@@ -548,7 +544,7 @@
" message_arena, $name$, submessage_arena);\n"
" }\n"
" set_has_$name$();\n"
- " $field_member$ = $name$;\n"
+ " $field$ = $name$;\n"
" }\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
@@ -569,7 +565,7 @@
" if (GetArenaForAllocation() != nullptr) {\n"
" temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n"
" }\n"
- " $field_member$ = nullptr;\n"
+ " $field$ = nullptr;\n"
" return temp;\n"
" } else {\n"
" return nullptr;\n"
@@ -596,7 +592,7 @@
" if (_internal_has_$name$()) {\n"
" clear_has_$oneof_name$();\n"
" $type$* temp = $casted_member$;\n"
- " $field_member$ = nullptr;\n"
+ " $field$ = nullptr;\n"
" return temp;\n"
" } else {\n"
" return nullptr;\n"
@@ -612,10 +608,10 @@
" set_has_$name$();\n");
if (implicit_weak_field_) {
format(
- " $field_member$ = "
+ " $field$ = "
"reinterpret_cast<::$proto_ns$::MessageLite*>($name$);\n");
} else {
- format(" $field_member$ = $name$;\n");
+ format(" $field$ = $name$;\n");
}
format(
" }\n"
@@ -630,12 +626,12 @@
" set_has_$name$();\n");
if (implicit_weak_field_) {
format(
- " $field_member$ = "
+ " $field$ = "
"reinterpret_cast<::$proto_ns$::MessageLite*>(CreateMaybeMessage< "
"$type$ >(GetArenaForAllocation()));\n");
} else {
format(
- " $field_member$ = CreateMaybeMessage< $type$ "
+ " $field$ = CreateMaybeMessage< $type$ "
">(GetArenaForAllocation());\n");
}
format(
@@ -657,7 +653,7 @@
Formatter format(printer, variables_);
format(
"if (GetArenaForAllocation() == nullptr) {\n"
- " delete $field_member$;\n"
+ " delete $field$;\n"
"}\n");
}
@@ -690,7 +686,7 @@
Formatter format(printer, variables_);
format(
"if (_internal_has_$name$()) {\n"
- " if (!$field_member$->IsInitialized()) return false;\n"
+ " if (!$field$->IsInitialized()) return false;\n"
"}\n");
}
@@ -769,21 +765,21 @@
// TODO(dlj): move insertion points
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
"$type_reference_function$"
- " return $name$_$weak$.Mutable(index);\n"
+ " return $field$$weak$.Mutable(index);\n"
"}\n"
"inline ::$proto_ns$::RepeatedPtrField< $type$ >*\n"
"$classname$::mutable_$name$() {\n"
"$annotate_mutable_list$"
" // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
"$type_reference_function$"
- " return &$name$_$weak$;\n"
+ " return &$field$$weak$;\n"
"}\n");
if (options_.safe_boundary_check) {
format(
"inline const $type$& $classname$::_internal_$name$(int index) const "
"{\n"
- " return $name$_$weak$.InternalCheckedGet(index,\n"
+ " return $field$$weak$.InternalCheckedGet(index,\n"
" reinterpret_cast<const $type$&>($type_default_instance$));\n"
"}\n");
} else {
@@ -791,7 +787,7 @@
"inline const $type$& $classname$::_internal_$name$(int index) const "
"{\n"
"$type_reference_function$"
- " return $name$_$weak$.Get(index);\n"
+ " return $field$$weak$.Get(index);\n"
"}\n");
}
@@ -802,7 +798,7 @@
" return _internal_$name$(index);\n"
"}\n"
"inline $type$* $classname$::_internal_add_$name$() {\n"
- " return $name$_$weak$.Add();\n"
+ " return $field$$weak$.Add();\n"
"}\n"
"inline $type$* $classname$::add_$name$() {\n"
" $type$* _add = _internal_add_$name$();\n"
@@ -817,7 +813,7 @@
"$annotate_list$"
" // @@protoc_insertion_point(field_list:$full_name$)\n"
"$type_reference_function$"
- " return $name$_$weak$;\n"
+ " return $field$$weak$;\n"
"}\n");
}
@@ -826,7 +822,7 @@
GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
Formatter format(printer, variables_);
- format("$name$_.Clear();\n");
+ format("$field$.Clear();\n");
}
void RepeatedMessageFieldGenerator::GenerateMergingCode(
@@ -834,7 +830,7 @@
GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
Formatter format(printer, variables_);
- format("$name$_.MergeFrom(from.$name$_);\n");
+ format("$field$.MergeFrom(from.$field$);\n");
}
void RepeatedMessageFieldGenerator::GenerateSwappingCode(
@@ -842,7 +838,7 @@
GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
Formatter format(printer, variables_);
- format("$name$_.InternalSwap(&other->$name$_);\n");
+ format("$field$.InternalSwap(&other->$field$);\n");
}
void RepeatedMessageFieldGenerator::GenerateConstructorCode(
@@ -857,8 +853,8 @@
Formatter format(printer, variables_);
if (implicit_weak_field_) {
format(
- "for (auto it = this->$name$_.pointer_begin(),\n"
- " end = this->$name$_.pointer_end(); it < end; ++it) {\n");
+ "for (auto it = this->$field$.pointer_begin(),\n"
+ " end = this->$field$.pointer_end(); it < end; ++it) {\n");
if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) {
format(
" target = ::$proto_ns$::internal::WireFormatLite::\n"
@@ -902,7 +898,7 @@
Formatter format(printer, variables_);
format(
"total_size += $tag_size$UL * this->_internal_$name$_size();\n"
- "for (const auto& msg : this->$name$_) {\n"
+ "for (const auto& msg : this->$field$) {\n"
" total_size +=\n"
" ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(msg);\n"
"}\n");
@@ -917,11 +913,11 @@
Formatter format(printer, variables_);
if (implicit_weak_field_) {
format(
- "if (!::$proto_ns$::internal::AllAreInitializedWeak($name$_.weak))\n"
+ "if (!::$proto_ns$::internal::AllAreInitializedWeak($field$.weak))\n"
" return false;\n");
} else {
format(
- "if (!::$proto_ns$::internal::AllAreInitialized($name$_))\n"
+ "if (!::$proto_ns$::internal::AllAreInitialized($field$))\n"
" return false;\n");
}
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
index 43a5ade..bd6af81 100644
--- a/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
@@ -92,8 +92,7 @@
return false;
}
switch (field->type()) {
- // Strings, enums, and groups are not handled on the fast path.
- case FieldDescriptor::TYPE_STRING:
+ // Groups are not handled on the fast path.
case FieldDescriptor::TYPE_GROUP:
return false;
@@ -109,6 +108,7 @@
break;
// Some bytes fields can be handled on fast path.
+ case FieldDescriptor::TYPE_STRING:
case FieldDescriptor::TYPE_BYTES:
if (field->options().ctype() != FieldOptions::STRING ||
!field->default_value_string().empty() ||
@@ -237,15 +237,15 @@
}
break;
- // TODO(b/209516305): add TYPE_STRING once field names are available.
- case FieldDescriptor::TYPE_BYTES:
- if (IsStringInlined(field, options)) {
- // TODO(b/198211897): support InilnedStringField.
- handled = false;
- } else {
- handled = true;
- }
- break;
+ case FieldDescriptor::TYPE_BYTES:
+ case FieldDescriptor::TYPE_STRING:
+ if (IsStringInlined(field, options)) {
+ // TODO(b/198211897): support InilnedStringField.
+ handled = false;
+ } else {
+ handled = true;
+ }
+ break;
case FieldDescriptor::TYPE_MESSAGE:
// TODO(b/210762816): support remaining field types.
@@ -777,9 +777,9 @@
} else {
format(
"{$1$,\n"
- " {$2$, $3$, $4$, PROTOBUF_FIELD_OFFSET($classname$, $5$_)}},\n",
+ " {$2$, $3$, $4$, PROTOBUF_FIELD_OFFSET($classname$, $5$)}},\n",
info.func_name, info.coded_tag, info.hasbit_idx, info.aux_idx,
- FieldName(info.field));
+ FieldMemberName(info.field));
}
}
}
@@ -1003,7 +1003,7 @@
"::" + MakeDefaultName(field) + ".get()";
format(
"if (arena != nullptr) {\n"
- " ptr = ctx->ReadArenaString(ptr, &$msg$$name$_, arena");
+ " ptr = ctx->ReadArenaString(ptr, &$msg$$field$, arena");
if (IsStringInlined(field, options_)) {
GOOGLE_DCHECK(!inlined_string_indices_.empty());
int inlined_string_index = inlined_string_indices_[field->index()];
@@ -1022,10 +1022,9 @@
");\n"
"} else {\n"
" ptr = ::_pbi::InlineGreedyStringParser("
- "$msg$$name$_.MutableNoArenaNoDefault(&$1$), ptr, ctx);\n"
+ "$msg$$field$.MutableNoCopy(nullptr), ptr, ctx);\n"
"}\n"
- "const std::string* str = &$msg$$name$_.Get(); (void)str;\n",
- default_string);
+ "const std::string* str = &$msg$$field$.Get(); (void)str;\n");
}
void ParseFunctionGenerator::GenerateStrings(Formatter& format,
@@ -1134,13 +1133,13 @@
format(
"auto object = "
"::$proto_ns$::internal::InitEnumParseWrapper<"
- "$unknown_fields_type$>(&$msg$$name$_, $1$_IsValid, "
+ "$unknown_fields_type$>(&$msg$$field$, $1$_IsValid, "
"$2$, &$msg$_internal_metadata_);\n"
"ptr = ctx->ParseMessage(&object, ptr);\n",
QualifiedClassName(val->enum_type(), options_),
field->number());
} else {
- format("ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n");
+ format("ptr = ctx->ParseMessage(&$msg$$field$, ptr);\n");
}
} else if (IsLazy(field, options_, scc_analyzer_)) {
bool eager_verify =
@@ -1157,19 +1156,19 @@
format(
"if (!$msg$_internal_has_$name$()) {\n"
" $msg$clear_$1$();\n"
- " $msg$$1$_.$name$_ = ::$proto_ns$::Arena::CreateMessage<\n"
+ " $msg$$field$ = ::$proto_ns$::Arena::CreateMessage<\n"
" ::$proto_ns$::internal::LazyField>("
"$msg$GetArenaForAllocation());\n"
" $msg$set_has_$name$();\n"
"}\n"
- "auto* lazy_field = $msg$$1$_.$name$_;\n",
+ "auto* lazy_field = $msg$$field$;\n",
field->containing_oneof()->name());
} else if (HasHasbit(field)) {
format(
"_Internal::set_has_$name$(&$has_bits$);\n"
- "auto* lazy_field = &$msg$$name$_;\n");
+ "auto* lazy_field = &$msg$$field$;\n");
} else {
- format("auto* lazy_field = &$msg$$name$_;\n");
+ format("auto* lazy_field = &$msg$$field$;\n");
}
format(
"::$proto_ns$::internal::LazyFieldParseHelper<\n"
@@ -1192,7 +1191,7 @@
"ptr);\n");
} else {
format(
- "ptr = ctx->ParseMessage($msg$$name$_.AddWeak("
+ "ptr = ctx->ParseMessage($msg$$field$.AddWeak("
"reinterpret_cast<const ::$proto_ns$::MessageLite*>($1$ptr_)"
"), ptr);\n",
QualifiedDefaultInstanceName(field->message_type(), options_));
@@ -1291,7 +1290,7 @@
format("_Internal::set_has_$name$(&$has_bits$);\n");
}
format(
- "$msg$$name$_ = ::$proto_ns$::internal::ReadVarint$1$$2$(&ptr);\n"
+ "$msg$$field$ = ::$proto_ns$::internal::ReadVarint$1$$2$(&ptr);\n"
"CHK_(ptr);\n",
zigzag, size);
}
@@ -1438,6 +1437,8 @@
format.Indent();
for (const auto* field : fields) {
+ // Set abbreviated form instead of field_member.
+ format.Set("field", FieldMemberName(field));
PrintFieldComment(format, field);
format("case $1$:\n", field->number());
format.Indent();
diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
index e09f93e..f307256 100644
--- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
@@ -150,7 +150,7 @@
Formatter format(printer, variables_);
format(
"inline $type$ $classname$::_internal_$name$() const {\n"
- " return $name$_;\n"
+ " return $field$;\n"
"}\n"
"inline $type$ $classname$::$name$() const {\n"
"$annotate_get$"
@@ -159,7 +159,7 @@
"}\n"
"inline void $classname$::_internal_set_$name$($type$ value) {\n"
" $set_hasbit$\n"
- " $name$_ = value;\n"
+ " $field$ = value;\n"
"}\n"
"inline void $classname$::set_$name$($type$ value) {\n"
" _internal_set_$name$(value);\n"
@@ -170,7 +170,7 @@
void PrimitiveFieldGenerator::GenerateClearingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_ = $default$;\n");
+ format("$field$ = $default$;\n");
}
void PrimitiveFieldGenerator::GenerateMergingCode(io::Printer* printer) const {
@@ -180,7 +180,7 @@
void PrimitiveFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
- format("swap($name$_, other->$name$_);\n");
+ format("swap($field$, other->$field$);\n");
}
void PrimitiveFieldGenerator::GenerateConstructorCode(
@@ -249,7 +249,7 @@
format(
"inline $type$ $classname$::_internal_$name$() const {\n"
" if (_internal_has_$name$()) {\n"
- " return $field_member$;\n"
+ " return $field$;\n"
" }\n"
" return $default$;\n"
"}\n"
@@ -258,7 +258,7 @@
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" }\n"
- " $field_member$ = value;\n"
+ " $field$ = value;\n"
"}\n"
"inline $type$ $classname$::$name$() const {\n"
"$annotate_get$"
@@ -275,7 +275,7 @@
void PrimitiveOneofFieldGenerator::GenerateClearingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$field_member$ = $default$;\n");
+ format("$field$ = $default$;\n");
}
void PrimitiveOneofFieldGenerator::GenerateSwappingCode(
@@ -344,7 +344,7 @@
Formatter format(printer, variables_);
format(
"inline $type$ $classname$::_internal_$name$(int index) const {\n"
- " return $name$_.Get(index);\n"
+ " return $field$.Get(index);\n"
"}\n"
"inline $type$ $classname$::$name$(int index) const {\n"
"$annotate_get$"
@@ -353,11 +353,11 @@
"}\n"
"inline void $classname$::set_$name$(int index, $type$ value) {\n"
"$annotate_set$"
- " $name$_.Set(index, value);\n"
+ " $field$.Set(index, value);\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline void $classname$::_internal_add_$name$($type$ value) {\n"
- " $name$_.Add(value);\n"
+ " $field$.Add(value);\n"
"}\n"
"inline void $classname$::add_$name$($type$ value) {\n"
" _internal_add_$name$(value);\n"
@@ -366,7 +366,7 @@
"}\n"
"inline const ::$proto_ns$::RepeatedField< $type$ >&\n"
"$classname$::_internal_$name$() const {\n"
- " return $name$_;\n"
+ " return $field$;\n"
"}\n"
"inline const ::$proto_ns$::RepeatedField< $type$ >&\n"
"$classname$::$name$() const {\n"
@@ -376,7 +376,7 @@
"}\n"
"inline ::$proto_ns$::RepeatedField< $type$ >*\n"
"$classname$::_internal_mutable_$name$() {\n"
- " return &$name$_;\n"
+ " return &$field$;\n"
"}\n"
"inline ::$proto_ns$::RepeatedField< $type$ >*\n"
"$classname$::mutable_$name$() {\n"
@@ -389,30 +389,19 @@
void RepeatedPrimitiveFieldGenerator::GenerateClearingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.Clear();\n");
+ format("$field$.Clear();\n");
}
void RepeatedPrimitiveFieldGenerator::GenerateMergingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.MergeFrom(from.$name$_);\n");
+ format("$field$.MergeFrom(from.$field$);\n");
}
void RepeatedPrimitiveFieldGenerator::GenerateSwappingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.InternalSwap(&other->$name$_);\n");
-}
-
-void RepeatedPrimitiveFieldGenerator::GenerateConstructorCode(
- io::Printer* printer) const {
- // Not needed for repeated fields.
-}
-
-void RepeatedPrimitiveFieldGenerator::GenerateCopyConstructorCode(
- io::Printer* printer) const {
- Formatter format(printer, variables_);
- format("$name$_.CopyFrom(from.$name$_);\n");
+ format("$field$.InternalSwap(&other->$field$);\n");
}
void RepeatedPrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray(
@@ -456,7 +445,7 @@
if (fixed_size == -1) {
format(
"size_t data_size = ::_pbi::WireFormatLite::\n"
- " $declared_type$Size(this->$name$_);\n");
+ " $declared_type$Size(this->$field$);\n");
} else {
format(
"unsigned int count = static_cast<unsigned "
diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.h b/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
index 0cdc12c..77ac598 100644
--- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
@@ -98,8 +98,8 @@
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
- void GenerateConstructorCode(io::Printer* printer) const override;
- void GenerateCopyConstructorCode(io::Printer* printer) const override;
+ void GenerateConstructorCode(io::Printer* printer) const override {}
+ void GenerateCopyConstructorCode(io::Printer* printer) const override {}
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index 529cb86..9a57271 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -54,8 +54,6 @@
const std::string kNS = "::" + (*variables)["proto_ns"] + "::internal::";
const std::string kArenaStringPtr = kNS + "ArenaStringPtr";
- const std::string kEmptyDefault = kArenaStringPtr + "::EmptyDefault{}";
- const std::string kNonEmptyDefault = kArenaStringPtr + "::NonEmptyDefault{}";
(*variables)["default"] = DefaultValue(options, descriptor);
(*variables)["default_length"] =
@@ -64,21 +62,17 @@
(*variables)["default_variable_name"] = default_variable_string;
if (descriptor->default_value_string().empty()) {
- (*variables)["init_value"] = "";
(*variables)["default_string"] = kNS + "GetEmptyStringAlreadyInited()";
(*variables)["default_value"] = "&" + (*variables)["default_string"];
- (*variables)["default_value_tag"] = kEmptyDefault;
- (*variables)["default_variable_or_tag"] = kEmptyDefault;
+ (*variables)["lazy_variable_args"] = "";
} else {
(*variables)["lazy_variable"] =
QualifiedClassName(descriptor->containing_type(), options) +
"::" + default_variable_string;
- (*variables)["init_value"] = "nullptr";
(*variables)["default_string"] = (*variables)["lazy_variable"] + ".get()";
(*variables)["default_value"] = "nullptr";
- (*variables)["default_value_tag"] = kNonEmptyDefault;
- (*variables)["default_variable_or_tag"] = (*variables)["lazy_variable"];
+ (*variables)["lazy_variable_args"] = (*variables)["lazy_variable"] + ", ";
}
(*variables)["pointer_type"] =
@@ -210,7 +204,7 @@
" // @@protoc_insertion_point(field_get:$full_name$)\n");
if (!descriptor_->default_value_string().empty()) {
format(
- " if ($name$_.IsDefault()) return "
+ " if ($field$.IsDefault()) return "
"$default_variable_name$.get();\n");
}
format(
@@ -222,7 +216,7 @@
"inline PROTOBUF_ALWAYS_INLINE\n"
"void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n"
" $set_hasbit$\n"
- " $name$_.$setter$($default_value_tag$, static_cast<ArgT0 &&>(arg0),"
+ " $field$.$setter$(static_cast<ArgT0 &&>(arg0),"
" args..., GetArenaForAllocation());\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
@@ -233,7 +227,7 @@
"inline PROTOBUF_ALWAYS_INLINE\n"
"void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n"
" $set_hasbit$\n"
- " $name$_.$setter$(nullptr, static_cast<ArgT0 &&>(arg0),"
+ " $field$.$setter$(static_cast<ArgT0 &&>(arg0),"
" args..., GetArenaForAllocation(), _internal_$name$_donated(), "
"&$donating_states_word$, $mask_for_undonate$, this);\n"
"$annotate_set$"
@@ -252,18 +246,18 @@
" return _s;\n"
"}\n"
"inline const std::string& $classname$::_internal_$name$() const {\n"
- " return $name$_.Get();\n"
+ " return $field$.Get();\n"
"}\n"
"inline void $classname$::_internal_set_$name$(const std::string& "
"value) {\n"
" $set_hasbit$\n");
if (!inlined_) {
format(
- " $name$_.Set($default_value_tag$, value, GetArenaForAllocation());\n"
+ " $field$.Set(value, GetArenaForAllocation());\n"
"}\n");
} else {
format(
- " $name$_.Set(nullptr, value, GetArenaForAllocation(),\n"
+ " $field$.Set(value, GetArenaForAllocation(),\n"
" _internal_$name$_donated(), &$donating_states_word$, "
"$mask_for_undonate$, this);\n"
"}\n");
@@ -273,12 +267,12 @@
" $set_hasbit$\n");
if (!inlined_) {
format(
- " return $name$_.Mutable($default_variable_or_tag$, "
+ " return $field$.Mutable($lazy_variable_args$"
"GetArenaForAllocation());\n"
"}\n");
} else {
format(
- " return $name$_.Mutable($default_variable_or_tag$, "
+ " return $field$.Mutable($lazy_variable_args$"
"GetArenaForAllocation(), _internal_$name$_donated(), "
"&$donating_states_word$, $mask_for_undonate$, this);\n"
"}\n");
@@ -295,26 +289,23 @@
" }\n"
" $clear_hasbit$\n");
if (!inlined_) {
- format(
- " auto* p = $name$_.ReleaseNonDefault($default_value$, "
- "GetArenaForAllocation());\n");
+ format(" auto* p = $field$.Release();\n");
if (descriptor_->default_value_string().empty()) {
format(
"#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
- " if ($name$_.IsDefault()) {\n"
- " $name$_.Set($default_value$, \"\", GetArenaForAllocation());\n"
+ " if ($field$.IsDefault()) {\n"
+ " $field$.Set(\"\", GetArenaForAllocation());\n"
" }\n"
"#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
}
format(" return p;\n");
} else {
format(
- " return $name$_.Release(nullptr, GetArenaForAllocation(), "
+ " return $field$.Release(GetArenaForAllocation(), "
"_internal_$name$_donated());\n");
}
} else {
- format(
- " return $name$_.Release($default_value$, GetArenaForAllocation());\n");
+ format(" return $field$.Release();\n");
}
format(
@@ -326,21 +317,19 @@
" $clear_hasbit$\n"
" }\n");
if (!inlined_) {
- format(
- " $name$_.SetAllocated($default_value$, $name$,\n"
- " GetArenaForAllocation());\n");
+ format(" $field$.SetAllocated($name$, GetArenaForAllocation());\n");
if (descriptor_->default_value_string().empty()) {
format(
"#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
- " if ($name$_.IsDefault()) {\n"
- " $name$_.Set($default_value$, \"\", GetArenaForAllocation());\n"
+ " if ($field$.IsDefault()) {\n"
+ " $field$.Set(\"\", GetArenaForAllocation());\n"
" }\n"
"#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
}
} else {
// Currently, string fields with default value can't be inlined.
format(
- " $name$_.SetAllocated(nullptr, $name$, GetArenaForAllocation(), "
+ " $field$.SetAllocated(nullptr, $name$, GetArenaForAllocation(), "
"_internal_$name$_donated(), &$donating_states_word$, "
"$mask_for_undonate$, this);\n");
}
@@ -364,11 +353,11 @@
void StringFieldGenerator::GenerateClearingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
if (descriptor_->default_value_string().empty()) {
- format("$name$_.ClearToEmpty();\n");
+ format("$field$.ClearToEmpty();\n");
} else {
GOOGLE_DCHECK(!inlined_);
format(
- "$name$_.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n");
+ "$field$.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n");
}
}
@@ -394,20 +383,20 @@
//
// For non-inlined strings, we distinguish from non-default by comparing
// instances, rather than contents.
- format("$DCHK$(!$name$_.IsDefault());\n");
+ format("$DCHK$(!$field$.IsDefault());\n");
}
if (descriptor_->default_value_string().empty()) {
if (must_be_present) {
- format("$name$_.ClearNonDefaultToEmpty();\n");
+ format("$field$.ClearNonDefaultToEmpty();\n");
} else {
- format("$name$_.ClearToEmpty();\n");
+ format("$field$.ClearToEmpty();\n");
}
} else {
// Clear to a non-empty default is more involved, as we try to use the
// Arena if one is present and may need to reallocate the string.
format(
- "$name$_.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n ");
+ "$field$.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n ");
}
}
@@ -422,16 +411,15 @@
if (!inlined_) {
format(
"::$proto_ns$::internal::ArenaStringPtr::InternalSwap(\n"
- " $default_value$,\n"
- " &$name$_, lhs_arena,\n"
- " &other->$name$_, rhs_arena\n"
+ " &$field$, lhs_arena,\n"
+ " &other->$field$, rhs_arena\n"
");\n");
} else {
format(
"::$proto_ns$::internal::InlinedStringField::InternalSwap(\n"
- " &$name$_, lhs_arena, "
+ " &$field$, lhs_arena, "
"(_inlined_string_donated_[0] & 0x1u) == 0, this,\n"
- " &other->$name$_, rhs_arena, "
+ " &other->$field$, rhs_arena, "
"(other->_inlined_string_donated_[0] & 0x1u) == 0, other);\n");
}
}
@@ -442,12 +430,12 @@
return;
}
GOOGLE_DCHECK(!inlined_);
- format("$name$_.InitDefault($init_value$);\n");
+ format("$name$_.InitDefault();\n");
if (IsString(descriptor_, options_) &&
descriptor_->default_value_string().empty()) {
format(
"#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
- " $name$_.Set($default_value$, \"\", GetArenaForAllocation());\n"
+ " $name$_.Set(\"\", GetArenaForAllocation());\n"
"#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
}
}
@@ -470,11 +458,11 @@
if (!inlined_) {
format(
- "$name$_.Set($default_value_tag$, from._internal_$name$(), \n"
+ "$field$.Set(from._internal_$name$(), \n"
" GetArenaForAllocation());\n");
} else {
format(
- "$name$_.Set(nullptr, from._internal_$name$(),\n"
+ "$field$.Set(from._internal_$name$(),\n"
" GetArenaForAllocation(), _internal_$name$_donated(), "
"&$donating_states_word$, $mask_for_undonate$, this);\n");
}
@@ -486,14 +474,14 @@
void StringFieldGenerator::GenerateDestructorCode(io::Printer* printer) const {
Formatter format(printer, variables_);
if (!inlined_) {
- format("$name$_.DestroyNoArena($default_value$);\n");
+ format("$field$.Destroy();\n");
return;
}
// Explicitly calls ~InlinedStringField as its automatic call is disabled.
// Destructor has been implicitly skipped as a union, and even the
// message-owned arena is enabled, arena could still be missing for
// Arena::CreateMessage(nullptr).
- format("$name$_.~InlinedStringField();\n");
+ format("$field$.~InlinedStringField();\n");
}
ArenaDtorNeeds StringFieldGenerator::NeedsArenaDestructor() const {
@@ -507,7 +495,7 @@
// _this is the object being destructed (we are inside a static method here).
format(
"if (!_this->_internal_$name$_donated()) {\n"
- " _this->$name$_.~InlinedStringField();\n"
+ " _this->$field$.~InlinedStringField();\n"
"}\n");
}
@@ -575,9 +563,9 @@
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.InitDefault($init_value$);\n"
+ " $field$.InitDefault();\n"
" }\n"
- " $field_member$.$setter$($default_value_tag$,"
+ " $field$.$setter$("
" static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
@@ -590,7 +578,7 @@
"}\n"
"inline const std::string& $classname$::_internal_$name$() const {\n"
" if (_internal_has_$name$()) {\n"
- " return $field_member$.Get();\n"
+ " return $field$.Get();\n"
" }\n"
" return $default_string$;\n"
"}\n"
@@ -599,28 +587,26 @@
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.InitDefault($init_value$);\n"
+ " $field$.InitDefault();\n"
" }\n"
- " $field_member$.Set($default_value_tag$, value, "
- "GetArenaForAllocation());\n"
+ " $field$.Set(value, GetArenaForAllocation());\n"
"}\n");
format(
"inline std::string* $classname$::_internal_mutable_$name$() {\n"
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$.InitDefault($init_value$);\n"
+ " $field$.InitDefault();\n"
" }\n"
- " return $field_member$.Mutable(\n"
- " $default_variable_or_tag$, GetArenaForAllocation());\n"
+ " return $field$.Mutable($lazy_variable_args$"
+ " GetArenaForAllocation());\n"
"}\n"
"inline std::string* $classname$::$release_name$() {\n"
"$annotate_release$"
" // @@protoc_insertion_point(field_release:$full_name$)\n"
" if (_internal_has_$name$()) {\n"
" clear_has_$oneof_name$();\n"
- " return $field_member$.ReleaseNonDefault($default_value$, "
- "GetArenaForAllocation());\n"
+ " return $field$.Release();\n"
" } else {\n"
" return nullptr;\n"
" }\n"
@@ -631,7 +617,7 @@
" }\n"
" if ($name$ != nullptr) {\n"
" set_has_$name$();\n"
- " $field_member$.InitAllocated($name$, GetArenaForAllocation());\n"
+ " $field$.InitAllocated($name$, GetArenaForAllocation());\n"
" }\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
@@ -641,9 +627,7 @@
void StringOneofFieldGenerator::GenerateClearingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format(
- "$field_member$.Destroy($default_value_tag$, "
- "GetArenaForAllocation());\n");
+ format("$field$.Destroy();\n");
}
void StringOneofFieldGenerator::GenerateMessageClearingCode(
@@ -758,14 +742,14 @@
format(
"inline const std::string& $classname$::_internal_$name$(int index) "
"const {\n"
- " return $name$_.InternalCheckedGet(\n"
+ " return $field$.InternalCheckedGet(\n"
" index, ::$proto_ns$::internal::GetEmptyStringAlreadyInited());\n"
"}\n");
} else {
format(
"inline const std::string& $classname$::_internal_$name$(int index) "
"const {\n"
- " return $name$_.Get(index);\n"
+ " return $field$.Get(index);\n"
"}\n");
}
format(
@@ -777,23 +761,23 @@
"inline std::string* $classname$::mutable_$name$(int index) {\n"
"$annotate_mutable$"
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $name$_.Mutable(index);\n"
+ " return $field$.Mutable(index);\n"
"}\n"
"inline void $classname$::set_$name$(int index, const std::string& "
"value) "
"{\n"
- " $name$_.Mutable(index)->assign(value);\n"
+ " $field$.Mutable(index)->assign(value);\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline void $classname$::set_$name$(int index, std::string&& value) {\n"
- " $name$_.Mutable(index)->assign(std::move(value));\n"
+ " $field$.Mutable(index)->assign(std::move(value));\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline void $classname$::set_$name$(int index, const char* value) {\n"
" $null_check$"
- " $name$_.Mutable(index)->assign(value);\n"
+ " $field$.Mutable(index)->assign(value);\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n");
@@ -801,7 +785,7 @@
format(
"inline void "
"$classname$::set_$name$(int index, StringPiece value) {\n"
- " $name$_.Mutable(index)->assign(value.data(), value.size());\n"
+ " $field$.Mutable(index)->assign(value.data(), value.size());\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n"
"}\n");
@@ -810,34 +794,34 @@
"inline void "
"$classname$::set_$name$"
"(int index, const $pointer_type$* value, size_t size) {\n"
- " $name$_.Mutable(index)->assign(\n"
+ " $field$.Mutable(index)->assign(\n"
" reinterpret_cast<const char*>(value), size);\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
"inline std::string* $classname$::_internal_add_$name$() {\n"
- " return $name$_.Add();\n"
+ " return $field$.Add();\n"
"}\n"
"inline void $classname$::add_$name$(const std::string& value) {\n"
- " $name$_.Add()->assign(value);\n"
+ " $field$.Add()->assign(value);\n"
"$annotate_add$"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
"}\n"
"inline void $classname$::add_$name$(std::string&& value) {\n"
- " $name$_.Add(std::move(value));\n"
+ " $field$.Add(std::move(value));\n"
"$annotate_add$"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
"}\n"
"inline void $classname$::add_$name$(const char* value) {\n"
" $null_check$"
- " $name$_.Add()->assign(value);\n"
+ " $field$.Add()->assign(value);\n"
"$annotate_add$"
" // @@protoc_insertion_point(field_add_char:$full_name$)\n"
"}\n");
if (!options_.opensource_runtime) {
format(
"inline void $classname$::add_$name$(StringPiece value) {\n"
- " $name$_.Add()->assign(value.data(), value.size());\n"
+ " $field$.Add()->assign(value.data(), value.size());\n"
"$annotate_add$"
" // @@protoc_insertion_point(field_add_string_piece:$full_name$)\n"
"}\n");
@@ -845,7 +829,7 @@
format(
"inline void "
"$classname$::add_$name$(const $pointer_type$* value, size_t size) {\n"
- " $name$_.Add()->assign(reinterpret_cast<const char*>(value), size);\n"
+ " $field$.Add()->assign(reinterpret_cast<const char*>(value), size);\n"
"$annotate_add$"
" // @@protoc_insertion_point(field_add_pointer:$full_name$)\n"
"}\n"
@@ -853,43 +837,32 @@
"$classname$::$name$() const {\n"
"$annotate_list$"
" // @@protoc_insertion_point(field_list:$full_name$)\n"
- " return $name$_;\n"
+ " return $field$;\n"
"}\n"
"inline ::$proto_ns$::RepeatedPtrField<std::string>*\n"
"$classname$::mutable_$name$() {\n"
"$annotate_mutable_list$"
" // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
- " return &$name$_;\n"
+ " return &$field$;\n"
"}\n");
}
void RepeatedStringFieldGenerator::GenerateClearingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.Clear();\n");
+ format("$field$.Clear();\n");
}
void RepeatedStringFieldGenerator::GenerateMergingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.MergeFrom(from.$name$_);\n");
+ format("$field$.MergeFrom(from.$field$);\n");
}
void RepeatedStringFieldGenerator::GenerateSwappingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.InternalSwap(&other->$name$_);\n");
-}
-
-void RepeatedStringFieldGenerator::GenerateConstructorCode(
- io::Printer* printer) const {
- // Not needed for repeated fields.
-}
-
-void RepeatedStringFieldGenerator::GenerateCopyConstructorCode(
- io::Printer* printer) const {
- Formatter format(printer, variables_);
- format("$name$_.CopyFrom(from.$name$_);");
+ format("$field$.InternalSwap(&other->$field$);\n");
}
void RepeatedStringFieldGenerator::GenerateSerializeWithCachedSizesToArray(
@@ -916,11 +889,11 @@
Formatter format(printer, variables_);
format(
"total_size += $tag_size$ *\n"
- " ::$proto_ns$::internal::FromIntSize($name$_.size());\n"
- "for (int i = 0, n = $name$_.size(); i < n; i++) {\n"
+ " ::$proto_ns$::internal::FromIntSize($field$.size());\n"
+ "for (int i = 0, n = $field$.size(); i < n; i++) {\n"
" total_size += "
"::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n"
- " $name$_.Get(i));\n"
+ " $field$.Get(i));\n"
"}\n");
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.h b/src/google/protobuf/compiler/cpp/cpp_string_field.h
index 436643c..845bf07 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.h
@@ -111,8 +111,8 @@
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
- void GenerateConstructorCode(io::Printer* printer) const override;
- void GenerateCopyConstructorCode(io::Printer* printer) const override;
+ void GenerateConstructorCode(io::Printer* printer) const override {}
+ void GenerateCopyConstructorCode(io::Printer* printer) const override {}
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
index 713f93e..b6f53a5 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
@@ -190,10 +190,20 @@
// header search path since the generate #import will be more complete.
generation_options.runtime_import_prefix =
StripSuffixString(options[i].second, "/");
+ } else if (options[i].first == "default_objc_class_prefix") {
+ // The default objc class prefix to use if specified by the command line
+ // invocation. The file option is always honored first if one is present.
+ std::string value = options[i].second;
+ if (value.empty()) {
+ *error = "error: default_objc_class_prefix cannot be empty.";
+ return false;
+ }
+ SetDefaultObjcClassPrefix(value);
} else if (options[i].first == "use_package_as_prefix") {
// Controls how the symbols should be prefixed to avoid symbols
- // collisions. The objc_class_prefix file option is always honored, this
- // is just what to do if that isn't set. The available options are:
+ // collisions. The objc_class_prefix file option is always honored first
+ // followed by the default_objc_class_prefix generator option. This is is just
+ // what to do if either of these options are not set. The available options are:
// "no": Not prefixed (the existing mode).
// "yes": Make a prefix out of the proto package.
bool value = false;
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
index cf92607..7b85c51 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
@@ -99,6 +99,9 @@
public:
PrefixModeStorage();
+ const std::string default_objc_class_prefix() const { return default_objc_class_prefix_; }
+ void set_default_objc_class_prefix(const std::string& default_objc_class_prefix) { default_objc_class_prefix_ = default_objc_class_prefix; }
+
bool use_package_name() const { return use_package_name_; }
void set_use_package_name(bool on_or_off) { use_package_name_ = on_or_off; }
@@ -116,13 +119,14 @@
private:
bool use_package_name_;
+ std::string default_objc_class_prefix_;
std::string exception_path_;
std::string forced_prefix_;
std::unordered_set<std::string> exceptions_;
};
PrefixModeStorage::PrefixModeStorage() {
- // Even thought there are generation options, have an env back door since some
+ // Even though there are generation options, have an env back door since some
// of these helpers could be used in other plugins.
use_package_name_ = BoolFromEnvVar("GPB_OBJC_USE_PACKAGE_AS_PREFIX", false);
@@ -169,6 +173,10 @@
} // namespace
+void SetDefaultObjcClassPrefix(const std::string& default_objc_class_prefix) {
+ g_prefix_mode.set_default_objc_class_prefix(default_objc_class_prefix);
+}
+
bool UseProtoPackageAsDefaultPrefix() {
return g_prefix_mode.use_package_name();
}
@@ -526,11 +534,16 @@
}
std::string FileClassPrefix(const FileDescriptor* file) {
- // Always honor the file option.
+ // Always honor the file option first.
if (file->options().has_objc_class_prefix()) {
return file->options().objc_class_prefix();
}
+ // If a default prefix is passed through objc_opt then accept it.
+ if (!g_prefix_mode.default_objc_class_prefix().empty()) {
+ return g_prefix_mode.default_objc_class_prefix();
+ }
+
// If package prefix isn't enabled, done.
if (!g_prefix_mode.use_package_name()) {
return "";
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
index f4b71ce..418ffab 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
@@ -47,6 +47,9 @@
namespace compiler {
namespace objectivec {
+// Set the default objc class prefix that should be used. This method is used only
+// when default_objc_class_prefix is passed through objc_opt.
+void PROTOC_EXPORT SetDefaultObjcClassPrefix(const std::string& objc_class_prefix);
// Get/Set if the proto package should be used to make the default prefix for
// symbols. This will then impact most of the type naming apis below. It is done
// as a global to not break any other generator reusing the methods since they
@@ -68,6 +71,7 @@
std::string generate_for_named_framework;
std::string named_framework_to_proto_path_mappings_path;
std::string runtime_import_prefix;
+ std::string default_objc_class_prefix;
bool prefixes_must_be_registered;
bool require_prefixes;
};
diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc
index 8ddc312..9027891 100644
--- a/src/google/protobuf/compiler/parser_unittest.cc
+++ b/src/google/protobuf/compiler/parser_unittest.cc
@@ -2466,7 +2466,9 @@
// *output_field to the descriptor of the field, and *output_index to -1.
// Returns true if the path was valid, false otherwise. A gTest failure is
// recorded before returning false.
-bool FollowPath(const Message& root, const int* path_begin, const int* path_end,
+bool FollowPath(const Message& root,
+ RepeatedField<int>::const_iterator path_begin,
+ RepeatedField<int>::const_iterator path_end,
const Message** output_message,
const FieldDescriptor** output_field, int* output_index) {
if (path_begin == path_end) {
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index f6be664..e9fdbe8 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -252,10 +252,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
suffix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ suffix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_suffix()) {
- suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_suffix(),
+ suffix_.Set(from._internal_suffix(),
GetArenaForAllocation());
}
::memcpy(&major_, &from.major_,
@@ -267,7 +267,7 @@
inline void Version::SharedCtor() {
suffix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ suffix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&major_) - reinterpret_cast<char*>(this)),
@@ -286,7 +286,7 @@
inline void Version::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- suffix_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ suffix_.Destroy();
}
void Version::SetCachedSize(int size) const {
@@ -517,7 +517,6 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&suffix_, lhs_arena,
&other->suffix_, rhs_arena
);
@@ -572,10 +571,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
parameter_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ parameter_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_parameter()) {
- parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_parameter(),
+ parameter_.Set(from._internal_parameter(),
GetArenaForAllocation());
}
if (from._internal_has_compiler_version()) {
@@ -589,7 +588,7 @@
inline void CodeGeneratorRequest::SharedCtor() {
parameter_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ parameter_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
compiler_version_ = nullptr;
}
@@ -605,7 +604,7 @@
inline void CodeGeneratorRequest::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- parameter_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ parameter_.Destroy();
if (this != internal_default_instance()) delete compiler_version_;
}
@@ -864,7 +863,6 @@
file_to_generate_.InternalSwap(&other->file_to_generate_);
proto_file_.InternalSwap(&other->proto_file_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
¶meter_, lhs_arena,
&other->parameter_, rhs_arena
);
@@ -917,26 +915,26 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
insertion_point_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ insertion_point_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_insertion_point()) {
- insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_insertion_point(),
+ insertion_point_.Set(from._internal_insertion_point(),
GetArenaForAllocation());
}
content_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ content_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_content()) {
- content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_content(),
+ content_.Set(from._internal_content(),
GetArenaForAllocation());
}
if (from._internal_has_generated_code_info()) {
@@ -950,15 +948,15 @@
inline void CodeGeneratorResponse_File::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
insertion_point_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ insertion_point_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
content_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ content_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
generated_code_info_ = nullptr;
}
@@ -974,9 +972,9 @@
inline void CodeGeneratorResponse_File::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- insertion_point_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- content_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
+ insertion_point_.Destroy();
+ content_.Destroy();
if (this != internal_default_instance()) delete generated_code_info_;
}
@@ -1234,17 +1232,14 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&insertion_point_, lhs_arena,
&other->insertion_point_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&content_, lhs_arena,
&other->content_, rhs_arena
);
@@ -1284,10 +1279,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
error_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ error_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_error()) {
- error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_error(),
+ error_.Set(from._internal_error(),
GetArenaForAllocation());
}
supported_features_ = from.supported_features_;
@@ -1297,7 +1292,7 @@
inline void CodeGeneratorResponse::SharedCtor() {
error_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ error_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
supported_features_ = uint64_t{0u};
}
@@ -1313,7 +1308,7 @@
inline void CodeGeneratorResponse::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- error_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ error_.Destroy();
}
void CodeGeneratorResponse::SetCachedSize(int size) const {
@@ -1525,7 +1520,6 @@
swap(_has_bits_[0], other->_has_bits_[0]);
file_.InternalSwap(&other->file_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&error_, lhs_arena,
&other->error_, rhs_arena
);
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index 204e42a..4f7f75a 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -1093,7 +1093,7 @@
inline PROTOBUF_ALWAYS_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..., GetArenaForAllocation());
+ suffix_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix)
}
inline std::string* Version::mutable_suffix() {
@@ -1106,11 +1106,11 @@
}
inline void Version::_internal_set_suffix(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ suffix_.Set(value, GetArenaForAllocation());
}
inline std::string* Version::_internal_mutable_suffix() {
_has_bits_[0] |= 0x00000001u;
- return suffix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return suffix_.Mutable(GetArenaForAllocation());
}
inline std::string* Version::release_suffix() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix)
@@ -1118,10 +1118,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = suffix_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (suffix_.IsDefault()) {
- suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ suffix_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -1132,11 +1132,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- suffix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), suffix,
- GetArenaForAllocation());
+ suffix_.SetAllocated(suffix, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (suffix_.IsDefault()) {
- suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ suffix_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix)
@@ -1241,7 +1240,7 @@
inline PROTOBUF_ALWAYS_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..., GetArenaForAllocation());
+ parameter_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
inline std::string* CodeGeneratorRequest::mutable_parameter() {
@@ -1254,11 +1253,11 @@
}
inline void CodeGeneratorRequest::_internal_set_parameter(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ parameter_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() {
_has_bits_[0] |= 0x00000001u;
- return parameter_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return parameter_.Mutable(GetArenaForAllocation());
}
inline std::string* CodeGeneratorRequest::release_parameter() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter)
@@ -1266,10 +1265,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = parameter_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (parameter_.IsDefault()) {
- parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ parameter_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -1280,11 +1279,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- parameter_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), parameter,
- GetArenaForAllocation());
+ parameter_.SetAllocated(parameter, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (parameter_.IsDefault()) {
- parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ parameter_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter)
@@ -1404,7 +1402,7 @@
}
if (compiler_version) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::compiler::Version>::GetOwningArena(compiler_version);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(compiler_version);
if (message_arena != submessage_arena) {
compiler_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, compiler_version, submessage_arena);
@@ -1441,7 +1439,7 @@
inline PROTOBUF_ALWAYS_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..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
inline std::string* CodeGeneratorResponse_File::mutable_name() {
@@ -1454,11 +1452,11 @@
}
inline void CodeGeneratorResponse_File::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name)
@@ -1466,10 +1464,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -1480,11 +1478,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name)
@@ -1510,7 +1507,7 @@
inline PROTOBUF_ALWAYS_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..., GetArenaForAllocation());
+ insertion_point_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
inline std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
@@ -1523,11 +1520,11 @@
}
inline void CodeGeneratorResponse_File::_internal_set_insertion_point(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ insertion_point_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_point() {
_has_bits_[0] |= 0x00000002u;
- return insertion_point_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return insertion_point_.Mutable(GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_insertion_point() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
@@ -1535,10 +1532,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- auto* p = insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = insertion_point_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (insertion_point_.IsDefault()) {
- insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ insertion_point_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -1549,11 +1546,10 @@
} else {
_has_bits_[0] &= ~0x00000002u;
}
- insertion_point_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), insertion_point,
- GetArenaForAllocation());
+ insertion_point_.SetAllocated(insertion_point, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (insertion_point_.IsDefault()) {
- insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ insertion_point_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
@@ -1579,7 +1575,7 @@
inline PROTOBUF_ALWAYS_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..., GetArenaForAllocation());
+ content_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
inline std::string* CodeGeneratorResponse_File::mutable_content() {
@@ -1592,11 +1588,11 @@
}
inline void CodeGeneratorResponse_File::_internal_set_content(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ content_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() {
_has_bits_[0] |= 0x00000004u;
- return content_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return content_.Mutable(GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_content() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content)
@@ -1604,10 +1600,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- auto* p = content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = content_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (content_.IsDefault()) {
- content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ content_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -1618,11 +1614,10 @@
} else {
_has_bits_[0] &= ~0x00000004u;
}
- content_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), content,
- GetArenaForAllocation());
+ content_.SetAllocated(content, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (content_.IsDefault()) {
- content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ content_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content)
@@ -1701,8 +1696,7 @@
}
if (generated_code_info) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
- ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info));
if (message_arena != submessage_arena) {
generated_code_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
@@ -1740,7 +1734,7 @@
inline PROTOBUF_ALWAYS_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..., GetArenaForAllocation());
+ error_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error)
}
inline std::string* CodeGeneratorResponse::mutable_error() {
@@ -1753,11 +1747,11 @@
}
inline void CodeGeneratorResponse::_internal_set_error(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ error_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse::_internal_mutable_error() {
_has_bits_[0] |= 0x00000001u;
- return error_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return error_.Mutable(GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse::release_error() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error)
@@ -1765,10 +1759,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = error_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (error_.IsDefault()) {
- error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ error_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -1779,11 +1773,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- error_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), error,
- GetArenaForAllocation());
+ error_.SetAllocated(error, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (error_.IsDefault()) {
- error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ error_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error)
diff --git a/src/google/protobuf/compiler/subprocess.cc b/src/google/protobuf/compiler/subprocess.cc
index f79d127..46d98a1 100644
--- a/src/google/protobuf/compiler/subprocess.cc
+++ b/src/google/protobuf/compiler/subprocess.cc
@@ -73,15 +73,15 @@
Subprocess::Subprocess()
: process_start_error_(ERROR_SUCCESS),
- child_handle_(NULL),
- child_stdin_(NULL),
- child_stdout_(NULL) {}
+ child_handle_(nullptr),
+ child_stdin_(nullptr),
+ child_stdout_(nullptr) {}
Subprocess::~Subprocess() {
- if (child_stdin_ != NULL) {
+ if (child_stdin_ != nullptr) {
CloseHandleOrDie(child_stdin_);
}
- if (child_stdout_ != NULL) {
+ if (child_stdout_ != nullptr) {
CloseHandleOrDie(child_stdout_);
}
}
@@ -93,10 +93,10 @@
HANDLE stdout_pipe_read;
HANDLE stdout_pipe_write;
- if (!CreatePipe(&stdin_pipe_read, &stdin_pipe_write, NULL, 0)) {
+ if (!CreatePipe(&stdin_pipe_read, &stdin_pipe_write, nullptr, 0)) {
GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError());
}
- if (!CreatePipe(&stdout_pipe_read, &stdout_pipe_write, NULL, 0)) {
+ if (!CreatePipe(&stdout_pipe_read, &stdout_pipe_write, nullptr, 0)) {
GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError());
}
@@ -134,14 +134,14 @@
// Create the process.
PROCESS_INFORMATION process_info;
- if (CreateProcessA((search_mode == SEARCH_PATH) ? NULL : program.c_str(),
- (search_mode == SEARCH_PATH) ? command_line : NULL,
- NULL, // process security attributes
- NULL, // thread security attributes
- TRUE, // inherit handles?
- 0, // obscure creation flags
- NULL, // environment (inherit from parent)
- NULL, // current directory (inherit from parent)
+ if (CreateProcessA((search_mode == SEARCH_PATH) ? nullptr : program.c_str(),
+ (search_mode == SEARCH_PATH) ? command_line : nullptr,
+ nullptr, // process security attributes
+ nullptr, // thread security attributes
+ TRUE, // inherit handles?
+ 0, // obscure creation flags
+ nullptr, // environment (inherit from parent)
+ nullptr, // current directory (inherit from parent)
&startup_info, &process_info)) {
child_handle_ = process_info.hProcess;
CloseHandleOrDie(process_info.hThread);
@@ -165,28 +165,28 @@
return false;
}
- GOOGLE_CHECK(child_handle_ != NULL) << "Must call Start() first.";
+ GOOGLE_CHECK(child_handle_ != nullptr) << "Must call Start() first.";
std::string input_data = input.SerializeAsString();
std::string output_data;
int input_pos = 0;
- while (child_stdout_ != NULL) {
+ while (child_stdout_ != nullptr) {
HANDLE handles[2];
int handle_count = 0;
- if (child_stdin_ != NULL) {
+ if (child_stdin_ != nullptr) {
handles[handle_count++] = child_stdin_;
}
- if (child_stdout_ != NULL) {
+ if (child_stdout_ != nullptr) {
handles[handle_count++] = child_stdout_;
}
DWORD wait_result =
WaitForMultipleObjects(handle_count, handles, FALSE, INFINITE);
- HANDLE signaled_handle = NULL;
+ HANDLE signaled_handle = nullptr;
if (wait_result >= WAIT_OBJECT_0 &&
wait_result < WAIT_OBJECT_0 + handle_count) {
signaled_handle = handles[wait_result - WAIT_OBJECT_0];
@@ -201,7 +201,7 @@
if (signaled_handle == child_stdin_) {
DWORD n;
if (!WriteFile(child_stdin_, input_data.data() + input_pos,
- input_data.size() - input_pos, &n, NULL)) {
+ input_data.size() - input_pos, &n, nullptr)) {
// Child closed pipe. Presumably it will report an error later.
// Pretend we're done for now.
input_pos = input_data.size();
@@ -212,27 +212,27 @@
if (input_pos == input_data.size()) {
// We're done writing. Close.
CloseHandleOrDie(child_stdin_);
- child_stdin_ = NULL;
+ child_stdin_ = nullptr;
}
} else if (signaled_handle == child_stdout_) {
char buffer[4096];
DWORD n;
- if (!ReadFile(child_stdout_, buffer, sizeof(buffer), &n, NULL)) {
+ if (!ReadFile(child_stdout_, buffer, sizeof(buffer), &n, nullptr)) {
// We're done reading. Close.
CloseHandleOrDie(child_stdout_);
- child_stdout_ = NULL;
+ child_stdout_ = nullptr;
} else {
output_data.append(buffer, n);
}
}
}
- if (child_stdin_ != NULL) {
+ if (child_stdin_ != nullptr) {
// Child did not finish reading input before it closed the output.
// Presumably it exited with an error.
CloseHandleOrDie(child_stdin_);
- child_stdin_ = NULL;
+ child_stdin_ = nullptr;
}
DWORD wait_result = WaitForSingleObject(child_handle_, INFINITE);
@@ -252,7 +252,7 @@
}
CloseHandleOrDie(child_handle_);
- child_handle_ = NULL;
+ child_handle_ = nullptr;
if (exit_code != 0) {
*error = strings::Substitute("Plugin failed with status code $0.", exit_code);
@@ -273,9 +273,10 @@
// WTF?
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
+ nullptr, error_code,
+ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(LPSTR)&message, // NOT A BUG!
- 0, NULL);
+ 0, nullptr);
std::string result = message;
LocalFree(message);
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index a2552f6..8504f88 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -49,7 +49,6 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/any.h>
@@ -58,6 +57,7 @@
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/stubs/casts.h>
+#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/descriptor_database.h>
#include <google/protobuf/dynamic_message.h>
@@ -256,7 +256,8 @@
template <typename U>
bool Init() {
- if (std::is_trivially_constructible<U>::value) return true;
+ // Skip for the `char` block. No need to zero initialize it.
+ if (std::is_same<U, char>::value) return true;
for (int i = 0, size = Size<U>(); i < size; ++i) {
::new (data() + BeginOffset<U>() + sizeof(U) * i) U{};
}
@@ -1299,10 +1300,6 @@
bool AddFieldByNumber(FieldDescriptor* field);
bool AddEnumValueByNumber(EnumValueDescriptor* value);
- // Adds the field to the lowercase_name and camelcase_name maps. Never
- // fails because we allow duplicates; the first field by the name wins.
- void AddFieldByStylizedNames(const FieldDescriptor* field);
-
// Populates p->first->locations_by_path_ from p->second.
// Unusual signature dictated by internal::call_once.
static void BuildLocationsByPath(
@@ -1329,12 +1326,13 @@
void FieldsByCamelcaseNamesLazyInitInternal() const;
SymbolsByParentSet symbols_by_parent_;
- mutable FieldsByNameMap fields_by_lowercase_name_;
- std::unique_ptr<FieldsByNameMap> fields_by_lowercase_name_tmp_;
mutable internal::once_flag fields_by_lowercase_name_once_;
- mutable FieldsByNameMap fields_by_camelcase_name_;
- std::unique_ptr<FieldsByNameMap> fields_by_camelcase_name_tmp_;
mutable internal::once_flag fields_by_camelcase_name_once_;
+ // Make these fields atomic to avoid race conditions with
+ // GetEstimatedOwnedMemoryBytesSize. Once the pointer is set the map won't
+ // change anymore.
+ mutable std::atomic<const FieldsByNameMap*> fields_by_lowercase_name_{};
+ mutable std::atomic<const FieldsByNameMap*> fields_by_camelcase_name_{};
FieldsByNumberSet fields_by_number_; // Not including extensions.
EnumValuesByNumberSet enum_values_by_number_;
mutable EnumValuesByNumberSet unknown_enum_values_by_number_
@@ -1372,11 +1370,12 @@
DescriptorPool::Tables::~Tables() { GOOGLE_DCHECK(checkpoints_.empty()); }
-FileDescriptorTables::FileDescriptorTables()
- : fields_by_lowercase_name_tmp_(new FieldsByNameMap()),
- fields_by_camelcase_name_tmp_(new FieldsByNameMap()) {}
+FileDescriptorTables::FileDescriptorTables() {}
-FileDescriptorTables::~FileDescriptorTables() {}
+FileDescriptorTables::~FileDescriptorTables() {
+ delete fields_by_lowercase_name_.load(std::memory_order_acquire);
+ delete fields_by_camelcase_name_.load(std::memory_order_acquire);
+}
inline const FileDescriptorTables& FileDescriptorTables::GetEmptyInstance() {
static auto file_descriptor_tables =
@@ -1519,13 +1518,14 @@
}
void FileDescriptorTables::FieldsByLowercaseNamesLazyInitInternal() const {
+ auto* map = new FieldsByNameMap;
for (Symbol symbol : symbols_by_parent_) {
const FieldDescriptor* field = symbol.field_descriptor();
if (!field) continue;
- PointerStringPair lowercase_key(FindParentForFieldsByMap(field),
- field->lowercase_name().c_str());
- InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, field);
+ (*map)[{FindParentForFieldsByMap(field), field->lowercase_name().c_str()}] =
+ field;
}
+ fields_by_lowercase_name_.store(map, std::memory_order_release);
}
inline const FieldDescriptor* FileDescriptorTables::FindFieldByLowercaseName(
@@ -1533,8 +1533,9 @@
internal::call_once(
fields_by_lowercase_name_once_,
&FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic, this);
- return FindPtrOrNull(fields_by_lowercase_name_,
- PointerStringPair(parent, lowercase_name));
+ return FindPtrOrNull(
+ *fields_by_lowercase_name_.load(std::memory_order_acquire),
+ PointerStringPair(parent, lowercase_name));
}
void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic(
@@ -1543,13 +1544,14 @@
}
void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitInternal() const {
+ auto* map = new FieldsByNameMap;
for (Symbol symbol : symbols_by_parent_) {
const FieldDescriptor* field = symbol.field_descriptor();
if (!field) continue;
- PointerStringPair camelcase_key(FindParentForFieldsByMap(field),
- field->camelcase_name().c_str());
- InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, field);
+ (*map)[{FindParentForFieldsByMap(field), field->camelcase_name().c_str()}] =
+ field;
}
+ fields_by_camelcase_name_.store(map, std::memory_order_release);
}
inline const FieldDescriptor* FileDescriptorTables::FindFieldByCamelcaseName(
@@ -1557,8 +1559,9 @@
internal::call_once(
fields_by_camelcase_name_once_,
FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic, this);
- return FindPtrOrNull(fields_by_camelcase_name_,
- PointerStringPair(parent, camelcase_name));
+ return FindPtrOrNull(
+ *fields_by_camelcase_name_.load(std::memory_order_acquire),
+ PointerStringPair(parent, camelcase_name));
}
inline const EnumValueDescriptor* FileDescriptorTables::FindEnumValueByNumber(
@@ -1618,8 +1621,8 @@
// EnumDescriptor (it's not a part of the enum as originally defined), but
// we do insert it into the table so that we can return the same pointer
// later.
- std::string enum_value_name = StringPrintf("UNKNOWN_ENUM_VALUE_%s_%d",
- parent->name().c_str(), number);
+ std::string enum_value_name = StringPrintf(
+ "UNKNOWN_ENUM_VALUE_%s_%d", parent->name().c_str(), number);
auto* pool = DescriptorPool::generated_pool();
auto* tables = const_cast<DescriptorPool::Tables*>(pool->tables_.get());
internal::FlatAllocator alloc;
@@ -1688,39 +1691,7 @@
}
}
-void FileDescriptorTables::FinalizeTables() {
- // Clean up the temporary maps used by AddFieldByStylizedNames().
- fields_by_lowercase_name_tmp_ = nullptr;
- fields_by_camelcase_name_tmp_ = nullptr;
-}
-
-void FileDescriptorTables::AddFieldByStylizedNames(
- const FieldDescriptor* field) {
- const void* parent = FindParentForFieldsByMap(field);
-
- // We want fields_by_{lower,camel}case_name_ to be lazily built, but
- // cross-link order determines which entry will be present in the case of a
- // conflict. So we use the temporary maps that get destroyed after
- // BuildFileImpl() to detect the conflicts, and only store the conflicts in
- // the map that will persist. We will then lazily populate the rest of the
- // entries from fields_by_number_.
-
- PointerStringPair lowercase_key(parent, field->lowercase_name().c_str());
- if (!InsertIfNotPresent(fields_by_lowercase_name_tmp_.get(),
- lowercase_key, field)) {
- InsertIfNotPresent(
- &fields_by_lowercase_name_, lowercase_key,
- FindPtrOrNull(*fields_by_lowercase_name_tmp_, lowercase_key));
- }
-
- PointerStringPair camelcase_key(parent, field->camelcase_name().c_str());
- if (!InsertIfNotPresent(fields_by_camelcase_name_tmp_.get(),
- camelcase_key, field)) {
- InsertIfNotPresent(
- &fields_by_camelcase_name_, camelcase_key,
- FindPtrOrNull(*fields_by_camelcase_name_tmp_, camelcase_key));
- }
-}
+void FileDescriptorTables::FinalizeTables() {}
bool FileDescriptorTables::AddFieldByNumber(FieldDescriptor* field) {
// Skip fields that are at the start of the sequence.
@@ -6270,9 +6241,6 @@
field->options_ = &FieldOptions::default_instance();
}
- // Add the field to the lowercase-name and camelcase-name tables.
- file_tables_->AddFieldByStylizedNames(field);
-
if (proto.has_extendee()) {
Symbol extendee =
LookupSymbol(proto.extendee(), field->full_name(),
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index f20705c..b17b584 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -1506,26 +1506,26 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
package_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_package()) {
- package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_package(),
+ package_.Set(from._internal_package(),
GetArenaForAllocation());
}
syntax_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ syntax_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_syntax()) {
- syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_syntax(),
+ syntax_.Set(from._internal_syntax(),
GetArenaForAllocation());
}
if (from._internal_has_options()) {
@@ -1544,15 +1544,15 @@
inline void FileDescriptorProto::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
package_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
syntax_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ syntax_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
@@ -1571,9 +1571,9 @@
inline void FileDescriptorProto::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- package_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- syntax_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
+ package_.Destroy();
+ syntax_.Destroy();
if (this != internal_default_instance()) delete options_;
if (this != internal_default_instance()) delete source_code_info_;
}
@@ -2102,17 +2102,14 @@
public_dependency_.InternalSwap(&other->public_dependency_);
weak_dependency_.InternalSwap(&other->weak_dependency_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&package_, lhs_arena,
&other->package_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&syntax_, lhs_arena,
&other->syntax_, rhs_arena
);
@@ -2682,10 +2679,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
if (from._internal_has_options()) {
@@ -2699,7 +2696,7 @@
inline void DescriptorProto::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
options_ = nullptr;
}
@@ -2715,7 +2712,7 @@
inline void DescriptorProto::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
if (this != internal_default_instance()) delete options_;
}
@@ -3173,7 +3170,6 @@
reserved_range_.InternalSwap(&other->reserved_range_);
reserved_name_.InternalSwap(&other->reserved_name_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
@@ -3443,42 +3439,42 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
extendee_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ extendee_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_extendee()) {
- extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_extendee(),
+ extendee_.Set(from._internal_extendee(),
GetArenaForAllocation());
}
type_name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_type_name()) {
- type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_name(),
+ type_name_.Set(from._internal_type_name(),
GetArenaForAllocation());
}
default_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ default_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_default_value()) {
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(),
+ default_value_.Set(from._internal_default_value(),
GetArenaForAllocation());
}
json_name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ json_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_json_name()) {
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(),
+ json_name_.Set(from._internal_json_name(),
GetArenaForAllocation());
}
if (from._internal_has_options()) {
@@ -3495,23 +3491,23 @@
inline void FieldDescriptorProto::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
extendee_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ extendee_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
default_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ default_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
json_name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ json_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
@@ -3532,11 +3528,11 @@
inline void FieldDescriptorProto::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- extendee_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- type_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- default_value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- json_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
+ extendee_.Destroy();
+ type_name_.Destroy();
+ default_value_.Destroy();
+ json_name_.Destroy();
if (this != internal_default_instance()) delete options_;
}
@@ -4010,27 +4006,22 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&extendee_, lhs_arena,
&other->extendee_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&type_name_, lhs_arena,
&other->type_name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&default_value_, lhs_arena,
&other->default_value_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&json_name_, lhs_arena,
&other->json_name_, rhs_arena
);
@@ -4080,10 +4071,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
if (from._internal_has_options()) {
@@ -4097,7 +4088,7 @@
inline void OneofDescriptorProto::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
options_ = nullptr;
}
@@ -4113,7 +4104,7 @@
inline void OneofDescriptorProto::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
if (this != internal_default_instance()) delete options_;
}
@@ -4304,7 +4295,6 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
@@ -4583,10 +4573,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
if (from._internal_has_options()) {
@@ -4600,7 +4590,7 @@
inline void EnumDescriptorProto::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
options_ = nullptr;
}
@@ -4616,7 +4606,7 @@
inline void EnumDescriptorProto::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
if (this != internal_default_instance()) delete options_;
}
@@ -4909,7 +4899,6 @@
reserved_range_.InternalSwap(&other->reserved_range_);
reserved_name_.InternalSwap(&other->reserved_name_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
@@ -4955,10 +4944,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
if (from._internal_has_options()) {
@@ -4973,7 +4962,7 @@
inline void EnumValueDescriptorProto::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
@@ -4992,7 +4981,7 @@
inline void EnumValueDescriptorProto::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
if (this != internal_default_instance()) delete options_;
}
@@ -5208,7 +5197,6 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
@@ -5258,10 +5246,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
if (from._internal_has_options()) {
@@ -5275,7 +5263,7 @@
inline void ServiceDescriptorProto::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
options_ = nullptr;
}
@@ -5291,7 +5279,7 @@
inline void ServiceDescriptorProto::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
if (this != internal_default_instance()) delete options_;
}
@@ -5515,7 +5503,6 @@
swap(_has_bits_[0], other->_has_bits_[0]);
method_.InternalSwap(&other->method_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
@@ -5570,26 +5557,26 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
input_type_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ input_type_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_input_type()) {
- input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_input_type(),
+ input_type_.Set(from._internal_input_type(),
GetArenaForAllocation());
}
output_type_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ output_type_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_output_type()) {
- output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_output_type(),
+ output_type_.Set(from._internal_output_type(),
GetArenaForAllocation());
}
if (from._internal_has_options()) {
@@ -5606,15 +5593,15 @@
inline void MethodDescriptorProto::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
input_type_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ input_type_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
output_type_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ output_type_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
@@ -5633,9 +5620,9 @@
inline void MethodDescriptorProto::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- input_type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- output_type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
+ input_type_.Destroy();
+ output_type_.Destroy();
if (this != internal_default_instance()) delete options_;
}
@@ -5946,17 +5933,14 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&input_type_, lhs_arena,
&other->input_type_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&output_type_, lhs_arena,
&other->output_type_, rhs_arena
);
@@ -6057,82 +6041,82 @@
_extensions_.MergeFrom(internal_default_instance(), from._extensions_);
java_package_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ java_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_java_package()) {
- java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_package(),
+ java_package_.Set(from._internal_java_package(),
GetArenaForAllocation());
}
java_outer_classname_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ java_outer_classname_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_java_outer_classname()) {
- java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_outer_classname(),
+ java_outer_classname_.Set(from._internal_java_outer_classname(),
GetArenaForAllocation());
}
go_package_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ go_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_go_package()) {
- go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_go_package(),
+ go_package_.Set(from._internal_go_package(),
GetArenaForAllocation());
}
objc_class_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ objc_class_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_objc_class_prefix()) {
- objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_objc_class_prefix(),
+ objc_class_prefix_.Set(from._internal_objc_class_prefix(),
GetArenaForAllocation());
}
csharp_namespace_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ csharp_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_csharp_namespace()) {
- csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_csharp_namespace(),
+ csharp_namespace_.Set(from._internal_csharp_namespace(),
GetArenaForAllocation());
}
swift_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ swift_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_swift_prefix()) {
- swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_swift_prefix(),
+ swift_prefix_.Set(from._internal_swift_prefix(),
GetArenaForAllocation());
}
php_class_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_class_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_class_prefix()) {
- php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_class_prefix(),
+ php_class_prefix_.Set(from._internal_php_class_prefix(),
GetArenaForAllocation());
}
php_namespace_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_namespace()) {
- php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_namespace(),
+ php_namespace_.Set(from._internal_php_namespace(),
GetArenaForAllocation());
}
php_metadata_namespace_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_metadata_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_metadata_namespace()) {
- php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_metadata_namespace(),
+ php_metadata_namespace_.Set(from._internal_php_metadata_namespace(),
GetArenaForAllocation());
}
ruby_package_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ ruby_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_ruby_package()) {
- ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_ruby_package(),
+ ruby_package_.Set(from._internal_ruby_package(),
GetArenaForAllocation());
}
::memcpy(&java_multiple_files_, &from.java_multiple_files_,
@@ -6144,43 +6128,43 @@
inline void FileOptions::SharedCtor() {
java_package_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ java_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
java_outer_classname_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ java_outer_classname_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
go_package_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ go_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
objc_class_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ objc_class_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
csharp_namespace_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ csharp_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
swift_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ swift_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
php_class_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_class_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
php_namespace_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
php_metadata_namespace_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_metadata_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
ruby_package_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ ruby_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&java_multiple_files_) - reinterpret_cast<char*>(this)),
@@ -6201,16 +6185,16 @@
inline void FileOptions::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- java_package_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- java_outer_classname_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- go_package_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- objc_class_prefix_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- csharp_namespace_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- swift_prefix_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- php_class_prefix_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- php_namespace_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- php_metadata_namespace_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- ruby_package_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ java_package_.Destroy();
+ java_outer_classname_.Destroy();
+ go_package_.Destroy();
+ objc_class_prefix_.Destroy();
+ csharp_namespace_.Destroy();
+ swift_prefix_.Destroy();
+ php_class_prefix_.Destroy();
+ php_namespace_.Destroy();
+ php_metadata_namespace_.Destroy();
+ ruby_package_.Destroy();
}
void FileOptions::SetCachedSize(int size) const {
@@ -6994,52 +6978,42 @@
swap(_has_bits_[0], other->_has_bits_[0]);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&java_package_, lhs_arena,
&other->java_package_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&java_outer_classname_, lhs_arena,
&other->java_outer_classname_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&go_package_, lhs_arena,
&other->go_package_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&objc_class_prefix_, lhs_arena,
&other->objc_class_prefix_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&csharp_namespace_, lhs_arena,
&other->csharp_namespace_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&swift_prefix_, lhs_arena,
&other->swift_prefix_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&php_class_prefix_, lhs_arena,
&other->php_class_prefix_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&php_namespace_, lhs_arena,
&other->php_namespace_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&php_metadata_namespace_, lhs_arena,
&other->php_metadata_namespace_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&ruby_package_, lhs_arena,
&other->ruby_package_, rhs_arena
);
@@ -9097,10 +9071,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_part_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_part_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name_part()) {
- name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name_part(),
+ name_part_.Set(from._internal_name_part(),
GetArenaForAllocation());
}
is_extension_ = from.is_extension_;
@@ -9110,7 +9084,7 @@
inline void UninterpretedOption_NamePart::SharedCtor() {
name_part_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_part_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
is_extension_ = false;
}
@@ -9126,7 +9100,7 @@
inline void UninterpretedOption_NamePart::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_part_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_part_.Destroy();
}
void UninterpretedOption_NamePart::SetCachedSize(int size) const {
@@ -9323,7 +9297,6 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_part_, lhs_arena,
&other->name_part_, rhs_arena
);
@@ -9375,26 +9348,26 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
identifier_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ identifier_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_identifier_value()) {
- identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_identifier_value(),
+ identifier_value_.Set(from._internal_identifier_value(),
GetArenaForAllocation());
}
string_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ string_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_string_value()) {
- string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_string_value(),
+ string_value_.Set(from._internal_string_value(),
GetArenaForAllocation());
}
aggregate_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ aggregate_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_aggregate_value()) {
- aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_aggregate_value(),
+ aggregate_value_.Set(from._internal_aggregate_value(),
GetArenaForAllocation());
}
::memcpy(&positive_int_value_, &from.positive_int_value_,
@@ -9406,15 +9379,15 @@
inline void UninterpretedOption::SharedCtor() {
identifier_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ identifier_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
string_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ string_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
aggregate_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ aggregate_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&positive_int_value_) - reinterpret_cast<char*>(this)),
@@ -9433,9 +9406,9 @@
inline void UninterpretedOption::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- identifier_value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- string_value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- aggregate_value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ identifier_value_.Destroy();
+ string_value_.Destroy();
+ aggregate_value_.Destroy();
}
void UninterpretedOption::SetCachedSize(int size) const {
@@ -9764,17 +9737,14 @@
swap(_has_bits_[0], other->_has_bits_[0]);
name_.InternalSwap(&other->name_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&identifier_value_, lhs_arena,
&other->identifier_value_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&string_value_, lhs_arena,
&other->string_value_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&aggregate_value_, lhs_arena,
&other->aggregate_value_, rhs_arena
);
@@ -9823,18 +9793,18 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
leading_comments_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ leading_comments_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_leading_comments()) {
- leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_leading_comments(),
+ leading_comments_.Set(from._internal_leading_comments(),
GetArenaForAllocation());
}
trailing_comments_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ trailing_comments_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_trailing_comments()) {
- trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_trailing_comments(),
+ trailing_comments_.Set(from._internal_trailing_comments(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location)
@@ -9843,11 +9813,11 @@
inline void SourceCodeInfo_Location::SharedCtor() {
leading_comments_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ leading_comments_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
trailing_comments_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ trailing_comments_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
@@ -9862,8 +9832,8 @@
inline void SourceCodeInfo_Location::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- leading_comments_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- trailing_comments_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ leading_comments_.Destroy();
+ trailing_comments_.Destroy();
}
void SourceCodeInfo_Location::SetCachedSize(int size) const {
@@ -10168,12 +10138,10 @@
span_.InternalSwap(&other->span_);
leading_detached_comments_.InternalSwap(&other->leading_detached_comments_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&leading_comments_, lhs_arena,
&other->leading_comments_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&trailing_comments_, lhs_arena,
&other->trailing_comments_, rhs_arena
);
@@ -10393,10 +10361,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
source_file_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ source_file_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_source_file()) {
- source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_source_file(),
+ source_file_.Set(from._internal_source_file(),
GetArenaForAllocation());
}
::memcpy(&begin_, &from.begin_,
@@ -10408,7 +10376,7 @@
inline void GeneratedCodeInfo_Annotation::SharedCtor() {
source_file_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ source_file_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&begin_) - reinterpret_cast<char*>(this)),
@@ -10427,7 +10395,7 @@
inline void GeneratedCodeInfo_Annotation::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- source_file_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ source_file_.Destroy();
}
void GeneratedCodeInfo_Annotation::SetCachedSize(int size) const {
@@ -10672,7 +10640,6 @@
swap(_has_bits_[0], other->_has_bits_[0]);
path_.InternalSwap(&other->path_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&source_file_, lhs_arena,
&other->source_file_, rhs_arena
);
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index 3799752..f7db21c 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -8464,7 +8464,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name)
}
inline std::string* FileDescriptorProto::mutable_name() {
@@ -8477,11 +8477,11 @@
}
inline void FileDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name)
@@ -8489,10 +8489,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -8503,11 +8503,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name)
@@ -8533,7 +8532,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileDescriptorProto::set_package(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ package_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package)
}
inline std::string* FileDescriptorProto::mutable_package() {
@@ -8546,11 +8545,11 @@
}
inline void FileDescriptorProto::_internal_set_package(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ package_.Set(value, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::_internal_mutable_package() {
_has_bits_[0] |= 0x00000002u;
- return package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return package_.Mutable(GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::release_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package)
@@ -8558,10 +8557,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- auto* p = package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = package_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (package_.IsDefault()) {
- package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ package_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -8572,11 +8571,10 @@
} else {
_has_bits_[0] &= ~0x00000002u;
}
- package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), package,
- GetArenaForAllocation());
+ package_.SetAllocated(package, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (package_.IsDefault()) {
- package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ package_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package)
@@ -8988,7 +8986,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::FileOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -9078,7 +9076,7 @@
}
if (source_code_info) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::SourceCodeInfo>::GetOwningArena(source_code_info);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(source_code_info);
if (message_arena != submessage_arena) {
source_code_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, source_code_info, submessage_arena);
@@ -9111,7 +9109,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileDescriptorProto::set_syntax(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ syntax_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax)
}
inline std::string* FileDescriptorProto::mutable_syntax() {
@@ -9124,11 +9122,11 @@
}
inline void FileDescriptorProto::_internal_set_syntax(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ syntax_.Set(value, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::_internal_mutable_syntax() {
_has_bits_[0] |= 0x00000004u;
- return syntax_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return syntax_.Mutable(GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::release_syntax() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax)
@@ -9136,10 +9134,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- auto* p = syntax_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = syntax_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (syntax_.IsDefault()) {
- syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ syntax_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -9150,11 +9148,10 @@
} else {
_has_bits_[0] &= ~0x00000004u;
}
- syntax_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), syntax,
- GetArenaForAllocation());
+ syntax_.SetAllocated(syntax, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (syntax_.IsDefault()) {
- syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ syntax_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax)
@@ -9297,7 +9294,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -9394,7 +9391,7 @@
inline PROTOBUF_ALWAYS_INLINE
void DescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name)
}
inline std::string* DescriptorProto::mutable_name() {
@@ -9407,11 +9404,11 @@
}
inline void DescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* DescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* DescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name)
@@ -9419,10 +9416,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -9433,11 +9430,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name)
@@ -9760,7 +9756,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::MessageOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -9956,7 +9952,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FieldDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name)
}
inline std::string* FieldDescriptorProto::mutable_name() {
@@ -9969,11 +9965,11 @@
}
inline void FieldDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name)
@@ -9981,10 +9977,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -9995,11 +9991,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name)
@@ -10111,7 +10106,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FieldDescriptorProto::set_type_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ type_name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name)
}
inline std::string* FieldDescriptorProto::mutable_type_name() {
@@ -10124,11 +10119,11 @@
}
inline void FieldDescriptorProto::_internal_set_type_name(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ type_name_.Set(value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_type_name() {
_has_bits_[0] |= 0x00000004u;
- return type_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return type_name_.Mutable(GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_type_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name)
@@ -10136,10 +10131,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- auto* p = type_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = type_name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (type_name_.IsDefault()) {
- type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -10150,11 +10145,10 @@
} else {
_has_bits_[0] &= ~0x00000004u;
}
- type_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_name,
- GetArenaForAllocation());
+ type_name_.SetAllocated(type_name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (type_name_.IsDefault()) {
- type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
@@ -10180,7 +10174,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FieldDescriptorProto::set_extendee(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ extendee_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee)
}
inline std::string* FieldDescriptorProto::mutable_extendee() {
@@ -10193,11 +10187,11 @@
}
inline void FieldDescriptorProto::_internal_set_extendee(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ extendee_.Set(value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_extendee() {
_has_bits_[0] |= 0x00000002u;
- return extendee_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return extendee_.Mutable(GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_extendee() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee)
@@ -10205,10 +10199,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- auto* p = extendee_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = extendee_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (extendee_.IsDefault()) {
- extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ extendee_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -10219,11 +10213,10 @@
} else {
_has_bits_[0] &= ~0x00000002u;
}
- extendee_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), extendee,
- GetArenaForAllocation());
+ extendee_.SetAllocated(extendee, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (extendee_.IsDefault()) {
- extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ extendee_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
@@ -10249,7 +10242,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FieldDescriptorProto::set_default_value(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000008u;
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ default_value_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value)
}
inline std::string* FieldDescriptorProto::mutable_default_value() {
@@ -10262,11 +10255,11 @@
}
inline void FieldDescriptorProto::_internal_set_default_value(const std::string& value) {
_has_bits_[0] |= 0x00000008u;
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ default_value_.Set(value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_default_value() {
_has_bits_[0] |= 0x00000008u;
- return default_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return default_value_.Mutable(GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_default_value() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value)
@@ -10274,10 +10267,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000008u;
- auto* p = default_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = default_value_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (default_value_.IsDefault()) {
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ default_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -10288,11 +10281,10 @@
} else {
_has_bits_[0] &= ~0x00000008u;
}
- default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value,
- GetArenaForAllocation());
+ default_value_.SetAllocated(default_value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (default_value_.IsDefault()) {
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ default_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
@@ -10346,7 +10338,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FieldDescriptorProto::set_json_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000010u;
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ json_name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
}
inline std::string* FieldDescriptorProto::mutable_json_name() {
@@ -10359,11 +10351,11 @@
}
inline void FieldDescriptorProto::_internal_set_json_name(const std::string& value) {
_has_bits_[0] |= 0x00000010u;
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ json_name_.Set(value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_json_name() {
_has_bits_[0] |= 0x00000010u;
- return json_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return json_name_.Mutable(GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_json_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name)
@@ -10371,10 +10363,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000010u;
- auto* p = json_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = json_name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (json_name_.IsDefault()) {
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ json_name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -10385,11 +10377,10 @@
} else {
_has_bits_[0] &= ~0x00000010u;
}
- json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name,
- GetArenaForAllocation());
+ json_name_.SetAllocated(json_name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (json_name_.IsDefault()) {
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ json_name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
@@ -10472,7 +10463,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::FieldOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -10537,7 +10528,7 @@
inline PROTOBUF_ALWAYS_INLINE
void OneofDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name)
}
inline std::string* OneofDescriptorProto::mutable_name() {
@@ -10550,11 +10541,11 @@
}
inline void OneofDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* OneofDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* OneofDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name)
@@ -10562,10 +10553,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -10576,11 +10567,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name)
@@ -10663,7 +10653,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::OneofOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -10760,7 +10750,7 @@
inline PROTOBUF_ALWAYS_INLINE
void EnumDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name)
}
inline std::string* EnumDescriptorProto::mutable_name() {
@@ -10773,11 +10763,11 @@
}
inline void EnumDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* EnumDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* EnumDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name)
@@ -10785,10 +10775,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -10799,11 +10789,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name)
@@ -10926,7 +10915,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::EnumOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -11078,7 +11067,7 @@
inline PROTOBUF_ALWAYS_INLINE
void EnumValueDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name)
}
inline std::string* EnumValueDescriptorProto::mutable_name() {
@@ -11091,11 +11080,11 @@
}
inline void EnumValueDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* EnumValueDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* EnumValueDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name)
@@ -11103,10 +11092,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -11117,11 +11106,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
@@ -11232,7 +11220,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::EnumValueOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -11269,7 +11257,7 @@
inline PROTOBUF_ALWAYS_INLINE
void ServiceDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name)
}
inline std::string* ServiceDescriptorProto::mutable_name() {
@@ -11282,11 +11270,11 @@
}
inline void ServiceDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* ServiceDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* ServiceDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name)
@@ -11294,10 +11282,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -11308,11 +11296,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name)
@@ -11435,7 +11422,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::ServiceOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -11472,7 +11459,7 @@
inline PROTOBUF_ALWAYS_INLINE
void MethodDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name)
}
inline std::string* MethodDescriptorProto::mutable_name() {
@@ -11485,11 +11472,11 @@
}
inline void MethodDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name)
@@ -11497,10 +11484,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -11511,11 +11498,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name)
@@ -11541,7 +11527,7 @@
inline PROTOBUF_ALWAYS_INLINE
void MethodDescriptorProto::set_input_type(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ input_type_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type)
}
inline std::string* MethodDescriptorProto::mutable_input_type() {
@@ -11554,11 +11540,11 @@
}
inline void MethodDescriptorProto::_internal_set_input_type(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ input_type_.Set(value, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::_internal_mutable_input_type() {
_has_bits_[0] |= 0x00000002u;
- return input_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return input_type_.Mutable(GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::release_input_type() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type)
@@ -11566,10 +11552,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- auto* p = input_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = input_type_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (input_type_.IsDefault()) {
- input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ input_type_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -11580,11 +11566,10 @@
} else {
_has_bits_[0] &= ~0x00000002u;
}
- input_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), input_type,
- GetArenaForAllocation());
+ input_type_.SetAllocated(input_type, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (input_type_.IsDefault()) {
- input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ input_type_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
@@ -11610,7 +11595,7 @@
inline PROTOBUF_ALWAYS_INLINE
void MethodDescriptorProto::set_output_type(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ output_type_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type)
}
inline std::string* MethodDescriptorProto::mutable_output_type() {
@@ -11623,11 +11608,11 @@
}
inline void MethodDescriptorProto::_internal_set_output_type(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ output_type_.Set(value, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::_internal_mutable_output_type() {
_has_bits_[0] |= 0x00000004u;
- return output_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return output_type_.Mutable(GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::release_output_type() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type)
@@ -11635,10 +11620,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- auto* p = output_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = output_type_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (output_type_.IsDefault()) {
- output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ output_type_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -11649,11 +11634,10 @@
} else {
_has_bits_[0] &= ~0x00000004u;
}
- output_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), output_type,
- GetArenaForAllocation());
+ output_type_.SetAllocated(output_type, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (output_type_.IsDefault()) {
- output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ output_type_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
@@ -11736,7 +11720,7 @@
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::MethodOptions>::GetOwningArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -11829,7 +11813,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_java_package(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ java_package_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package)
}
inline std::string* FileOptions::mutable_java_package() {
@@ -11842,11 +11826,11 @@
}
inline void FileOptions::_internal_set_java_package(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ java_package_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_java_package() {
_has_bits_[0] |= 0x00000001u;
- return java_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return java_package_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_java_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package)
@@ -11854,10 +11838,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = java_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = java_package_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (java_package_.IsDefault()) {
- java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ java_package_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -11868,11 +11852,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- java_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), java_package,
- GetArenaForAllocation());
+ java_package_.SetAllocated(java_package, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (java_package_.IsDefault()) {
- java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ java_package_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package)
@@ -11898,7 +11881,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_java_outer_classname(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ java_outer_classname_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname)
}
inline std::string* FileOptions::mutable_java_outer_classname() {
@@ -11911,11 +11894,11 @@
}
inline void FileOptions::_internal_set_java_outer_classname(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ java_outer_classname_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_java_outer_classname() {
_has_bits_[0] |= 0x00000002u;
- return java_outer_classname_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return java_outer_classname_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_java_outer_classname() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname)
@@ -11923,10 +11906,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- auto* p = java_outer_classname_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = java_outer_classname_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (java_outer_classname_.IsDefault()) {
- java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ java_outer_classname_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -11937,11 +11920,10 @@
} else {
_has_bits_[0] &= ~0x00000002u;
}
- java_outer_classname_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), java_outer_classname,
- GetArenaForAllocation());
+ java_outer_classname_.SetAllocated(java_outer_classname, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (java_outer_classname_.IsDefault()) {
- java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ java_outer_classname_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname)
@@ -12080,7 +12062,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_go_package(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ go_package_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package)
}
inline std::string* FileOptions::mutable_go_package() {
@@ -12093,11 +12075,11 @@
}
inline void FileOptions::_internal_set_go_package(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ go_package_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_go_package() {
_has_bits_[0] |= 0x00000004u;
- return go_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return go_package_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_go_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package)
@@ -12105,10 +12087,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- auto* p = go_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = go_package_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (go_package_.IsDefault()) {
- go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ go_package_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -12119,11 +12101,10 @@
} else {
_has_bits_[0] &= ~0x00000004u;
}
- go_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), go_package,
- GetArenaForAllocation());
+ go_package_.SetAllocated(go_package, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (go_package_.IsDefault()) {
- go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ go_package_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package)
@@ -12317,7 +12298,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_objc_class_prefix(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000008u;
- objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ objc_class_prefix_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix)
}
inline std::string* FileOptions::mutable_objc_class_prefix() {
@@ -12330,11 +12311,11 @@
}
inline void FileOptions::_internal_set_objc_class_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000008u;
- objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ objc_class_prefix_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_objc_class_prefix() {
_has_bits_[0] |= 0x00000008u;
- return objc_class_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return objc_class_prefix_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_objc_class_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix)
@@ -12342,10 +12323,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000008u;
- auto* p = objc_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = objc_class_prefix_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (objc_class_prefix_.IsDefault()) {
- objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ objc_class_prefix_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -12356,11 +12337,10 @@
} else {
_has_bits_[0] &= ~0x00000008u;
}
- objc_class_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), objc_class_prefix,
- GetArenaForAllocation());
+ objc_class_prefix_.SetAllocated(objc_class_prefix, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (objc_class_prefix_.IsDefault()) {
- objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ objc_class_prefix_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
@@ -12386,7 +12366,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_csharp_namespace(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000010u;
- csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ csharp_namespace_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace)
}
inline std::string* FileOptions::mutable_csharp_namespace() {
@@ -12399,11 +12379,11 @@
}
inline void FileOptions::_internal_set_csharp_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000010u;
- csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ csharp_namespace_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_csharp_namespace() {
_has_bits_[0] |= 0x00000010u;
- return csharp_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return csharp_namespace_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_csharp_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace)
@@ -12411,10 +12391,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000010u;
- auto* p = csharp_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = csharp_namespace_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (csharp_namespace_.IsDefault()) {
- csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ csharp_namespace_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -12425,11 +12405,10 @@
} else {
_has_bits_[0] &= ~0x00000010u;
}
- csharp_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), csharp_namespace,
- GetArenaForAllocation());
+ csharp_namespace_.SetAllocated(csharp_namespace, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (csharp_namespace_.IsDefault()) {
- csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ csharp_namespace_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace)
@@ -12455,7 +12434,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_swift_prefix(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000020u;
- swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ swift_prefix_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix)
}
inline std::string* FileOptions::mutable_swift_prefix() {
@@ -12468,11 +12447,11 @@
}
inline void FileOptions::_internal_set_swift_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000020u;
- swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ swift_prefix_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_swift_prefix() {
_has_bits_[0] |= 0x00000020u;
- return swift_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return swift_prefix_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_swift_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.swift_prefix)
@@ -12480,10 +12459,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000020u;
- auto* p = swift_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = swift_prefix_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (swift_prefix_.IsDefault()) {
- swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ swift_prefix_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -12494,11 +12473,10 @@
} else {
_has_bits_[0] &= ~0x00000020u;
}
- swift_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), swift_prefix,
- GetArenaForAllocation());
+ swift_prefix_.SetAllocated(swift_prefix, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (swift_prefix_.IsDefault()) {
- swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ swift_prefix_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix)
@@ -12524,7 +12502,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_php_class_prefix(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000040u;
- php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ php_class_prefix_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix)
}
inline std::string* FileOptions::mutable_php_class_prefix() {
@@ -12537,11 +12515,11 @@
}
inline void FileOptions::_internal_set_php_class_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000040u;
- php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ php_class_prefix_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_php_class_prefix() {
_has_bits_[0] |= 0x00000040u;
- return php_class_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return php_class_prefix_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_php_class_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_class_prefix)
@@ -12549,10 +12527,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000040u;
- auto* p = php_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = php_class_prefix_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (php_class_prefix_.IsDefault()) {
- php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_class_prefix_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -12563,11 +12541,10 @@
} else {
_has_bits_[0] &= ~0x00000040u;
}
- php_class_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_class_prefix,
- GetArenaForAllocation());
+ php_class_prefix_.SetAllocated(php_class_prefix, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (php_class_prefix_.IsDefault()) {
- php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_class_prefix_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
@@ -12593,7 +12570,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_php_namespace(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000080u;
- php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ php_namespace_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace)
}
inline std::string* FileOptions::mutable_php_namespace() {
@@ -12606,11 +12583,11 @@
}
inline void FileOptions::_internal_set_php_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000080u;
- php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ php_namespace_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_php_namespace() {
_has_bits_[0] |= 0x00000080u;
- return php_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return php_namespace_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_php_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace)
@@ -12618,10 +12595,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000080u;
- auto* p = php_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = php_namespace_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (php_namespace_.IsDefault()) {
- php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_namespace_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -12632,11 +12609,10 @@
} else {
_has_bits_[0] &= ~0x00000080u;
}
- php_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_namespace,
- GetArenaForAllocation());
+ php_namespace_.SetAllocated(php_namespace, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (php_namespace_.IsDefault()) {
- php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_namespace_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace)
@@ -12662,7 +12638,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_php_metadata_namespace(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000100u;
- php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ php_metadata_namespace_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_metadata_namespace)
}
inline std::string* FileOptions::mutable_php_metadata_namespace() {
@@ -12675,11 +12651,11 @@
}
inline void FileOptions::_internal_set_php_metadata_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000100u;
- php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ php_metadata_namespace_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_php_metadata_namespace() {
_has_bits_[0] |= 0x00000100u;
- return php_metadata_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return php_metadata_namespace_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_php_metadata_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_metadata_namespace)
@@ -12687,10 +12663,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000100u;
- auto* p = php_metadata_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = php_metadata_namespace_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (php_metadata_namespace_.IsDefault()) {
- php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_metadata_namespace_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -12701,11 +12677,10 @@
} else {
_has_bits_[0] &= ~0x00000100u;
}
- php_metadata_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_metadata_namespace,
- GetArenaForAllocation());
+ php_metadata_namespace_.SetAllocated(php_metadata_namespace, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (php_metadata_namespace_.IsDefault()) {
- php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ php_metadata_namespace_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_metadata_namespace)
@@ -12731,7 +12706,7 @@
inline PROTOBUF_ALWAYS_INLINE
void FileOptions::set_ruby_package(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000200u;
- ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ ruby_package_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.ruby_package)
}
inline std::string* FileOptions::mutable_ruby_package() {
@@ -12744,11 +12719,11 @@
}
inline void FileOptions::_internal_set_ruby_package(const std::string& value) {
_has_bits_[0] |= 0x00000200u;
- ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ ruby_package_.Set(value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_ruby_package() {
_has_bits_[0] |= 0x00000200u;
- return ruby_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return ruby_package_.Mutable(GetArenaForAllocation());
}
inline std::string* FileOptions::release_ruby_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.ruby_package)
@@ -12756,10 +12731,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000200u;
- auto* p = ruby_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = ruby_package_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (ruby_package_.IsDefault()) {
- ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ ruby_package_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -12770,11 +12745,10 @@
} else {
_has_bits_[0] &= ~0x00000200u;
}
- ruby_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ruby_package,
- GetArenaForAllocation());
+ ruby_package_.SetAllocated(ruby_package, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (ruby_package_.IsDefault()) {
- ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ ruby_package_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.ruby_package)
@@ -13631,7 +13605,7 @@
inline PROTOBUF_ALWAYS_INLINE
void UninterpretedOption_NamePart::set_name_part(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_part_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part)
}
inline std::string* UninterpretedOption_NamePart::mutable_name_part() {
@@ -13644,11 +13618,11 @@
}
inline void UninterpretedOption_NamePart::_internal_set_name_part(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_part_.Set(value, GetArenaForAllocation());
}
inline std::string* UninterpretedOption_NamePart::_internal_mutable_name_part() {
_has_bits_[0] |= 0x00000001u;
- return name_part_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_part_.Mutable(GetArenaForAllocation());
}
inline std::string* UninterpretedOption_NamePart::release_name_part() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part)
@@ -13656,10 +13630,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = name_part_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = name_part_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_part_.IsDefault()) {
- name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_part_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -13670,11 +13644,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- name_part_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name_part,
- GetArenaForAllocation());
+ name_part_.SetAllocated(name_part, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_part_.IsDefault()) {
- name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_part_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
@@ -13772,7 +13745,7 @@
inline PROTOBUF_ALWAYS_INLINE
void UninterpretedOption::set_identifier_value(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ identifier_value_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value)
}
inline std::string* UninterpretedOption::mutable_identifier_value() {
@@ -13785,11 +13758,11 @@
}
inline void UninterpretedOption::_internal_set_identifier_value(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ identifier_value_.Set(value, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::_internal_mutable_identifier_value() {
_has_bits_[0] |= 0x00000001u;
- return identifier_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return identifier_value_.Mutable(GetArenaForAllocation());
}
inline std::string* UninterpretedOption::release_identifier_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value)
@@ -13797,10 +13770,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = identifier_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = identifier_value_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (identifier_value_.IsDefault()) {
- identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ identifier_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -13811,11 +13784,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- identifier_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), identifier_value,
- GetArenaForAllocation());
+ identifier_value_.SetAllocated(identifier_value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (identifier_value_.IsDefault()) {
- identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ identifier_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
@@ -13925,7 +13897,7 @@
inline PROTOBUF_ALWAYS_INLINE
void UninterpretedOption::set_string_value(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- string_value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ string_value_.SetBytes(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value)
}
inline std::string* UninterpretedOption::mutable_string_value() {
@@ -13938,11 +13910,11 @@
}
inline void UninterpretedOption::_internal_set_string_value(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ string_value_.Set(value, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::_internal_mutable_string_value() {
_has_bits_[0] |= 0x00000002u;
- return string_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return string_value_.Mutable(GetArenaForAllocation());
}
inline std::string* UninterpretedOption::release_string_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value)
@@ -13950,10 +13922,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- auto* p = string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = string_value_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (string_value_.IsDefault()) {
- string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ string_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -13964,11 +13936,10 @@
} else {
_has_bits_[0] &= ~0x00000002u;
}
- string_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), string_value,
- GetArenaForAllocation());
+ string_value_.SetAllocated(string_value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (string_value_.IsDefault()) {
- string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ string_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value)
@@ -13994,7 +13965,7 @@
inline PROTOBUF_ALWAYS_INLINE
void UninterpretedOption::set_aggregate_value(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ aggregate_value_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value)
}
inline std::string* UninterpretedOption::mutable_aggregate_value() {
@@ -14007,11 +13978,11 @@
}
inline void UninterpretedOption::_internal_set_aggregate_value(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ aggregate_value_.Set(value, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::_internal_mutable_aggregate_value() {
_has_bits_[0] |= 0x00000004u;
- return aggregate_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return aggregate_value_.Mutable(GetArenaForAllocation());
}
inline std::string* UninterpretedOption::release_aggregate_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value)
@@ -14019,10 +13990,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- auto* p = aggregate_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = aggregate_value_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (aggregate_value_.IsDefault()) {
- aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ aggregate_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -14033,11 +14004,10 @@
} else {
_has_bits_[0] &= ~0x00000004u;
}
- aggregate_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), aggregate_value,
- GetArenaForAllocation());
+ aggregate_value_.SetAllocated(aggregate_value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (aggregate_value_.IsDefault()) {
- aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ aggregate_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
@@ -14161,7 +14131,7 @@
inline PROTOBUF_ALWAYS_INLINE
void SourceCodeInfo_Location::set_leading_comments(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ leading_comments_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
inline std::string* SourceCodeInfo_Location::mutable_leading_comments() {
@@ -14174,11 +14144,11 @@
}
inline void SourceCodeInfo_Location::_internal_set_leading_comments(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ leading_comments_.Set(value, GetArenaForAllocation());
}
inline std::string* SourceCodeInfo_Location::_internal_mutable_leading_comments() {
_has_bits_[0] |= 0x00000001u;
- return leading_comments_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return leading_comments_.Mutable(GetArenaForAllocation());
}
inline std::string* SourceCodeInfo_Location::release_leading_comments() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments)
@@ -14186,10 +14156,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = leading_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = leading_comments_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (leading_comments_.IsDefault()) {
- leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ leading_comments_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -14200,11 +14170,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- leading_comments_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), leading_comments,
- GetArenaForAllocation());
+ leading_comments_.SetAllocated(leading_comments, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (leading_comments_.IsDefault()) {
- leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ leading_comments_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
@@ -14230,7 +14199,7 @@
inline PROTOBUF_ALWAYS_INLINE
void SourceCodeInfo_Location::set_trailing_comments(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ trailing_comments_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
inline std::string* SourceCodeInfo_Location::mutable_trailing_comments() {
@@ -14243,11 +14212,11 @@
}
inline void SourceCodeInfo_Location::_internal_set_trailing_comments(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ trailing_comments_.Set(value, GetArenaForAllocation());
}
inline std::string* SourceCodeInfo_Location::_internal_mutable_trailing_comments() {
_has_bits_[0] |= 0x00000002u;
- return trailing_comments_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return trailing_comments_.Mutable(GetArenaForAllocation());
}
inline std::string* SourceCodeInfo_Location::release_trailing_comments() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments)
@@ -14255,10 +14224,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- auto* p = trailing_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = trailing_comments_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (trailing_comments_.IsDefault()) {
- trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ trailing_comments_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -14269,11 +14238,10 @@
} else {
_has_bits_[0] &= ~0x00000002u;
}
- trailing_comments_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), trailing_comments,
- GetArenaForAllocation());
+ trailing_comments_.SetAllocated(trailing_comments, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (trailing_comments_.IsDefault()) {
- trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ trailing_comments_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
@@ -14469,7 +14437,7 @@
inline PROTOBUF_ALWAYS_INLINE
void GeneratedCodeInfo_Annotation::set_source_file(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ source_file_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
inline std::string* GeneratedCodeInfo_Annotation::mutable_source_file() {
@@ -14482,11 +14450,11 @@
}
inline void GeneratedCodeInfo_Annotation::_internal_set_source_file(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ source_file_.Set(value, GetArenaForAllocation());
}
inline std::string* GeneratedCodeInfo_Annotation::_internal_mutable_source_file() {
_has_bits_[0] |= 0x00000001u;
- return source_file_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return source_file_.Mutable(GetArenaForAllocation());
}
inline std::string* GeneratedCodeInfo_Annotation::release_source_file() {
// @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
@@ -14494,10 +14462,10 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- auto* p = source_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ auto* p = source_file_.Release();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (source_file_.IsDefault()) {
- source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ source_file_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
return p;
@@ -14508,11 +14476,10 @@
} else {
_has_bits_[0] &= ~0x00000001u;
}
- source_file_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source_file,
- GetArenaForAllocation());
+ source_file_.SetAllocated(source_file, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (source_file_.IsDefault()) {
- source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ source_file_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc
index ec92f3f..479d8f1 100644
--- a/src/google/protobuf/descriptor_unittest.cc
+++ b/src/google/protobuf/descriptor_unittest.cc
@@ -66,6 +66,8 @@
// Must be included last.
#include <google/protobuf/port_def.inc>
+using ::testing::AnyOf;
+
namespace google {
namespace protobuf {
@@ -1307,7 +1309,8 @@
TEST_F(StylizedFieldNamesTest, FindByLowercaseName) {
EXPECT_EQ(message_->field(0), message_->FindFieldByLowercaseName("foo_foo"));
- EXPECT_EQ(message_->field(1), message_->FindFieldByLowercaseName("foobar"));
+ EXPECT_THAT(message_->FindFieldByLowercaseName("foobar"),
+ AnyOf(message_->field(1), message_->field(4)));
EXPECT_EQ(message_->field(2), message_->FindFieldByLowercaseName("foobaz"));
EXPECT_TRUE(message_->FindFieldByLowercaseName("FooBar") == nullptr);
EXPECT_TRUE(message_->FindFieldByLowercaseName("fooBaz") == nullptr);
@@ -1316,8 +1319,8 @@
EXPECT_EQ(message_->extension(0),
message_->FindExtensionByLowercaseName("bar_foo"));
- EXPECT_EQ(message_->extension(1),
- message_->FindExtensionByLowercaseName("barbar"));
+ EXPECT_THAT(message_->FindExtensionByLowercaseName("barbar"),
+ AnyOf(message_->extension(1), message_->extension(4)));
EXPECT_EQ(message_->extension(2),
message_->FindExtensionByLowercaseName("barbaz"));
EXPECT_TRUE(message_->FindExtensionByLowercaseName("BarBar") == nullptr);
@@ -1327,7 +1330,8 @@
EXPECT_EQ(file_->extension(0),
file_->FindExtensionByLowercaseName("baz_foo"));
- EXPECT_EQ(file_->extension(1), file_->FindExtensionByLowercaseName("bazbar"));
+ EXPECT_THAT(file_->FindExtensionByLowercaseName("bazbar"),
+ AnyOf(file_->extension(1), file_->extension(4)));
EXPECT_EQ(file_->extension(2), file_->FindExtensionByLowercaseName("bazbaz"));
EXPECT_TRUE(file_->FindExtensionByLowercaseName("BazBar") == nullptr);
EXPECT_TRUE(file_->FindExtensionByLowercaseName("bazBaz") == nullptr);
@@ -1335,7 +1339,8 @@
}
TEST_F(StylizedFieldNamesTest, FindByCamelcaseName) {
- EXPECT_EQ(message_->field(0), message_->FindFieldByCamelcaseName("fooFoo"));
+ EXPECT_THAT(message_->FindFieldByCamelcaseName("fooFoo"),
+ AnyOf(message_->field(0), message_->field(3)));
EXPECT_EQ(message_->field(1), message_->FindFieldByCamelcaseName("fooBar"));
EXPECT_EQ(message_->field(2), message_->FindFieldByCamelcaseName("fooBaz"));
EXPECT_TRUE(message_->FindFieldByCamelcaseName("foo_foo") == nullptr);
@@ -1343,8 +1348,8 @@
EXPECT_TRUE(message_->FindFieldByCamelcaseName("barFoo") == nullptr);
EXPECT_TRUE(message_->FindFieldByCamelcaseName("nosuchfield") == nullptr);
- EXPECT_EQ(message_->extension(0),
- message_->FindExtensionByCamelcaseName("barFoo"));
+ EXPECT_THAT(message_->FindExtensionByCamelcaseName("barFoo"),
+ AnyOf(message_->extension(0), message_->extension(3)));
EXPECT_EQ(message_->extension(1),
message_->FindExtensionByCamelcaseName("barBar"));
EXPECT_EQ(message_->extension(2),
@@ -1354,7 +1359,8 @@
EXPECT_TRUE(message_->FindExtensionByCamelcaseName("fooFoo") == nullptr);
EXPECT_TRUE(message_->FindExtensionByCamelcaseName("nosuchfield") == nullptr);
- EXPECT_EQ(file_->extension(0), file_->FindExtensionByCamelcaseName("bazFoo"));
+ EXPECT_THAT(file_->FindExtensionByCamelcaseName("bazFoo"),
+ AnyOf(file_->extension(0), file_->extension(3)));
EXPECT_EQ(file_->extension(1), file_->FindExtensionByCamelcaseName("bazBar"));
EXPECT_EQ(file_->extension(2), file_->FindExtensionByCamelcaseName("bazBaz"));
EXPECT_TRUE(file_->FindExtensionByCamelcaseName("baz_foo") == nullptr);
diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc
index d1044d7..1c96ca2 100644
--- a/src/google/protobuf/dynamic_message.cc
+++ b/src/google/protobuf/dynamic_message.cc
@@ -417,11 +417,7 @@
case FieldOptions::STRING:
if (!field->is_repeated()) {
ArenaStringPtr* asp = new (field_ptr) ArenaStringPtr();
- if (field->default_value_string().empty()) {
- asp->InitDefault();
- } else {
- asp->InitDefault(nullptr);
- }
+ asp->InitDefault();
} else {
new (field_ptr)
RepeatedPtrField<std::string>(GetArenaForAllocation());
@@ -522,13 +518,7 @@
switch (field->options().ctype()) {
default:
case FieldOptions::STRING: {
- // Oneof string fields are never set as a default instance.
- // We just need to pass some arbitrary default string to make it
- // work. This allows us to not have the real default accessible
- // from reflection.
- const std::string* default_value = nullptr;
- reinterpret_cast<ArenaStringPtr*>(field_ptr)->Destroy(
- default_value, nullptr);
+ reinterpret_cast<ArenaStringPtr*>(field_ptr)->Destroy();
break;
}
}
@@ -582,13 +572,7 @@
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
case FieldOptions::STRING: {
- const std::string* default_value =
- reinterpret_cast<const ArenaStringPtr*>(
- type_info_->prototype->OffsetToPointer(
- type_info_->offsets[i]))
- ->GetPointer();
- reinterpret_cast<ArenaStringPtr*>(field_ptr)->Destroy(default_value,
- nullptr);
+ reinterpret_cast<ArenaStringPtr*>(field_ptr)->Destroy();
break;
}
}
diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc
index 7b14d45..dad11bd 100644
--- a/src/google/protobuf/generated_message_reflection.cc
+++ b/src/google/protobuf/generated_message_reflection.cc
@@ -280,10 +280,9 @@
total_size += GetUnknownFields(message).SpaceUsedExcludingSelfLong();
// If this message owns an arena, add any unused space that's been allocated.
- auto* arena = Arena::InternalHelper<Message>::GetArenaForAllocation(&message);
- if (arena != nullptr &&
- Arena::InternalHelper<Message>::GetOwningArena(&message) == nullptr &&
- Arena::InternalHelper<Message>::IsMessageOwnedArena(arena)) {
+ auto* arena = Arena::InternalGetArenaForAllocation(&message);
+ if (arena != nullptr && Arena::InternalGetOwningArena(&message) == nullptr &&
+ arena->InternalIsMessageOwnedArena()) {
total_size += arena->SpaceAllocated() - arena->SpaceUsed();
}
@@ -354,31 +353,26 @@
case FieldDescriptor::CPPTYPE_STRING: {
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
- case FieldOptions::STRING: {
+ case FieldOptions::STRING:
if (IsInlined(field)) {
const std::string* ptr =
&GetField<InlinedStringField>(message, field).GetNoArena();
total_size += StringSpaceUsedExcludingSelfLong(*ptr);
- break;
- }
-
- const std::string* ptr =
- GetField<ArenaStringPtr>(message, field).GetPointer();
-
- // Initially, the string points to the default value stored
- // in the prototype. Only count the string if it has been
- // changed from the default value.
- // Except oneof fields, those never point to a default instance,
- // and there is no default instance to point to.
- if (schema_.InRealOneof(field) ||
- ptr != DefaultRaw<ArenaStringPtr>(field).GetPointer()) {
- // string fields are represented by just a pointer, so also
- // include sizeof(string) as well.
- total_size +=
- sizeof(*ptr) + StringSpaceUsedExcludingSelfLong(*ptr);
+ } else {
+ // Initially, the string points to the default value stored
+ // in the prototype. Only count the string if it has been
+ // changed from the default value.
+ // Except oneof fields, those never point to a default instance,
+ // and there is no default instance to point to.
+ const auto& str = GetField<ArenaStringPtr>(message, field);
+ if (!str.IsDefault() || schema_.InRealOneof(field)) {
+ // string fields are represented by just a pointer, so also
+ // include sizeof(string) as well.
+ total_size += sizeof(std::string) +
+ StringSpaceUsedExcludingSelfLong(str.Get());
+ }
}
break;
- }
}
break;
}
@@ -486,8 +480,7 @@
static void SwapStringField(const Reflection* r, Message* lhs, Message* rhs,
const FieldDescriptor* field);
- static void SwapArenaStringPtr(const std::string* default_ptr,
- ArenaStringPtr* lhs, Arena* lhs_arena,
+ static void SwapArenaStringPtr(ArenaStringPtr* lhs, Arena* lhs_arena,
ArenaStringPtr* rhs, Arena* rhs_arena);
template <bool unsafe_shallow_swap>
@@ -551,12 +544,11 @@
rhs_arena, rhs_arena_dtor_registered, rhs);
} else {
const std::string temp = lhs_string->Get();
- lhs_string->Set(nullptr, rhs_string->Get(), lhs_arena,
+ lhs_string->Set(rhs_string->Get(), lhs_arena,
r->IsInlinedStringDonated(*lhs, field), lhs_state, mask,
lhs);
- rhs_string->Set(nullptr, temp, rhs_arena,
- r->IsInlinedStringDonated(*rhs, field), rhs_state, mask,
- rhs);
+ rhs_string->Set(temp, rhs_arena, r->IsInlinedStringDonated(*rhs, field),
+ rhs_state, mask, rhs);
}
}
@@ -570,8 +562,7 @@
ArenaStringPtr::UnsafeShallowSwap(lhs_string, rhs_string);
} else {
SwapFieldHelper::SwapArenaStringPtr(
- r->DefaultRaw<ArenaStringPtr>(field).GetPointer(), //
- lhs_string, lhs->GetArenaForAllocation(), //
+ lhs_string, lhs->GetArenaForAllocation(), //
rhs_string, rhs->GetArenaForAllocation());
}
}
@@ -595,28 +586,27 @@
}
}
-void SwapFieldHelper::SwapArenaStringPtr(const std::string* default_ptr,
- ArenaStringPtr* lhs, Arena* lhs_arena,
+void SwapFieldHelper::SwapArenaStringPtr(ArenaStringPtr* lhs, Arena* lhs_arena,
ArenaStringPtr* rhs,
Arena* rhs_arena) {
if (lhs_arena == rhs_arena) {
- ArenaStringPtr::InternalSwap(default_ptr, lhs, lhs_arena, rhs, rhs_arena);
+ ArenaStringPtr::InternalSwap(lhs, lhs_arena, rhs, rhs_arena);
} else if (lhs->IsDefault() && rhs->IsDefault()) {
// Nothing to do.
} else if (lhs->IsDefault()) {
- lhs->Set(default_ptr, rhs->Get(), lhs_arena);
+ lhs->Set(rhs->Get(), lhs_arena);
// rhs needs to be destroyed before overwritten.
- rhs->Destroy(default_ptr, rhs_arena);
- rhs->InitDefault(default_ptr);
+ rhs->Destroy();
+ rhs->InitDefault();
} else if (rhs->IsDefault()) {
- rhs->Set(default_ptr, lhs->Get(), rhs_arena);
+ rhs->Set(lhs->Get(), rhs_arena);
// lhs needs to be destroyed before overwritten.
- lhs->Destroy(default_ptr, lhs_arena);
- lhs->InitDefault(default_ptr);
+ lhs->Destroy();
+ lhs->InitDefault();
} else {
std::string temp = lhs->Get();
- lhs->Set(default_ptr, rhs->Get(), lhs_arena);
- rhs->Set(default_ptr, std::move(temp), rhs_arena);
+ lhs->Set(rhs->Get(), lhs_arena);
+ rhs->Set(std::move(temp), rhs_arena);
}
}
@@ -1266,20 +1256,17 @@
case FieldDescriptor::CPPTYPE_STRING: {
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
- case FieldOptions::STRING: {
+ case FieldOptions::STRING:
if (IsInlined(field)) {
// Currently, string with default value can't be inlined. So we
// don't have to handle default value here.
MutableRaw<InlinedStringField>(message, field)->ClearToEmpty();
- break;
+ } else {
+ auto* str = MutableRaw<ArenaStringPtr>(message, field);
+ str->Destroy();
+ str->InitDefault();
}
- const std::string* default_ptr =
- DefaultRaw<ArenaStringPtr>(field).GetPointer();
- MutableRaw<ArenaStringPtr>(message, field)
- ->SetAllocated(default_ptr, nullptr,
- message->GetArenaForAllocation());
break;
- }
}
break;
}
@@ -1658,17 +1645,13 @@
}
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
- case FieldOptions::STRING: {
+ case FieldOptions::STRING:
if (IsInlined(field)) {
return GetField<InlinedStringField>(message, field).GetNoArena();
+ } else {
+ const auto& str = GetField<ArenaStringPtr>(message, field);
+ return str.IsDefault() ? field->default_value_string() : str.Get();
}
-
- if (auto* value =
- GetField<ArenaStringPtr>(message, field).GetPointer()) {
- return *value;
- }
- return field->default_value_string();
- }
}
}
}
@@ -1687,17 +1670,13 @@
}
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
- case FieldOptions::STRING: {
+ case FieldOptions::STRING:
if (IsInlined(field)) {
return GetField<InlinedStringField>(message, field).GetNoArena();
+ } else {
+ const auto& str = GetField<ArenaStringPtr>(message, field);
+ return str.IsDefault() ? field->default_value_string() : str.Get();
}
-
- if (auto* value =
- GetField<ArenaStringPtr>(message, field).GetPointer()) {
- return *value;
- }
- return field->default_value_string();
- }
}
}
}
@@ -1720,7 +1699,7 @@
&MutableInlinedStringDonatedArray(message)[index / 32];
uint32_t mask = ~(static_cast<uint32_t>(1) << (index % 32));
MutableField<InlinedStringField>(message, field)
- ->Set(nullptr, value, message->GetArenaForAllocation(),
+ ->Set(value, message->GetArenaForAllocation(),
IsInlinedStringDonated(*message, field), states, mask,
message);
break;
@@ -1730,18 +1709,12 @@
// We just need to pass some arbitrary default string to make it work.
// This allows us to not have the real default accessible from
// reflection.
- const std::string* default_ptr =
- schema_.InRealOneof(field)
- ? nullptr
- : DefaultRaw<ArenaStringPtr>(field).GetPointer();
if (schema_.InRealOneof(field) && !HasOneofField(*message, field)) {
ClearOneof(message, field->containing_oneof());
- MutableField<ArenaStringPtr>(message, field)
- ->InitDefault(default_ptr);
+ MutableField<ArenaStringPtr>(message, field)->InitDefault();
}
MutableField<ArenaStringPtr>(message, field)
- ->Set(default_ptr, std::move(value),
- message->GetArenaForAllocation());
+ ->Set(std::move(value), message->GetArenaForAllocation());
break;
}
}
@@ -2721,8 +2694,7 @@
// We just need to pass some arbitrary default string to make it
// work. This allows us to not have the real default accessible
// from reflection.
- MutableField<ArenaStringPtr>(message, field)
- ->Destroy(nullptr, message->GetArenaForAllocation());
+ MutableField<ArenaStringPtr>(message, field)->Destroy();
break;
}
}
diff --git a/src/google/protobuf/generated_message_tctable_impl.h b/src/google/protobuf/generated_message_tctable_impl.h
index 1b67d83..5c1eec2 100644
--- a/src/google/protobuf/generated_message_tctable_impl.h
+++ b/src/google/protobuf/generated_message_tctable_impl.h
@@ -265,45 +265,9 @@
static const char* GenericFallback(PROTOBUF_TC_PARAM_DECL);
static const char* GenericFallbackLite(PROTOBUF_TC_PARAM_DECL);
- // Dispatch to the designated parse function
- inline PROTOBUF_ALWAYS_INLINE static const char* TagDispatch(
- PROTOBUF_TC_PARAM_DECL) {
- const auto coded_tag = UnalignedLoad<uint16_t>(ptr);
- const size_t idx = coded_tag & table->fast_idx_mask;
- PROTOBUF_ASSUME((idx & 7) == 0);
- auto* fast_entry = table->fast_entry(idx >> 3);
- data = fast_entry->bits;
- data.data ^= coded_tag;
- PROTOBUF_MUSTTAIL return fast_entry->target(PROTOBUF_TC_PARAM_PASS);
- }
-
- // We can only safely call from field to next field if the call is optimized
- // to a proper tail call. Otherwise we blow through stack. Clang and gcc
- // reliably do this optimization in opt mode, but do not perform this in debug
- // mode. Luckily the structure of the algorithm is such that it's always
- // possible to just return and use the enclosing parse loop as a trampoline.
- static const char* ToTagDispatch(PROTOBUF_TC_PARAM_DECL) {
- constexpr bool always_return = !PROTOBUF_TAILCALL;
- if (always_return || !ctx->DataAvailable(ptr)) {
- PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
- }
- PROTOBUF_MUSTTAIL return TagDispatch(PROTOBUF_TC_PARAM_PASS);
- }
-
- PROTOBUF_NOINLINE static const char* ParseLoop(
- MessageLite* msg, const char* ptr, ParseContext* ctx,
- const TcParseTableBase* table) {
- ScopedArenaSwap saved(msg, ctx);
- const uint32_t has_bits_offset = table->has_bits_offset;
- while (!ctx->Done(&ptr)) {
- uint64_t hasbits = 0;
- if (has_bits_offset) hasbits = RefAt<uint32_t>(msg, has_bits_offset);
- ptr = TagDispatch(msg, ptr, ctx, table, hasbits, {});
- if (ptr == nullptr) break;
- if (ctx->LastTag() != 1) break; // Ended on terminating tag
- }
- return ptr;
- }
+ static const char* ParseLoop(MessageLite* msg, const char* ptr,
+ ParseContext* ctx,
+ const TcParseTableBase* table);
// Functions referenced by generated fast tables (numeric types):
// F: fixed V: varint Z: zigzag
@@ -424,16 +388,6 @@
return *target;
}
- static inline PROTOBUF_ALWAYS_INLINE void SyncHasbits(
- MessageLite* msg, uint64_t hasbits, const TcParseTableBase* table) {
- const uint32_t has_bits_offset = table->has_bits_offset;
- if (has_bits_offset) {
- // Only the first 32 has-bits are updated. Nothing above those is stored,
- // but e.g. messages without has-bits update the upper bits.
- RefAt<uint32_t>(msg, has_bits_offset) = static_cast<uint32_t>(hasbits);
- }
- }
-
// Mini parsing:
//
// This function parses a field from incoming data based on metadata stored in
@@ -453,38 +407,24 @@
template <typename TagType>
static inline const char* RepeatedParseMessageAuxImpl(PROTOBUF_TC_PARAM_DECL);
- static inline PROTOBUF_ALWAYS_INLINE const char* ToParseLoop(
- PROTOBUF_TC_PARAM_DECL) {
- (void)data;
- (void)ctx;
- SyncHasbits(msg, hasbits, table);
- return ptr;
+ static inline PROTOBUF_ALWAYS_INLINE void SyncHasbits(
+ MessageLite* msg, uint64_t hasbits, const TcParseTableBase* table) {
+ const uint32_t has_bits_offset = table->has_bits_offset;
+ if (has_bits_offset) {
+ // Only the first 32 has-bits are updated. Nothing above those is stored,
+ // but e.g. messages without has-bits update the upper bits.
+ RefAt<uint32_t>(msg, has_bits_offset) = static_cast<uint32_t>(hasbits);
+ }
}
- static inline PROTOBUF_ALWAYS_INLINE const char* Error(
- PROTOBUF_TC_PARAM_DECL) {
- (void)data;
- (void)ctx;
- (void)ptr;
- SyncHasbits(msg, hasbits, table);
- return nullptr;
- }
+ static const char* TagDispatch(PROTOBUF_TC_PARAM_DECL);
+ static const char* ToTagDispatch(PROTOBUF_TC_PARAM_DECL);
+ static const char* ToParseLoop(PROTOBUF_TC_PARAM_DECL);
+ static const char* Error(PROTOBUF_TC_PARAM_DECL);
static const char* FastUnknownEnumFallback(PROTOBUF_TC_PARAM_DECL);
- class ScopedArenaSwap final {
- public:
- ScopedArenaSwap(MessageLite* msg, ParseContext* ctx)
- : ctx_(ctx), saved_(ctx->data().arena) {
- ctx_->data().arena = msg->GetArenaForAllocation();
- }
- ScopedArenaSwap(const ScopedArenaSwap&) = delete;
- ~ScopedArenaSwap() { ctx_->data().arena = saved_; }
-
- private:
- ParseContext* const ctx_;
- Arena* const saved_;
- };
+ class ScopedArenaSwap;
template <class MessageBaseT, class UnknownFieldsT>
static const char* GenericFallbackImpl(PROTOBUF_TC_PARAM_DECL) {
@@ -555,6 +495,14 @@
uint32_t field_num, ParseContext* ctx,
MessageLite* msg);
+ // UTF-8 validation:
+ static void ReportFastUtf8Error(uint16_t coded_tag,
+ const TcParseTableBase* table);
+ static bool MpVerifyUtf8(StringPiece wire_bytes,
+ const TcParseTableBase* table,
+ const TcParseTableBase::FieldEntry& entry,
+ uint16_t xform_val);
+
// For FindFieldEntry tests:
friend class FindFieldEntryTest;
static constexpr const uint32_t kMtSmallScanSize = 4;
diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc
index cda0cc4..e0ba5fc 100644
--- a/src/google/protobuf/generated_message_tctable_lite.cc
+++ b/src/google/protobuf/generated_message_tctable_lite.cc
@@ -46,19 +46,103 @@
namespace protobuf {
namespace internal {
+const uint32_t TcParser::kMtSmallScanSize;
+
using FieldEntry = TcParseTableBase::FieldEntry;
+//////////////////////////////////////////////////////////////////////////////
+// Template instantiations:
+//////////////////////////////////////////////////////////////////////////////
+
#ifndef NDEBUG
template void AlignFail<4>(uintptr_t);
template void AlignFail<8>(uintptr_t);
#endif
-const uint32_t TcParser::kMtSmallScanSize;
-
const char* TcParser::GenericFallbackLite(PROTOBUF_TC_PARAM_DECL) {
return GenericFallbackImpl<MessageLite, std::string>(PROTOBUF_TC_PARAM_PASS);
}
+//////////////////////////////////////////////////////////////////////////////
+// Core fast parsing implementation:
+//////////////////////////////////////////////////////////////////////////////
+
+class TcParser::ScopedArenaSwap final {
+ public:
+ ScopedArenaSwap(MessageLite* msg, ParseContext* ctx)
+ : ctx_(ctx), saved_(ctx->data().arena) {
+ ctx_->data().arena = msg->GetArenaForAllocation();
+ }
+ ScopedArenaSwap(const ScopedArenaSwap&) = delete;
+ ~ScopedArenaSwap() { ctx_->data().arena = saved_; }
+
+ private:
+ ParseContext* const ctx_;
+ Arena* const saved_;
+};
+
+PROTOBUF_NOINLINE const char* TcParser::ParseLoop(
+ MessageLite* msg, const char* ptr, ParseContext* ctx,
+ const TcParseTableBase* table) {
+ ScopedArenaSwap saved(msg, ctx);
+ const uint32_t has_bits_offset = table->has_bits_offset;
+ while (!ctx->Done(&ptr)) {
+ uint64_t hasbits = 0;
+ if (has_bits_offset) hasbits = RefAt<uint32_t>(msg, has_bits_offset);
+ ptr = TagDispatch(msg, ptr, ctx, table, hasbits, {});
+ if (ptr == nullptr) break;
+ if (ctx->LastTag() != 1) break; // Ended on terminating tag
+ }
+ return ptr;
+}
+
+ // Dispatch to the designated parse function
+inline PROTOBUF_ALWAYS_INLINE const char* TcParser::TagDispatch(
+ PROTOBUF_TC_PARAM_DECL) {
+ const auto coded_tag = UnalignedLoad<uint16_t>(ptr);
+ const size_t idx = coded_tag & table->fast_idx_mask;
+ PROTOBUF_ASSUME((idx & 7) == 0);
+ auto* fast_entry = table->fast_entry(idx >> 3);
+ data = fast_entry->bits;
+ data.data ^= coded_tag;
+ PROTOBUF_MUSTTAIL return fast_entry->target(PROTOBUF_TC_PARAM_PASS);
+}
+
+// We can only safely call from field to next field if the call is optimized
+// to a proper tail call. Otherwise we blow through stack. Clang and gcc
+// reliably do this optimization in opt mode, but do not perform this in debug
+// mode. Luckily the structure of the algorithm is such that it's always
+// possible to just return and use the enclosing parse loop as a trampoline.
+inline PROTOBUF_ALWAYS_INLINE const char* TcParser::ToTagDispatch(
+ PROTOBUF_TC_PARAM_DECL) {
+ constexpr bool always_return = !PROTOBUF_TAILCALL;
+ if (always_return || !ctx->DataAvailable(ptr)) {
+ PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
+ }
+ PROTOBUF_MUSTTAIL return TagDispatch(PROTOBUF_TC_PARAM_PASS);
+}
+
+inline PROTOBUF_ALWAYS_INLINE const char* TcParser::ToParseLoop(
+ PROTOBUF_TC_PARAM_DECL) {
+ (void)data;
+ (void)ctx;
+ SyncHasbits(msg, hasbits, table);
+ return ptr;
+}
+
+inline PROTOBUF_ALWAYS_INLINE const char* TcParser::Error(
+ PROTOBUF_TC_PARAM_DECL) {
+ (void)data;
+ (void)ctx;
+ (void)ptr;
+ SyncHasbits(msg, hasbits, table);
+ return nullptr;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Core mini parsing implementation:
+//////////////////////////////////////////////////////////////////////////////
+
// Returns the address of the field for `tag` in the table's field entries.
// Returns nullptr if the field was not found.
const TcParseTableBase::FieldEntry* TcParser::FindFieldEntry(
@@ -888,6 +972,17 @@
StringPiece field_name, const char* operation_str,
bool emit_stacktrace);
+void TcParser::ReportFastUtf8Error(uint16_t coded_tag,
+ const TcParseTableBase* table) {
+ if (coded_tag > 127) {
+ coded_tag = (coded_tag & 0x7f) + ((coded_tag & 0xff00) >> 1);
+ }
+ uint32_t field_num = coded_tag >> 3;
+ const auto* entry = FindFieldEntry(table, field_num);
+ PrintUTF8ErrorLog(MessageName(table), FieldName(table, entry), "parsing",
+ false);
+}
+
namespace {
PROTOBUF_NOINLINE
@@ -895,8 +990,7 @@
EpsCopyInputStream* stream) {
int size = ReadSize(&ptr);
if (!ptr) return nullptr;
- return stream->ReadString(
- ptr, size, s->MutableNoArenaNoDefault(&GetEmptyStringAlreadyInited()));
+ return stream->ReadString(ptr, size, s->MutableNoCopy(nullptr));
}
} // namespace
@@ -907,6 +1001,7 @@
if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_PASS);
}
+ auto saved_tag = UnalignedLoad<TagType>(ptr);
ptr += sizeof(TagType);
hasbits |= (uint64_t{1} << data.hasbit_idx());
auto& field = RefAt<ArenaStringPtr>(msg, data.offset());
@@ -927,7 +1022,7 @@
if (PROTOBUF_PREDICT_TRUE(IsStructurallyValidUTF8(field.Get()))) {
return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
}
- PrintUTF8ErrorLog("", "unknown", "parsing", false);
+ ReportFastUtf8Error(saved_tag, table);
return utf8 == kUtf8 ? Error(PROTOBUF_TC_PARAM_PASS)
: ToParseLoop(PROTOBUF_TC_PARAM_PASS);
}
@@ -973,11 +1068,19 @@
if (ptr == nullptr) {
return Error(PROTOBUF_TC_PARAM_PASS);
}
- if (utf8 != kNoUtf8) {
- if (PROTOBUF_PREDICT_FALSE(!IsStructurallyValidUTF8(*str))) {
- PrintUTF8ErrorLog("", "unknown", "parsing", false);
+ switch (utf8) {
+ case kNoUtf8:
+#ifdef NDEBUG
+ case kUtf8ValidateOnly:
+#endif
+ break;
+ default:
+ if (PROTOBUF_PREDICT_TRUE(IsStructurallyValidUTF8(*str))) {
+ break;
+ }
+ ReportFastUtf8Error(expected_tag, table);
if (utf8 == kUtf8) return Error(PROTOBUF_TC_PARAM_PASS);
- }
+ break;
}
if (!ctx->DataAvailable(ptr)) break;
} while (UnalignedLoad<TagType>(ptr) == expected_tag);
@@ -1060,11 +1163,10 @@
uint16_t current_kind = current_entry->type_card & field_layout::kFkMask;
uint16_t current_rep = current_entry->type_card & field_layout::kRepMask;
if (current_kind == field_layout::kFkString) {
- Arena* arena = ctx->data().arena;
switch (current_rep) {
case field_layout::kRepAString: {
auto& field = RefAt<ArenaStringPtr>(msg, current_entry->offset);
- field.Destroy(ArenaStringPtr::EmptyDefault{}, arena);
+ field.Destroy();
break;
}
case field_layout::kRepSString:
@@ -1385,23 +1487,28 @@
return Error(PROTOBUF_TC_PARAM_PASS);
}
-namespace {
-
-inline bool MpVerifyUtf8(StringPiece wire_bytes, const FieldEntry& entry,
- uint16_t xform_val) {
+bool TcParser::MpVerifyUtf8(StringPiece wire_bytes,
+ const TcParseTableBase* table,
+ const FieldEntry& entry, uint16_t xform_val) {
if (xform_val == field_layout::kTvUtf8) {
- return VerifyUTF8(wire_bytes, "unknown");
+ if (!IsStructurallyValidUTF8(wire_bytes)) {
+ PrintUTF8ErrorLog(MessageName(table), FieldName(table, &entry), "parsing",
+ false);
+ return false;
+ }
+ return true;
}
#ifndef NDEBUG
if (xform_val == field_layout::kTvUtf8Debug) {
- VerifyUTF8(wire_bytes, "unknown");
+ if (!IsStructurallyValidUTF8(wire_bytes)) {
+ PrintUTF8ErrorLog(MessageName(table), FieldName(table, &entry), "parsing",
+ false);
+ }
}
#endif // NDEBUG
return true;
}
-} // namespace
-
const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) {
const auto& entry = RefAt<FieldEntry>(table, data.entry_offset());
const uint16_t type_card = entry.type_card;
@@ -1415,18 +1522,6 @@
PROTOBUF_MUSTTAIL return MpRepeatedString(PROTOBUF_TC_PARAM_PASS);
}
const uint16_t xform_val = type_card & field_layout::kTvMask;
-
- // TODO(b/209516305): handle UTF-8 fields once field names are available.
- if (
-#ifdef NDEBUG
- xform_val == field_layout::kTvUtf8
-#else
- xform_val != 0
-#endif
- ) {
- PROTOBUF_MUSTTAIL return table->fallback(PROTOBUF_TC_PARAM_PASS);
- }
-
const uint16_t rep = type_card & field_layout::kRepMask;
if (rep == field_layout::kRepIString) {
// TODO(b/198211897): support InilnedStringField.
@@ -1446,19 +1541,16 @@
Arena* arena = ctx->data().arena;
switch (rep) {
case field_layout::kRepAString: {
- const std::string* default_value =
- RefAt<ArenaStringPtr>(table->default_instance, entry.offset)
- .tagged_ptr_.Get();
auto& field = RefAt<ArenaStringPtr>(msg, entry.offset);
if (need_init) field.InitDefault();
if (arena) {
ptr = ctx->ReadArenaString(ptr, &field, arena);
} else {
- std::string* str = field.MutableNoCopy(default_value, nullptr);
+ std::string* str = field.MutableNoCopy(nullptr);
ptr = InlineGreedyStringParser(str, ptr, ctx);
}
if (!ptr) break;
- is_valid = MpVerifyUtf8(field.Get(), entry, xform_val);
+ is_valid = MpVerifyUtf8(field.Get(), table, entry, xform_val);
break;
}
@@ -1484,18 +1576,6 @@
const uint16_t rep = type_card & field_layout::kRepMask;
const uint16_t xform_val = type_card & field_layout::kTvMask;
-
- // TODO(b/209516305): handle UTF-8 fields once field names are available.
- if (
-#ifdef NDEBUG
- xform_val == field_layout::kTvUtf8
-#else
- xform_val != 0
-#endif
- ) {
- PROTOBUF_MUSTTAIL return table->fallback(PROTOBUF_TC_PARAM_PASS);
- }
-
switch (rep) {
case field_layout::kRepSString: {
auto& field = RefAt<RepeatedPtrField<std::string>>(msg, entry.offset);
@@ -1505,8 +1585,9 @@
ptr = ptr2;
std::string* str = field.Add();
ptr = InlineGreedyStringParser(str, ptr, ctx);
- if (PROTOBUF_PREDICT_FALSE(ptr == nullptr ||
- !MpVerifyUtf8(*str, entry, xform_val))) {
+ if (PROTOBUF_PREDICT_FALSE(
+ ptr == nullptr ||
+ !MpVerifyUtf8(*str, table, entry, xform_val))) {
return Error(PROTOBUF_TC_PARAM_PASS);
}
if (!ctx->DataAvailable(ptr)) break;
diff --git a/src/google/protobuf/generated_message_tctable_lite_test.cc b/src/google/protobuf/generated_message_tctable_lite_test.cc
index 1738a84..706248a 100644
--- a/src/google/protobuf/generated_message_tctable_lite_test.cc
+++ b/src/google/protobuf/generated_message_tctable_lite_test.cc
@@ -88,11 +88,11 @@
} // namespace
class FindFieldEntryTest : public ::testing::Test {
- protected:
+ public:
// Calls the private `FindFieldEntry` function.
template <size_t kFastTableSizeLog2, size_t kNumEntries, size_t kNumFieldAux,
size_t kNameTableSize>
- const TcParseTableBase::FieldEntry* FindFieldEntry(
+ static const TcParseTableBase::FieldEntry* FindFieldEntry(
const TcParseTable<kFastTableSizeLog2, kNumEntries, kNumFieldAux,
kNameTableSize>& table,
uint32_t tag) {
@@ -102,7 +102,7 @@
// Calls the private `FieldName` function.
template <size_t kFastTableSizeLog2, size_t kNumEntries, size_t kNumFieldAux,
size_t kNameTableSize>
- StringPiece FieldName(
+ static StringPiece FieldName(
const TcParseTable<kFastTableSizeLog2, kNumEntries, kNumFieldAux,
kNameTableSize>& table,
const TcParseTableBase::FieldEntry* entry) {
@@ -112,7 +112,7 @@
// Calls the private `MessageName` function.
template <size_t kFastTableSizeLog2, size_t kNumEntries, size_t kNumFieldAux,
size_t kNameTableSize>
- StringPiece MessageName(
+ static StringPiece MessageName(
const TcParseTable<kFastTableSizeLog2, kNumEntries, kNumFieldAux,
kNameTableSize>& table) {
return TcParser::MessageName(&table.header);
@@ -293,196 +293,197 @@
EXPECT_THAT(MessageName(table), Eq("MessageName"));
}
-TEST_F(FindFieldEntryTest, BigMessage) {
- // Make a monster with lots of field numbers
- // clang-format off
- const TcParseTable<5, 134, 5, 2176> test_all_types_table = {
- // header:
- {
- 0, 0, 0, 0, // has_bits_offset, extensions
- 418, 248, // max_field_number, fast_idx_mask
- 14, 1, // num_sequential_fields, sequential_fields_start
- 135, // num_field_entries
- 5, // num_aux_entries
- offsetof(decltype(test_all_types_table), aux_entries),
- nullptr, // default instance
- nullptr, // fallback function
- },
- {{
- // tail-call table
- }},
- {{// field numbers
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 18, 19, 21, 22, 24,
- 25, 27, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 48, 49, 51,
- 52, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
- 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
- 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
- 111, 112, 113, 114, 115, 116, 117, 118, 119, 201,
- 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
- 251, 252, 253, 254, 255, 321, 322, 401, 402, 403,
- 404, 405, 406, 407, 408, 409, 410, 411, 412, 413,
- 414, 415, 416, 417}},
+// Make a monster with lots of field numbers
+// clang-format off
+const TcParseTable<5, 134, 5, 2176> test_all_types_table = {
+ // header:
+ {
+ 0, 0, 0, 0, // has_bits_offset, extensions
+ 418, 248, // max_field_number, fast_idx_mask
+ 14, 1, // num_sequential_fields, sequential_fields_start
+ 135, // num_field_entries
+ 5, // num_aux_entries
+ offsetof(decltype(test_all_types_table), aux_entries),
+ nullptr, // default instance
+ nullptr, // fallback function
+ },
{{
- // "mini" table
+ // tail-call table
}},
- {{ // auxiliary entries (not used in this test)
- {-1, 4},
- {-1, 4},
- {-1, 4},
- {-1, 4},
- {-1, 4},
- }}, {{ // name lengths
- "\1" // message name
- "\16\16\17\17\17\17\20\20\21\21\16\17\15\17\16\27\30\24\25\25"
- "\15\21\16\16\17\17\17\17\20\20\21\21\16\17\15\17\16\27\30\24"
- "\25\25\15\17\17\21\21\21\21\23\23\25\25\17\20\15\21\20\31\32"
- "\26\27\14\14\15\15\15\15\16\16\17\17\14\15\13\22\16\16\17\17"
- "\17\17\20\20\21\21\16\17\15\24\14\24\14\13\12\14\13\14\12\4"
- "\15\15\16\16\16\16\17\17\20\20\15\16\14\16\15\25\25\12\13\14"
- "\15\13\15\12\12\13\14\14\14\16\16\15\15\16\0"
- // names
- "M"
- "optional_int32"
- "optional_int64"
- "optional_uint32"
- "optional_uint64"
- "optional_sint32"
- "optional_sint64"
- "optional_fixed32"
- "optional_fixed64"
- "optional_sfixed32"
- "optional_sfixed64"
- "optional_float"
- "optional_double"
- "optional_bool"
- "optional_string"
- "optional_bytes"
- "optional_nested_message"
- "optional_foreign_message"
- "optional_nested_enum"
- "optional_foreign_enum"
- "optional_string_piece"
- "optional_cord"
- "recursive_message"
- "repeated_int32"
- "repeated_int64"
- "repeated_uint32"
- "repeated_uint64"
- "repeated_sint32"
- "repeated_sint64"
- "repeated_fixed32"
- "repeated_fixed64"
- "repeated_sfixed32"
- "repeated_sfixed64"
- "repeated_float"
- "repeated_double"
- "repeated_bool"
- "repeated_string"
- "repeated_bytes"
- "repeated_nested_message"
- "repeated_foreign_message"
- "repeated_nested_enum"
- "repeated_foreign_enum"
- "repeated_string_piece"
- "repeated_cord"
- "map_int32_int32"
- "map_int64_int64"
- "map_uint32_uint32"
- "map_uint64_uint64"
- "map_sint32_sint32"
- "map_sint64_sint64"
- "map_fixed32_fixed32"
- "map_fixed64_fixed64"
- "map_sfixed32_sfixed32"
- "map_sfixed64_sfixed64"
- "map_int32_float"
- "map_int32_double"
- "map_bool_bool"
- "map_string_string"
- "map_string_bytes"
- "map_string_nested_message"
- "map_string_foreign_message"
- "map_string_nested_enum"
- "map_string_foreign_enum"
- "packed_int32"
- "packed_int64"
- "packed_uint32"
- "packed_uint64"
- "packed_sint32"
- "packed_sint64"
- "packed_fixed32"
- "packed_fixed64"
- "packed_sfixed32"
- "packed_sfixed64"
- "packed_float"
- "packed_double"
- "packed_bool"
- "packed_nested_enum"
- "unpacked_int32"
- "unpacked_int64"
- "unpacked_uint32"
- "unpacked_uint64"
- "unpacked_sint32"
- "unpacked_sint64"
- "unpacked_fixed32"
- "unpacked_fixed64"
- "unpacked_sfixed32"
- "unpacked_sfixed64"
- "unpacked_float"
- "unpacked_double"
- "unpacked_bool"
- "unpacked_nested_enum"
- "oneof_uint32"
- "oneof_nested_message"
- "oneof_string"
- "oneof_bytes"
- "oneof_bool"
- "oneof_uint64"
- "oneof_float"
- "oneof_double"
- "oneof_enum"
- "data"
- "default_int32"
- "default_int64"
- "default_uint32"
- "default_uint64"
- "default_sint32"
- "default_sint64"
- "default_fixed32"
- "default_fixed64"
- "default_sfixed32"
- "default_sfixed64"
- "default_float"
- "default_double"
- "default_bool"
- "default_string"
- "default_bytes"
- "optional_lazy_message"
- "repeated_lazy_message"
- "fieldname1"
- "field_name2"
- "_field_name3"
- "field__name4_"
- "field0name5"
- "field_0_name6"
- "fieldName7"
- "FieldName8"
- "field_Name9"
- "Field_Name10"
- "FIELD_NAME11"
- "FIELD_name12"
- "__field_name13"
- "__Field_name14"
- "field__name15"
- "field__Name16"
- "field_name17__"
- }},
- };
- // clang-format on
+ {{// field numbers
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 18, 19, 21, 22, 24,
+ 25, 27, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 48, 49, 51,
+ 52, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ 111, 112, 113, 114, 115, 116, 117, 118, 119, 201,
+ 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
+ 251, 252, 253, 254, 255, 321, 322, 401, 402, 403,
+ 404, 405, 406, 407, 408, 409, 410, 411, 412, 413,
+ 414, 415, 416, 417}},
+ {{
+ // "mini" table
+ }},
+ {{ // auxiliary entries (not used in this test)
+ {-1, 4},
+ {-1, 4},
+ {-1, 4},
+ {-1, 4},
+ {-1, 4},
+ }}, {{ // name lengths
+ "\1" // message name
+ "\16\16\17\17\17\17\20\20\21\21\16\17\15\17\16\27\30\24\25\25"
+ "\15\21\16\16\17\17\17\17\20\20\21\21\16\17\15\17\16\27\30\24"
+ "\25\25\15\17\17\21\21\21\21\23\23\25\25\17\20\15\21\20\31\32"
+ "\26\27\14\14\15\15\15\15\16\16\17\17\14\15\13\22\16\16\17\17"
+ "\17\17\20\20\21\21\16\17\15\24\14\24\14\13\12\14\13\14\12\4"
+ "\15\15\16\16\16\16\17\17\20\20\15\16\14\16\15\25\25\12\13\14"
+ "\15\13\15\12\12\13\14\14\14\16\16\15\15\16\0"
+ // names
+ "M"
+ "optional_int32"
+ "optional_int64"
+ "optional_uint32"
+ "optional_uint64"
+ "optional_sint32"
+ "optional_sint64"
+ "optional_fixed32"
+ "optional_fixed64"
+ "optional_sfixed32"
+ "optional_sfixed64"
+ "optional_float"
+ "optional_double"
+ "optional_bool"
+ "optional_string"
+ "optional_bytes"
+ "optional_nested_message"
+ "optional_foreign_message"
+ "optional_nested_enum"
+ "optional_foreign_enum"
+ "optional_string_piece"
+ "optional_cord"
+ "recursive_message"
+ "repeated_int32"
+ "repeated_int64"
+ "repeated_uint32"
+ "repeated_uint64"
+ "repeated_sint32"
+ "repeated_sint64"
+ "repeated_fixed32"
+ "repeated_fixed64"
+ "repeated_sfixed32"
+ "repeated_sfixed64"
+ "repeated_float"
+ "repeated_double"
+ "repeated_bool"
+ "repeated_string"
+ "repeated_bytes"
+ "repeated_nested_message"
+ "repeated_foreign_message"
+ "repeated_nested_enum"
+ "repeated_foreign_enum"
+ "repeated_string_piece"
+ "repeated_cord"
+ "map_int32_int32"
+ "map_int64_int64"
+ "map_uint32_uint32"
+ "map_uint64_uint64"
+ "map_sint32_sint32"
+ "map_sint64_sint64"
+ "map_fixed32_fixed32"
+ "map_fixed64_fixed64"
+ "map_sfixed32_sfixed32"
+ "map_sfixed64_sfixed64"
+ "map_int32_float"
+ "map_int32_double"
+ "map_bool_bool"
+ "map_string_string"
+ "map_string_bytes"
+ "map_string_nested_message"
+ "map_string_foreign_message"
+ "map_string_nested_enum"
+ "map_string_foreign_enum"
+ "packed_int32"
+ "packed_int64"
+ "packed_uint32"
+ "packed_uint64"
+ "packed_sint32"
+ "packed_sint64"
+ "packed_fixed32"
+ "packed_fixed64"
+ "packed_sfixed32"
+ "packed_sfixed64"
+ "packed_float"
+ "packed_double"
+ "packed_bool"
+ "packed_nested_enum"
+ "unpacked_int32"
+ "unpacked_int64"
+ "unpacked_uint32"
+ "unpacked_uint64"
+ "unpacked_sint32"
+ "unpacked_sint64"
+ "unpacked_fixed32"
+ "unpacked_fixed64"
+ "unpacked_sfixed32"
+ "unpacked_sfixed64"
+ "unpacked_float"
+ "unpacked_double"
+ "unpacked_bool"
+ "unpacked_nested_enum"
+ "oneof_uint32"
+ "oneof_nested_message"
+ "oneof_string"
+ "oneof_bytes"
+ "oneof_bool"
+ "oneof_uint64"
+ "oneof_float"
+ "oneof_double"
+ "oneof_enum"
+ "data"
+ "default_int32"
+ "default_int64"
+ "default_uint32"
+ "default_uint64"
+ "default_sint32"
+ "default_sint64"
+ "default_fixed32"
+ "default_fixed64"
+ "default_sfixed32"
+ "default_sfixed64"
+ "default_float"
+ "default_double"
+ "default_bool"
+ "default_string"
+ "default_bytes"
+ "optional_lazy_message"
+ "repeated_lazy_message"
+ "fieldname1"
+ "field_name2"
+ "_field_name3"
+ "field__name4_"
+ "field0name5"
+ "field_0_name6"
+ "fieldName7"
+ "FieldName8"
+ "field_Name9"
+ "Field_Name10"
+ "FIELD_NAME11"
+ "FIELD_name12"
+ "__field_name13"
+ "__Field_name14"
+ "field__name15"
+ "field__Name16"
+ "field_name17__"
+ }},
+};
+// clang-format on
+
+TEST_F(FindFieldEntryTest, BigMessage) {
EXPECT_THAT(MessageName(test_all_types_table), Eq("M"));
for (int field_num :
{1, 12, 31, 42, 57, 68, 79, 90, 101, 119, 249, 402, 412}) {
diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc
index 78d13f9..cad12a3 100644
--- a/src/google/protobuf/generated_message_util.cc
+++ b/src/google/protobuf/generated_message_util.cc
@@ -389,8 +389,7 @@
MessageLite* GetOwnedMessageInternal(Arena* message_arena,
MessageLite* submessage,
Arena* submessage_arena) {
- GOOGLE_DCHECK(Arena::InternalHelper<MessageLite>::GetOwningArena(submessage) ==
- submessage_arena);
+ GOOGLE_DCHECK(Arena::InternalGetOwningArena(submessage) == submessage_arena);
GOOGLE_DCHECK(message_arena != submessage_arena);
GOOGLE_DCHECK_EQ(submessage_arena, nullptr);
if (message_arena != nullptr && submessage_arena == nullptr) {
diff --git a/src/google/protobuf/inlined_string_field.cc b/src/google/protobuf/inlined_string_field.cc
index f60fb91..0c3e476 100644
--- a/src/google/protobuf/inlined_string_field.cc
+++ b/src/google/protobuf/inlined_string_field.cc
@@ -55,8 +55,7 @@
return MutableSlow(arena, donated, donating_states, mask, msg);
}
-std::string* InlinedStringField::Mutable(ArenaStringPtr::EmptyDefault,
- Arena* arena, bool donated,
+std::string* InlinedStringField::Mutable(Arena* arena, bool donated,
uint32_t* donating_states,
uint32_t mask, MessageLite* msg) {
if (arena == nullptr || !donated) {
@@ -83,27 +82,28 @@
SetAllocatedNoArena(default_value, value);
}
-void InlinedStringField::Set(const std::string* default_value,
- std::string&& value, Arena* arena, bool donated,
+void InlinedStringField::Set(std::string&& value, Arena* arena, bool donated,
uint32_t* donating_states, uint32_t mask,
MessageLite* msg) {
(void)donating_states;
(void)mask;
(void)msg;
- SetNoArena(default_value, std::move(value));
+ SetNoArena(std::move(value));
}
-std::string* InlinedStringField::Release(const std::string* default_value,
- Arena* arena, bool donated) {
- if (arena == nullptr && !donated) {
- return ReleaseNonDefaultNoArena(default_value);
- }
- return ReleaseNonDefault(default_value, arena);
+std::string* InlinedStringField::Release() {
+ auto* released = new std::string(std::move(*get_mutable()));
+ get_mutable()->clear();
+ return released;
}
-std::string* InlinedStringField::ReleaseNonDefault(
- const std::string* default_value, Arena* arena) {
- return ReleaseNonDefaultNoArena(default_value);
+std::string* InlinedStringField::Release(Arena* arena, bool donated) {
+ // We can not steal donated arena strings.
+ std::string* released = (arena != nullptr && donated)
+ ? new std::string(*get_mutable())
+ : new std::string(std::move(*get_mutable()));
+ get_mutable()->clear();
+ return released;
}
void InlinedStringField::ClearToDefault(const LazyString& default_value,
diff --git a/src/google/protobuf/inlined_string_field.h b/src/google/protobuf/inlined_string_field.h
index 69ba493..79e37d4 100644
--- a/src/google/protobuf/inlined_string_field.h
+++ b/src/google/protobuf/inlined_string_field.h
@@ -130,63 +130,45 @@
// `donated == ((donating_states & ~mask) != 0)`
//
// This method never changes the `donating_states`.
- void Set(const std::string* default_value, ConstStringParam value,
- Arena* arena, bool donated, uint32_t* /*donating_states*/,
- uint32_t /*mask*/, MessageLite* /*msg*/) {
- (void)arena;
- (void)donated;
- SetNoArena(default_value, value);
- }
+ void Set(ConstStringParam value, Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg);
// Rvalue Set. If this field is donated, this method will undonate this field
// by mutating the `donating_states` according to `mask`.
- void Set(const std::string* default_value, std::string&& value, Arena* arena,
- bool donated, uint32_t* donating_states, uint32_t mask,
- MessageLite* msg);
+ void Set(std::string&& value, Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg);
- template <typename FirstParam>
- void Set(FirstParam p1, const char* str, ::google::protobuf::Arena* arena, bool donated,
- uint32_t* donating_states, uint32_t mask, MessageLite* msg) {
- Set(p1, ConstStringParam(str), arena, donated, donating_states, mask, msg);
- }
+ void Set(const char* str, ::google::protobuf::Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg);
- template <typename FirstParam>
- void Set(FirstParam p1, const char* str, size_t size, ::google::protobuf::Arena* arena,
- bool donated, uint32_t* donating_states, uint32_t mask,
- MessageLite* msg) {
- ConstStringParam sp{str, size}; // for string_view and `const string &`
- Set(p1, sp, arena, donated, donating_states, mask, msg);
- }
+ void Set(const char* str, size_t size, ::google::protobuf::Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg);
- template <typename FirstParam, typename RefWrappedType>
- void Set(FirstParam p1,
- std::reference_wrapper<RefWrappedType> const_string_ref,
+ template <typename RefWrappedType>
+ void Set(std::reference_wrapper<RefWrappedType> const_string_ref,
::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
- uint32_t mask, MessageLite* msg) {
- Set(p1, const_string_ref.get(), arena, donated, donating_states, mask, msg);
- }
+ uint32_t mask, MessageLite* msg);
- template <typename FirstParam, typename SecondParam>
- void SetBytes(FirstParam p1, SecondParam&& p2, ::google::protobuf::Arena* arena,
+ void SetBytes(ConstStringParam value, Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg);
+
+ void SetBytes(std::string&& value, Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg);
+
+ void SetBytes(const char* str, ::google::protobuf::Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg);
+
+ void SetBytes(const void* p, size_t size, ::google::protobuf::Arena* arena,
bool donated, uint32_t* donating_states, uint32_t mask,
- MessageLite* msg) {
- Set(p1, static_cast<SecondParam&&>(p2), arena, donated, donating_states,
- mask, msg);
- }
+ MessageLite* msg);
- template <typename FirstParam>
- void SetBytes(FirstParam p1, const void* str, size_t size,
+ template <typename RefWrappedType>
+ void SetBytes(std::reference_wrapper<RefWrappedType> const_string_ref,
::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
- uint32_t mask, MessageLite* msg) {
- // Must work whether ConstStringParam is string_view or `const string &`
- ConstStringParam sp{static_cast<const char*>(str), size};
- Set(p1, sp, arena, donated, donating_states, mask, msg);
- }
+ uint32_t mask, MessageLite* msg);
- PROTOBUF_NDEBUG_INLINE void SetNoArena(const std::string* default_value,
- StringPiece value);
- PROTOBUF_NDEBUG_INLINE void SetNoArena(const std::string* default_value,
- std::string&& value);
+ PROTOBUF_NDEBUG_INLINE void SetNoArena(StringPiece value);
+ PROTOBUF_NDEBUG_INLINE void SetNoArena(std::string&& value);
// Basic accessors.
PROTOBUF_NDEBUG_INLINE const std::string& Get() const { return GetNoArena(); }
@@ -196,22 +178,17 @@
// field is donated, this method undonates this field by mutating the
// `donating_states` according to `mask`, and copies the content of the
// original string to the returning string.
+ std::string* Mutable(Arena* arena, bool donated, uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg);
std::string* Mutable(const LazyString& default_value, Arena* arena,
bool donated, uint32_t* donating_states, uint32_t mask,
MessageLite* msg);
- std::string* Mutable(ArenaStringPtr::EmptyDefault, Arena* arena, bool donated,
- uint32_t* donating_states, uint32_t mask,
- MessageLite* msg);
- // Release returns a std::string* instance that is heap-allocated and is not
- // Own()'d by any arena. If the field is not set, this returns nullptr. The
- // caller retains ownership. Clears this field back to nullptr state. Used to
- // implement release_<field>() methods on generated classes.
- PROTOBUF_NODISCARD std::string* Release(const std::string* default_value,
- Arena* arena, bool donated);
- PROTOBUF_NODISCARD std::string* ReleaseNonDefault(
- const std::string* default_value, Arena* arena);
- std::string* ReleaseNonDefaultNoArena(const std::string* default_value);
+ // Mutable(nullptr_t) is an overload to explicitly support Mutable(nullptr)
+ // calls used by the internal parser logic. This provides API equivalence with
+ // ArenaStringPtr, while still protecting against calls with arena pointers.
+ std::string* Mutable(std::nullptr_t);
+ std::string* MutableNoCopy(std::nullptr_t);
// Takes a std::string that is heap-allocated, and takes ownership. The
// std::string's destructor is registered with the arena. Used to implement
@@ -226,6 +203,120 @@
void SetAllocatedNoArena(const std::string* default_value,
std::string* value);
+ // Release returns a std::string* instance that is heap-allocated and is not
+ // Own()'d by any arena. If the field is not set, this returns nullptr. The
+ // caller retains ownership. Clears this field back to nullptr state. Used to
+ // implement release_<field>() methods on generated classes.
+ PROTOBUF_NODISCARD std::string* Release(Arena* arena, bool donated);
+ PROTOBUF_NODISCARD std::string* Release();
+
+ // --------------------------------------------------------
+ // Below functions will be removed in subsequent code change
+ // --------------------------------------------------------
+#ifdef DEPRECATED_METHODS_TO_BE_DELETED
+ PROTOBUF_NODISCARD std::string* Release(const std::string*, Arena* arena,
+ bool donated) {
+ return Release(arena, donated);
+ }
+
+ PROTOBUF_NODISCARD std::string* ReleaseNonDefault(const std::string*,
+ Arena* arena) {
+ return Release();
+ }
+
+ std::string* ReleaseNonDefaultNoArena(const std::string* default_value) {
+ return Release();
+ }
+
+ void Set(const std::string*, ConstStringParam value, Arena* arena,
+ bool donated, uint32_t* donating_states, uint32_t mask,
+ MessageLite* msg) {
+ Set(value, arena, donated, donating_states, mask, msg);
+ }
+
+ void Set(const std::string*, std::string&& value, Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg) {
+ Set(std::move(value), arena, donated, donating_states, mask, msg);
+ }
+
+
+ template <typename FirstParam>
+ void Set(FirstParam, const char* str, ::google::protobuf::Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask, MessageLite* msg) {
+ Set(str, arena, donated, donating_states, mask, msg);
+ }
+
+ template <typename FirstParam>
+ void Set(FirstParam p1, const char* str, size_t size, ::google::protobuf::Arena* arena,
+ bool donated, uint32_t* donating_states, uint32_t mask,
+ MessageLite* msg) {
+ Set(str, size, arena, donated, donating_states, mask, msg);
+ }
+
+ template <typename FirstParam, typename RefWrappedType>
+ void Set(FirstParam p1,
+ std::reference_wrapper<RefWrappedType> const_string_ref,
+ ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ Set(const_string_ref, arena, donated, donating_states, mask, msg);
+ }
+
+ void SetBytes(const std::string*, ConstStringParam value, Arena* arena,
+ bool donated, uint32_t* donating_states, uint32_t mask,
+ MessageLite* msg) {
+ Set(value, arena, donated, donating_states, mask, msg);
+ }
+
+
+ void SetBytes(const std::string*, std::string&& value, Arena* arena,
+ bool donated, uint32_t* donating_states, uint32_t mask,
+ MessageLite* msg) {
+ Set(std::move(value), arena, donated, donating_states, mask, msg);
+ }
+
+ template <typename FirstParam>
+ void SetBytes(FirstParam p1, const char* str, ::google::protobuf::Arena* arena,
+ bool donated, uint32_t* donating_states, uint32_t mask,
+ MessageLite* msg) {
+ SetBytes(str, arena, donated, donating_states, mask, msg);
+ }
+
+ template <typename FirstParam>
+ void SetBytes(FirstParam p1, const void* p, size_t size,
+ ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ SetBytes(p, size, arena, donated, donating_states, mask, msg);
+ }
+
+ template <typename FirstParam, typename RefWrappedType>
+ void SetBytes(FirstParam p1,
+ std::reference_wrapper<RefWrappedType> const_string_ref,
+ ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ SetBytes(const_string_ref.get(), arena, donated, donating_states, mask,
+ msg);
+ }
+
+ void SetNoArena(const std::string*, StringPiece value) {
+ SetNoArena(value);
+ }
+ void SetNoArena(const std::string*, std::string&& value) {
+ SetNoArena(std::move(value));
+ }
+
+ std::string* Mutable(ArenaStringPtr::EmptyDefault, Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask,
+ MessageLite* msg) {
+ return Mutable(arena, donated, donating_states, mask, msg);
+ }
+
+ PROTOBUF_NDEBUG_INLINE std::string* MutableNoArenaNoDefault(
+ const std::string* /*default_value*/) {
+ return MutableNoCopy(nullptr);
+ }
+
+#endif // DEPRECATED_METHODS_TO_BE_DELETED
+
// Arena-safety semantics: this is guarded by the logic in
// Swap()/UnsafeArenaSwap() at the message level, so this method is
// 'unsafe' if called directly.
@@ -258,17 +349,12 @@
void ClearToDefault(const LazyString& default_value, Arena* arena,
bool donated);
- // Returns a mutable pointer, but doesn't initialize the string to the
- // default value.
- PROTOBUF_NDEBUG_INLINE std::string* MutableNoArenaNoDefault(
- const std::string* /*default_value*/);
-
// Generated code / reflection only! Returns a mutable pointer to the string.
PROTOBUF_NDEBUG_INLINE std::string* UnsafeMutablePointer();
// InlinedStringField doesn't have things like the `default_value` pointer in
// ArenaStringPtr.
- static constexpr bool IsDefault() { return false; }
+ static constexpr bool IsDefault() { return false; }
static constexpr bool IsDefault(const std::string*) { return false; }
private:
@@ -327,21 +413,11 @@
this->~InlinedStringField();
}
-inline std::string* InlinedStringField::ReleaseNonDefaultNoArena(
- const std::string* /*default_value*/) {
- // Currently, inlined string field can't have non empty default.
- auto* released = new std::string();
- get_mutable()->swap(*released);
- return released;
-}
-
-inline void InlinedStringField::SetNoArena(const std::string* /*default_value*/,
- StringPiece value) {
+inline void InlinedStringField::SetNoArena(StringPiece value) {
get_mutable()->assign(value.data(), value.length());
}
-inline void InlinedStringField::SetNoArena(const std::string* /*default_value*/,
- std::string&& value) {
+inline void InlinedStringField::SetNoArena(std::string&& value) {
get_mutable()->assign(std::move(value));
}
@@ -369,15 +445,84 @@
#endif
}
-inline std::string* InlinedStringField::MutableNoArenaNoDefault(
- const std::string*) {
- return get_mutable();
+inline void InlinedStringField::Set(ConstStringParam value, Arena* arena,
+ bool donated, uint32_t* /*donating_states*/,
+ uint32_t /*mask*/, MessageLite* /*msg*/) {
+ (void)arena;
+ (void)donated;
+ SetNoArena(value);
+}
+
+inline void InlinedStringField::Set(const char* str, ::google::protobuf::Arena* arena,
+ bool donated, uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ Set(ConstStringParam(str), arena, donated, donating_states, mask, msg);
+}
+
+inline void InlinedStringField::Set(const char* str, size_t size,
+ ::google::protobuf::Arena* arena, bool donated,
+ uint32_t* donating_states, uint32_t mask,
+ MessageLite* msg) {
+ Set(ConstStringParam{str, size}, arena, donated, donating_states, mask, msg);
+}
+
+inline void InlinedStringField::SetBytes(ConstStringParam value, Arena* arena,
+ bool donated,
+ uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ Set(value, arena, donated, donating_states, mask, msg);
+}
+
+inline void InlinedStringField::SetBytes(std::string&& value, Arena* arena,
+ bool donated,
+ uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ Set(std::move(value), arena, donated, donating_states, mask, msg);
+}
+
+inline void InlinedStringField::SetBytes(const char* str,
+ ::google::protobuf::Arena* arena, bool donated,
+ uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ Set(str, arena, donated, donating_states, mask, msg);
+}
+
+inline void InlinedStringField::SetBytes(const void* p, size_t size,
+ ::google::protobuf::Arena* arena, bool donated,
+ uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ Set(static_cast<const char*>(p), size, arena, donated, donating_states, mask,
+ msg);
+}
+
+template <typename RefWrappedType>
+inline void InlinedStringField::Set(
+ std::reference_wrapper<RefWrappedType> const_string_ref,
+ ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ Set(const_string_ref.get(), arena, donated, donating_states, mask, msg);
+}
+
+template <typename RefWrappedType>
+inline void InlinedStringField::SetBytes(
+ std::reference_wrapper<RefWrappedType> const_string_ref,
+ ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
+ uint32_t mask, MessageLite* msg) {
+ Set(const_string_ref.get(), arena, donated, donating_states, mask, msg);
}
inline std::string* InlinedStringField::UnsafeMutablePointer() {
return get_mutable();
}
+inline std::string* InlinedStringField::Mutable(std::nullptr_t) {
+ return get_mutable();
+}
+
+inline std::string* InlinedStringField::MutableNoCopy(std::nullptr_t) {
+ return get_mutable();
+}
+
} // namespace internal
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/inlined_string_field_unittest.cc b/src/google/protobuf/inlined_string_field_unittest.cc
index ae731d6..52f16f3 100644
--- a/src/google/protobuf/inlined_string_field_unittest.cc
+++ b/src/google/protobuf/inlined_string_field_unittest.cc
@@ -35,6 +35,7 @@
#include <cstring>
#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include <google/protobuf/stubs/logging.h>
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h
index d79efb4..a044080 100644
--- a/src/google/protobuf/map_type_handler.h
+++ b/src/google/protobuf/map_type_handler.h
@@ -580,12 +580,12 @@
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Merge( \
const MapEntryAccessorType& from, TypeOnMemory* to, Arena* arena) { \
- to->Set(&internal::GetEmptyStringAlreadyInited(), from, arena); \
+ to->Set(from, arena); \
} \
template <typename Type> \
void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::DeleteNoArena( \
TypeOnMemory& value) { \
- value.DestroyNoArena(&internal::GetEmptyStringAlreadyInited()); \
+ value.Destroy(); \
} \
template <typename Type> \
constexpr auto \
@@ -598,7 +598,7 @@
Type>::MapEntryAccessorType* \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::EnsureMutable( \
TypeOnMemory* value, Arena* arena) { \
- return value->Mutable(ArenaStringPtr::EmptyDefault{}, arena); \
+ return value->Mutable(arena); \
} \
template <typename Type> \
inline const typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc
index df614b9..3a1b67b 100644
--- a/src/google/protobuf/message_lite.cc
+++ b/src/google/protobuf/message_lite.cc
@@ -41,7 +41,6 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/parse_context.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
@@ -230,7 +229,7 @@
if (PROTOBUF_PREDICT_FALSE(!ptr)) return false;
ctx.BackUp(ptr);
if (!ctx.EndedAtEndOfStream()) {
- GOOGLE_DCHECK(ctx.LastTag() != 1); // We can't end on a pushed limit.
+ GOOGLE_DCHECK_NE(ctx.LastTag(), 1); // We can't end on a pushed limit.
if (ctx.IsExceedingLimit(ptr)) return false;
input->SetLastTag(ctx.LastTag());
} else {
diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc
index 141b4e0..10c4eee 100644
--- a/src/google/protobuf/message_unittest.inc
+++ b/src/google/protobuf/message_unittest.inc
@@ -419,6 +419,29 @@
TestUtil::ExpectAllFieldsSet(p.child().payload());
}
+TEST(MESSAGE_TEST_NAME, AllSetMethodsOnStringField) {
+ UNITTEST::TestAllTypes msg;
+
+
+ msg.set_optional_string("Asciiz");
+ EXPECT_EQ(msg.optional_string(), "Asciiz");
+
+ msg.set_optional_string("Length delimited", 6);
+ EXPECT_EQ(msg.optional_string(), "Length");
+
+ std::string value = "std::string value 1";
+ msg.set_optional_string(value);
+ EXPECT_EQ(msg.optional_string(), "std::string value 1");
+
+ value = "std::string value 2";
+ msg.set_optional_string(std::cref(value));
+ EXPECT_EQ(msg.optional_string(), "std::string value 2");
+
+ value = "std::string value 3";
+ msg.set_optional_string(std::move(value));
+ EXPECT_EQ(msg.optional_string(), "std::string value 3");
+}
+
TEST(MESSAGE_TEST_NAME, SuccessAfterParsingFailure) {
UNITTEST::NestedTestAllTypes o, p, q;
constexpr int kDepth = 5;
diff --git a/src/google/protobuf/parse_context.cc b/src/google/protobuf/parse_context.cc
index da42e87..edc8c5f 100644
--- a/src/google/protobuf/parse_context.cc
+++ b/src/google/protobuf/parse_context.cc
@@ -30,7 +30,6 @@
#include <google/protobuf/parse_context.h>
-#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/arenastring.h>
@@ -51,8 +50,8 @@
// Only call if at start of tag.
bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) {
constexpr int kSlopBytes = EpsCopyInputStream::kSlopBytes;
- GOOGLE_DCHECK(overrun >= 0);
- GOOGLE_DCHECK(overrun <= kSlopBytes);
+ GOOGLE_DCHECK_GE(overrun, 0);
+ GOOGLE_DCHECK_LE(overrun, kSlopBytes);
auto ptr = begin + overrun;
auto end = begin + kSlopBytes;
while (ptr < end) {
@@ -181,17 +180,17 @@
// if (ptr < limit_end_) return {ptr, false};
GOOGLE_DCHECK(limit_end_ == buffer_end_ + (std::min)(0, limit_));
// At this point we know the following assertion holds.
- GOOGLE_DCHECK(limit_ > 0);
+ GOOGLE_DCHECK_GT(limit_, 0);
GOOGLE_DCHECK(limit_end_ == buffer_end_); // because limit_ > 0
const char* p;
do {
// We are past the end of buffer_end_, in the slop region.
- GOOGLE_DCHECK(overrun >= 0);
+ GOOGLE_DCHECK_GE(overrun, 0);
p = NextBuffer(overrun, depth);
if (p == nullptr) {
// We are at the end of the stream
if (PROTOBUF_PREDICT_FALSE(overrun != 0)) return {nullptr, true};
- GOOGLE_DCHECK(limit_ > 0);
+ GOOGLE_DCHECK_GT(limit_, 0);
limit_end_ = buffer_end_;
// Distinguish ending on a pushed limit or ending on end-of-stream.
SetEndOfStream();
diff --git a/src/google/protobuf/reflection_ops.cc b/src/google/protobuf/reflection_ops.cc
index b267672..b9f8e4e 100644
--- a/src/google/protobuf/reflection_ops.cc
+++ b/src/google/protobuf/reflection_ops.cc
@@ -423,16 +423,16 @@
void GenericSwap(Message* lhs, Message* rhs) {
#ifndef PROTOBUF_FORCE_COPY_IN_SWAP
- GOOGLE_DCHECK(Arena::InternalHelper<Message>::GetOwningArena(lhs) !=
- Arena::InternalHelper<Message>::GetOwningArena(rhs));
- GOOGLE_DCHECK(Arena::InternalHelper<Message>::GetOwningArena(lhs) != nullptr ||
- Arena::InternalHelper<Message>::GetOwningArena(rhs) != nullptr);
+ GOOGLE_DCHECK(Arena::InternalGetOwningArena(lhs) !=
+ Arena::InternalGetOwningArena(rhs));
+ GOOGLE_DCHECK(Arena::InternalGetOwningArena(lhs) != nullptr ||
+ Arena::InternalGetOwningArena(rhs) != nullptr);
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
// At least one of these must have an arena, so make `rhs` point to it.
- Arena* arena = Arena::InternalHelper<Message>::GetOwningArena(rhs);
+ Arena* arena = Arena::InternalGetOwningArena(rhs);
if (arena == nullptr) {
std::swap(lhs, rhs);
- arena = Arena::InternalHelper<Message>::GetOwningArena(rhs);
+ arena = Arena::InternalGetOwningArena(rhs);
}
// Improve efficiency by placing the temporary on an arena so that messages
diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc
index ec691b1..9b5785c 100644
--- a/src/google/protobuf/source_context.pb.cc
+++ b/src/google/protobuf/source_context.pb.cc
@@ -97,10 +97,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
file_name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ file_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_file_name().empty()) {
- file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_file_name(),
+ file_name_.Set(from._internal_file_name(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext)
@@ -109,7 +109,7 @@
inline void SourceContext::SharedCtor() {
file_name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ file_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
@@ -124,7 +124,7 @@
inline void SourceContext::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- file_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ file_name_.Destroy();
}
void SourceContext::SetCachedSize(int size) const {
@@ -264,7 +264,6 @@
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&file_name_, lhs_arena,
&other->file_name_, rhs_arena
);
diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h
index bf0bae9..5bdc1ed 100644
--- a/src/google/protobuf/source_context.pb.h
+++ b/src/google/protobuf/source_context.pb.h
@@ -225,7 +225,7 @@
inline PROTOBUF_ALWAYS_INLINE
void SourceContext::set_file_name(ArgT0&& arg0, ArgT... args) {
- file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ file_name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name)
}
inline std::string* SourceContext::mutable_file_name() {
@@ -238,15 +238,15 @@
}
inline void SourceContext::_internal_set_file_name(const std::string& value) {
- file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ file_name_.Set(value, GetArenaForAllocation());
}
inline std::string* SourceContext::_internal_mutable_file_name() {
- return file_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return file_name_.Mutable(GetArenaForAllocation());
}
inline std::string* SourceContext::release_file_name() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceContext.file_name)
- return file_name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return file_name_.Release();
}
inline void SourceContext::set_allocated_file_name(std::string* file_name) {
if (file_name != nullptr) {
@@ -254,11 +254,10 @@
} else {
}
- file_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), file_name,
- GetArenaForAllocation());
+ file_name_.SetAllocated(file_name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (file_name_.IsDefault()) {
- file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ file_name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name)
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc
index 69933f2..bcd280a 100644
--- a/src/google/protobuf/struct.pb.cc
+++ b/src/google/protobuf/struct.pb.cc
@@ -416,7 +416,7 @@
clear_kind();
if (struct_value) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::Struct>::GetOwningArena(struct_value);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(struct_value);
if (message_arena != submessage_arena) {
struct_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, struct_value, submessage_arena);
@@ -431,7 +431,7 @@
clear_kind();
if (list_value) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::ListValue>::GetOwningArena(list_value);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(list_value);
if (message_arena != submessage_arena) {
list_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, list_value, submessage_arena);
@@ -519,7 +519,7 @@
break;
}
case kStringValue: {
- kind_.string_value_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ kind_.string_value_.Destroy();
break;
}
case kBoolValue: {
diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h
index 12ac91c..89c835b 100644
--- a/src/google/protobuf/struct.pb.h
+++ b/src/google/protobuf/struct.pb.h
@@ -828,7 +828,7 @@
}
inline void Value::clear_string_value() {
if (_internal_has_string_value()) {
- kind_.string_value_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ kind_.string_value_.Destroy();
clear_has_kind();
}
}
@@ -843,7 +843,7 @@
set_has_string_value();
kind_.string_value_.InitDefault();
}
- kind_.string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ kind_.string_value_.Set( static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
}
inline std::string* Value::mutable_string_value() {
@@ -863,7 +863,7 @@
set_has_string_value();
kind_.string_value_.InitDefault();
}
- kind_.string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ kind_.string_value_.Set(value, GetArenaForAllocation());
}
inline std::string* Value::_internal_mutable_string_value() {
if (!_internal_has_string_value()) {
@@ -871,14 +871,13 @@
set_has_string_value();
kind_.string_value_.InitDefault();
}
- return kind_.string_value_.Mutable(
- ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return kind_.string_value_.Mutable( GetArenaForAllocation());
}
inline std::string* Value::release_string_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.string_value)
if (_internal_has_string_value()) {
clear_has_kind();
- return kind_.string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return kind_.string_value_.Release();
} else {
return nullptr;
}
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc
index 8c61d1b..5b1067c 100644
--- a/src/google/protobuf/type.pb.cc
+++ b/src/google/protobuf/type.pb.cc
@@ -376,10 +376,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
if (from._internal_has_source_context()) {
@@ -394,7 +394,7 @@
inline void Type::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
@@ -413,7 +413,7 @@
inline void Type::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
if (this != internal_default_instance()) delete source_context_;
}
@@ -707,7 +707,6 @@
oneofs_.InternalSwap(&other->oneofs_);
options_.InternalSwap(&other->options_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
@@ -744,34 +743,34 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_type_url().empty()) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(),
+ type_url_.Set(from._internal_type_url(),
GetArenaForAllocation());
}
json_name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ json_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_json_name().empty()) {
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(),
+ json_name_.Set(from._internal_json_name(),
GetArenaForAllocation());
}
default_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ default_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_default_value().empty()) {
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(),
+ default_value_.Set(from._internal_default_value(),
GetArenaForAllocation());
}
::memcpy(&kind_, &from.kind_,
@@ -783,19 +782,19 @@
inline void Field::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
json_name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ json_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
default_value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ default_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&kind_) - reinterpret_cast<char*>(this)),
@@ -814,10 +813,10 @@
inline void Field::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- json_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- default_value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
+ type_url_.Destroy();
+ json_name_.Destroy();
+ default_value_.Destroy();
}
void Field::SetCachedSize(int size) const {
@@ -1200,22 +1199,18 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
options_.InternalSwap(&other->options_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&type_url_, lhs_arena,
&other->type_url_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&json_name_, lhs_arena,
&other->json_name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&default_value_, lhs_arena,
&other->default_value_, rhs_arena
);
@@ -1265,10 +1260,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
if (from._internal_has_source_context()) {
@@ -1283,7 +1278,7 @@
inline void Enum::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
@@ -1302,7 +1297,7 @@
inline void Enum::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
if (this != internal_default_instance()) delete source_context_;
}
@@ -1560,7 +1555,6 @@
enumvalue_.InternalSwap(&other->enumvalue_);
options_.InternalSwap(&other->options_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
@@ -1597,10 +1591,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
number_ = from.number_;
@@ -1610,7 +1604,7 @@
inline void EnumValue::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
number_ = 0;
}
@@ -1626,7 +1620,7 @@
inline void EnumValue::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
}
void EnumValue::SetCachedSize(int size) const {
@@ -1820,7 +1814,6 @@
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
options_.InternalSwap(&other->options_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
@@ -1861,10 +1854,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
+ name_.Set(from._internal_name(),
GetArenaForAllocation());
}
if (from._internal_has_value()) {
@@ -1878,7 +1871,7 @@
inline void Option::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_ = nullptr;
}
@@ -1894,7 +1887,7 @@
inline void Option::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ name_.Destroy();
if (this != internal_default_instance()) delete value_;
}
@@ -2064,7 +2057,6 @@
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, lhs_arena,
&other->name_, rhs_arena
);
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index 36fa70d..d1d4d50 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -1370,7 +1370,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Type::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Type.name)
}
inline std::string* Type::mutable_name() {
@@ -1383,15 +1383,15 @@
}
inline void Type::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* Type::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* Type::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Type.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return name_.Release();
}
inline void Type::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1399,11 +1399,10 @@
} else {
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name)
@@ -1635,8 +1634,7 @@
}
if (source_context) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
- ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context));
if (message_arena != submessage_arena) {
source_context = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
@@ -1746,7 +1744,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Field::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Field.name)
}
inline std::string* Field::mutable_name() {
@@ -1759,15 +1757,15 @@
}
inline void Field::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* Field::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* Field::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Field.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return name_.Release();
}
inline void Field::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1775,11 +1773,10 @@
} else {
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name)
@@ -1797,7 +1794,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Field::set_type_url(ArgT0&& arg0, ArgT... args) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Field.type_url)
}
inline std::string* Field::mutable_type_url() {
@@ -1810,15 +1807,15 @@
}
inline void Field::_internal_set_type_url(const std::string& value) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ type_url_.Set(value, GetArenaForAllocation());
}
inline std::string* Field::_internal_mutable_type_url() {
- return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return type_url_.Mutable(GetArenaForAllocation());
}
inline std::string* Field::release_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Field.type_url)
- return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return type_url_.Release();
}
inline void Field::set_allocated_type_url(std::string* type_url) {
if (type_url != nullptr) {
@@ -1826,11 +1823,10 @@
} else {
}
- type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
- GetArenaForAllocation());
+ type_url_.SetAllocated(type_url, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (type_url_.IsDefault()) {
- type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ type_url_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url)
@@ -1928,7 +1924,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Field::set_json_name(ArgT0&& arg0, ArgT... args) {
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ json_name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Field.json_name)
}
inline std::string* Field::mutable_json_name() {
@@ -1941,15 +1937,15 @@
}
inline void Field::_internal_set_json_name(const std::string& value) {
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ json_name_.Set(value, GetArenaForAllocation());
}
inline std::string* Field::_internal_mutable_json_name() {
- return json_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return json_name_.Mutable(GetArenaForAllocation());
}
inline std::string* Field::release_json_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Field.json_name)
- return json_name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return json_name_.Release();
}
inline void Field::set_allocated_json_name(std::string* json_name) {
if (json_name != nullptr) {
@@ -1957,11 +1953,10 @@
} else {
}
- json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name,
- GetArenaForAllocation());
+ json_name_.SetAllocated(json_name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (json_name_.IsDefault()) {
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ json_name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name)
@@ -1979,7 +1974,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Field::set_default_value(ArgT0&& arg0, ArgT... args) {
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ default_value_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Field.default_value)
}
inline std::string* Field::mutable_default_value() {
@@ -1992,15 +1987,15 @@
}
inline void Field::_internal_set_default_value(const std::string& value) {
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ default_value_.Set(value, GetArenaForAllocation());
}
inline std::string* Field::_internal_mutable_default_value() {
- return default_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return default_value_.Mutable(GetArenaForAllocation());
}
inline std::string* Field::release_default_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Field.default_value)
- return default_value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return default_value_.Release();
}
inline void Field::set_allocated_default_value(std::string* default_value) {
if (default_value != nullptr) {
@@ -2008,11 +2003,10 @@
} else {
}
- default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value,
- GetArenaForAllocation());
+ default_value_.SetAllocated(default_value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (default_value_.IsDefault()) {
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ default_value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value)
@@ -2034,7 +2028,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Enum::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Enum.name)
}
inline std::string* Enum::mutable_name() {
@@ -2047,15 +2041,15 @@
}
inline void Enum::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* Enum::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* Enum::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Enum.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return name_.Release();
}
inline void Enum::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -2063,11 +2057,10 @@
} else {
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name)
@@ -2224,8 +2217,7 @@
}
if (source_context) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
- ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context));
if (message_arena != submessage_arena) {
source_context = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
@@ -2275,7 +2267,7 @@
inline PROTOBUF_ALWAYS_INLINE
void EnumValue::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name)
}
inline std::string* EnumValue::mutable_name() {
@@ -2288,15 +2280,15 @@
}
inline void EnumValue::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* EnumValue::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* EnumValue::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumValue.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return name_.Release();
}
inline void EnumValue::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -2304,11 +2296,10 @@
} else {
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name)
@@ -2390,7 +2381,7 @@
inline PROTOBUF_ALWAYS_INLINE
void Option::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Option.name)
}
inline std::string* Option::mutable_name() {
@@ -2403,15 +2394,15 @@
}
inline void Option::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ name_.Set(value, GetArenaForAllocation());
}
inline std::string* Option::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return name_.Mutable(GetArenaForAllocation());
}
inline std::string* Option::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Option.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return name_.Release();
}
inline void Option::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -2419,11 +2410,10 @@
} else {
}
- name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArenaForAllocation());
+ name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name)
@@ -2500,8 +2490,7 @@
}
if (value) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
- ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(value));
if (message_arena != submessage_arena) {
value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc
index 5252577..5ab1ca1 100644
--- a/src/google/protobuf/wire_format_lite.cc
+++ b/src/google/protobuf/wire_format_lite.cc
@@ -41,10 +41,10 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
+#include <google/protobuf/stubs/stringprintf.h>
// Must be included last.
diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc
index 24aafb3..57f7da3 100644
--- a/src/google/protobuf/wrappers.pb.cc
+++ b/src/google/protobuf/wrappers.pb.cc
@@ -1492,10 +1492,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_value().empty()) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
+ value_.Set(from._internal_value(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue)
@@ -1504,7 +1504,7 @@
inline void StringValue::SharedCtor() {
value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
@@ -1519,7 +1519,7 @@
inline void StringValue::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ value_.Destroy();
}
void StringValue::SetCachedSize(int size) const {
@@ -1659,7 +1659,6 @@
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&value_, lhs_arena,
&other->value_, rhs_arena
);
@@ -1688,10 +1687,10 @@
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_value().empty()) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
+ value_.Set(from._internal_value(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue)
@@ -1700,7 +1699,7 @@
inline void BytesValue::SharedCtor() {
value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
@@ -1715,7 +1714,7 @@
inline void BytesValue::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ value_.Destroy();
}
void BytesValue::SetCachedSize(int size) const {
@@ -1850,7 +1849,6 @@
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&value_, lhs_arena,
&other->value_, rhs_arena
);
diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h
index fc4fa5e..8479fc5 100644
--- a/src/google/protobuf/wrappers.pb.h
+++ b/src/google/protobuf/wrappers.pb.h
@@ -1574,7 +1574,7 @@
inline PROTOBUF_ALWAYS_INLINE
void StringValue::set_value(ArgT0&& arg0, ArgT... args) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ value_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.StringValue.value)
}
inline std::string* StringValue::mutable_value() {
@@ -1587,15 +1587,15 @@
}
inline void StringValue::_internal_set_value(const std::string& value) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ value_.Set(value, GetArenaForAllocation());
}
inline std::string* StringValue::_internal_mutable_value() {
- return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return value_.Mutable(GetArenaForAllocation());
}
inline std::string* StringValue::release_value() {
// @@protoc_insertion_point(field_release:google.protobuf.StringValue.value)
- return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return value_.Release();
}
inline void StringValue::set_allocated_value(std::string* value) {
if (value != nullptr) {
@@ -1603,11 +1603,10 @@
} else {
}
- value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
- GetArenaForAllocation());
+ value_.SetAllocated(value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (value_.IsDefault()) {
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value)
@@ -1629,7 +1628,7 @@
inline PROTOBUF_ALWAYS_INLINE
void BytesValue::set_value(ArgT0&& arg0, ArgT... args) {
- value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ value_.SetBytes(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value)
}
inline std::string* BytesValue::mutable_value() {
@@ -1642,15 +1641,15 @@
}
inline void BytesValue::_internal_set_value(const std::string& value) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ value_.Set(value, GetArenaForAllocation());
}
inline std::string* BytesValue::_internal_mutable_value() {
- return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return value_.Mutable(GetArenaForAllocation());
}
inline std::string* BytesValue::release_value() {
// @@protoc_insertion_point(field_release:google.protobuf.BytesValue.value)
- return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return value_.Release();
}
inline void BytesValue::set_allocated_value(std::string* value) {
if (value != nullptr) {
@@ -1658,11 +1657,10 @@
} else {
}
- value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
- GetArenaForAllocation());
+ value_.SetAllocated(value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (value_.IsDefault()) {
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value)
diff --git a/tests.sh b/tests.sh
index 290f110..8ea5ae6 100755
--- a/tests.sh
+++ b/tests.sh
@@ -116,12 +116,12 @@
# Try to install Java
pushd java
- use_java jdk8
+ use_java jdk11
$MVN install
popd
# Try to install Python
- virtualenv --no-site-packages venv
+ python3 -m venv venv
source venv/bin/activate
pushd python
python3 setup.py clean build sdist
@@ -189,6 +189,10 @@
use_java() {
version=$1
case "$version" in
+ jdk11)
+ export PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH
+ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
+ ;;
jdk8)
export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
@@ -268,7 +272,7 @@
# Linkage Monitor checks compatibility with other Google libraries
# https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor
- use_java jdk8
+ use_java jdk11
internal_build_cpp
# Linkage Monitor uses $HOME/.m2 local repository
@@ -330,12 +334,7 @@
build_python() {
internal_build_cpp
cd python
- if [ $(uname -s) == "Linux" ]; then
- envlist=py\{35,36\}-python
- else
- envlist=py\{36\}-python
- fi
- python -m tox -e $envlist
+ tox --skip-missing-interpreters
cd ..
}
@@ -343,26 +342,10 @@
internal_build_cpp
cd python
envlist=$1
- python -m tox -e $envlist
+ tox -e $envlist
cd ..
}
-build_python33() {
- build_python_version py33-python
-}
-
-build_python34() {
- build_python_version py34-python
-}
-
-build_python35() {
- build_python_version py35-python
-}
-
-build_python36() {
- build_python_version py36-python
-}
-
build_python37() {
build_python_version py37-python
}
@@ -384,12 +367,7 @@
export LD_LIBRARY_PATH=../src/.libs # for Linux
export DYLD_LIBRARY_PATH=../src/.libs # for OS X
cd python
- if [ $(uname -s) == "Linux" ]; then
- envlist=py\{35,36\}-cpp
- else
- envlist=py\{36\}-cpp
- fi
- tox -e $envlist
+ tox --skip-missing-interpreters
cd ..
}
@@ -403,22 +381,6 @@
cd ..
}
-build_python33_cpp() {
- build_python_cpp_version py33-cpp
-}
-
-build_python34_cpp() {
- build_python_cpp_version py34-cpp
-}
-
-build_python35_cpp() {
- build_python_cpp_version py35-cpp
-}
-
-build_python36_cpp() {
- build_python_cpp_version py36-cpp
-}
-
build_python37_cpp() {
build_python_cpp_version py37-cpp
}
@@ -496,6 +458,8 @@
use_php $1
pushd php
rm -rf vendor
+ php -v
+ php -m
composer update
composer test
popd
@@ -505,6 +469,8 @@
test_php_c() {
pushd php
rm -rf vendor
+ php -v
+ php -m
composer update
composer test_c
popd
@@ -572,7 +538,9 @@
build_php8.0_all() {
build_php 8.0
+ build_php 8.1
build_php_c 8.0
+ build_php_c 8.1
}
build_php_all_32() {
diff --git a/update_version.py b/update_version.py
index 2c2b489..6e89555 100755
--- a/update_version.py
+++ b/update_version.py
@@ -61,6 +61,19 @@
return '%s%s%s' % (NEW_VERSION, rc_suffix, RC_VERSION)
+def GetSharedObjectVersion():
+ protobuf_version_offset = 11
+ expected_major_version = 3
+ if NEW_VERSION_INFO[0] != expected_major_version:
+ print("""[ERROR] Major protobuf version has changed. Please update
+update_version.py to readjust the protobuf_version_offset and
+expected_major_version such that the PROTOBUF_VERSION in src/Makefile.am is
+always increasing.
+ """)
+ exit(1)
+ return [NEW_VERSION_INFO[1] + protobuf_version_offset, NEW_VERSION_INFO[2], 0]
+
+
def RewriteXml(filename, rewriter, add_xml_prefix=True):
document = minidom.parse(filename)
rewriter(document)
@@ -89,6 +102,14 @@
f.close()
+def UpdateCMake():
+ RewriteTextFile('cmake/libprotobuf.cmake',
+ lambda line : re.sub(
+ r'SOVERSION [0-9]+\.[0-9]+(\.[0-9]+)?',
+ 'SOVERSION %s' % GetSharedObjectVersion()[0],
+ line))
+
+
def UpdateConfigure():
RewriteTextFile('configure.ac',
lambda line : re.sub(
@@ -270,22 +291,10 @@
def UpdateMakefile():
- protobuf_version_offset = 11
- expected_major_version = 3
- if NEW_VERSION_INFO[0] != expected_major_version:
- print("""[ERROR] Major protobuf version has changed. Please update
-update_version.py to readjust the protobuf_version_offset and
-expected_major_version such that the PROTOBUF_VERSION in src/Makefile.am is
-always increasing.
- """)
- exit(1)
-
- protobuf_version_info = '%d:%d:0' % (
- NEW_VERSION_INFO[1] + protobuf_version_offset, NEW_VERSION_INFO[2])
RewriteTextFile('src/Makefile.am',
lambda line : re.sub(
r'^PROTOBUF_VERSION = .*$',
- 'PROTOBUF_VERSION = %s' % protobuf_version_info,
+ 'PROTOBUF_VERSION = %s' % ":".join(map(str,GetSharedObjectVersion())),
line))
@@ -397,6 +406,7 @@
line))
+UpdateCMake()
UpdateConfigure()
UpdateCsharp()
UpdateCpp()