diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc index 236a0e2102..74550b845e 100644 --- a/conformance/binary_json_conformance_suite.cc +++ b/conformance/binary_json_conformance_suite.cc @@ -157,16 +157,16 @@ enum class Packed { FALSE = 2, }; -const FieldDescriptor* GetFieldForType( - FieldDescriptor::Type type, bool repeated, bool is_proto3, - Packed packed = Packed::UNSPECIFIED) { +const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type, + bool repeated, bool is_proto3, + Packed packed = Packed::UNSPECIFIED) { const Descriptor* d = is_proto3 ? TestAllTypesProto3().GetDescriptor() : TestAllTypesProto2().GetDescriptor(); for (int i = 0; i < d->field_count(); i++) { const FieldDescriptor* f = d->field(i); if (f->type() == type && f->is_repeated() == repeated) { - if (packed == Packed::TRUE && !f->is_packed() || - packed == Packed::FALSE && f->is_packed()) { + if ((packed == Packed::TRUE && !f->is_packed()) || + (packed == Packed::FALSE && f->is_packed())) { continue; } return f; @@ -183,10 +183,8 @@ const FieldDescriptor* GetFieldForType( packed_string = "Unpacked "; } GOOGLE_LOG(FATAL) << "Couldn't find field with type: " - << repeated_string.c_str() - << packed_string.c_str() - << FieldDescriptor::TypeName(type) - << " for " + << repeated_string.c_str() << packed_string.c_str() + << FieldDescriptor::TypeName(type) << " for " << proto_string.c_str(); return nullptr; } @@ -396,14 +394,13 @@ void BinaryAndJsonConformanceSuite::RunValidProtobufTest( void BinaryAndJsonConformanceSuite::RunValidBinaryProtobufTest( const string& test_name, ConformanceLevel level, const string& input_protobuf, bool is_proto3) { - RunValidBinaryProtobufTest( - test_name, level, input_protobuf, input_protobuf, is_proto3); + RunValidBinaryProtobufTest(test_name, level, input_protobuf, input_protobuf, + is_proto3); } void BinaryAndJsonConformanceSuite::RunValidBinaryProtobufTest( const string& test_name, ConformanceLevel level, - const string& input_protobuf, - const string& expected_protobuf, + const string& input_protobuf, const string& expected_protobuf, bool is_proto3) { std::unique_ptr prototype = NewTestMessage(is_proto3); ConformanceRequestSetting setting( @@ -625,8 +622,7 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( // Test singular data for singular fields. for (size_t i = 0; i < values.size(); i++) { - string proto = - cat(tag(field->number(), wire_type), values[i].first); + string proto = cat(tag(field->number(), wire_type), values[i].first); string expected_proto = cat(tag(field->number(), wire_type), values[i].second); std::unique_ptr test_message = NewTestMessage(is_proto3); @@ -690,18 +686,15 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( unpacked_proto_expected += cat(tag(unpacked_field->number(), wire_type), values[i].second); } - default_proto_packed = - cat(tag(rep_field->number(), - WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(default_proto_packed)); - default_proto_packed_expected = - cat(tag(rep_field->number(), - WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(default_proto_packed_expected)); - packed_proto_packed = - cat(tag(packed_field->number(), - WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(packed_proto_packed)); + default_proto_packed = cat( + tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(default_proto_packed)); + default_proto_packed_expected = cat( + tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(default_proto_packed_expected)); + packed_proto_packed = cat(tag(packed_field->number(), + WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(packed_proto_packed)); packed_proto_expected = cat(tag(packed_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), @@ -711,60 +704,44 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( WireFormatLite::WIRETYPE_LENGTH_DELIMITED), delim(unpacked_proto_packed)); - std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(default_proto_packed_expected); string text = test_message->DebugString(); // Ensures both packed and unpacked data can be parsed. RunValidProtobufTest( - StrCat("ValidDataRepeated", type_name, ".UnpackedInput"), - REQUIRED, default_proto_unpacked, text, is_proto3); + StrCat("ValidDataRepeated", type_name, ".UnpackedInput"), REQUIRED, + default_proto_unpacked, text, is_proto3); RunValidProtobufTest( - StrCat("ValidDataRepeated", type_name, ".PackedInput"), - REQUIRED, default_proto_packed, text, is_proto3); + StrCat("ValidDataRepeated", type_name, ".PackedInput"), REQUIRED, + default_proto_packed, text, is_proto3); // proto2 should encode as unpacked by default and proto3 should encode as // packed by default. - string expected_proto = - rep_field->is_packed() ? default_proto_packed_expected : - default_proto_unpacked_expected; - RunValidBinaryProtobufTest( - StrCat("ValidDataRepeated", type_name, - ".UnpackedInput.DefaultOutput"), - RECOMMENDED, - default_proto_unpacked, - expected_proto, is_proto3); + string expected_proto = rep_field->is_packed() + ? default_proto_packed_expected + : default_proto_unpacked_expected; + RunValidBinaryProtobufTest(StrCat("ValidDataRepeated", type_name, + ".UnpackedInput.DefaultOutput"), + RECOMMENDED, default_proto_unpacked, + expected_proto, is_proto3); RunValidBinaryProtobufTest( - StrCat("ValidDataRepeated", type_name, - ".PackedInput.DefaultOutput"), - RECOMMENDED, - default_proto_packed, - expected_proto, is_proto3); + StrCat("ValidDataRepeated", type_name, ".PackedInput.DefaultOutput"), + RECOMMENDED, default_proto_packed, expected_proto, is_proto3); RunValidBinaryProtobufTest( - StrCat("ValidDataRepeated", type_name, - ".UnpackedInput.PackedOutput"), - RECOMMENDED, - packed_proto_unpacked, - packed_proto_expected, is_proto3); + StrCat("ValidDataRepeated", type_name, ".UnpackedInput.PackedOutput"), + RECOMMENDED, packed_proto_unpacked, packed_proto_expected, is_proto3); RunValidBinaryProtobufTest( - StrCat("ValidDataRepeated", type_name, - ".PackedInput.PackedOutput"), - RECOMMENDED, - packed_proto_packed, - packed_proto_expected, is_proto3); + StrCat("ValidDataRepeated", type_name, ".PackedInput.PackedOutput"), + RECOMMENDED, packed_proto_packed, packed_proto_expected, is_proto3); + RunValidBinaryProtobufTest(StrCat("ValidDataRepeated", type_name, + ".UnpackedInput.UnpackedOutput"), + RECOMMENDED, unpacked_proto_unpacked, + unpacked_proto_expected, is_proto3); RunValidBinaryProtobufTest( - StrCat("ValidDataRepeated", type_name, - ".UnpackedInput.UnpackedOutput"), - RECOMMENDED, - unpacked_proto_unpacked, - unpacked_proto_expected, is_proto3); - RunValidBinaryProtobufTest( - StrCat("ValidDataRepeated", type_name, - ".PackedInput.UnpackedOutput"), - RECOMMENDED, - unpacked_proto_packed, - unpacked_proto_expected, is_proto3); + StrCat("ValidDataRepeated", type_name, ".PackedInput.UnpackedOutput"), + RECOMMENDED, unpacked_proto_packed, unpacked_proto_expected, + is_proto3); } else { string proto; string expected_proto; @@ -777,27 +754,24 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( test_message->MergeFromString(expected_proto); string text = test_message->DebugString(); - RunValidProtobufTest( - StrCat("ValidDataRepeated", type_name), - REQUIRED, proto, text, is_proto3); + RunValidProtobufTest(StrCat("ValidDataRepeated", type_name), REQUIRED, + proto, text, is_proto3); } } } void BinaryAndJsonConformanceSuite::TestValidDataForRepeatedScalarMessage() { std::vector values = { - delim(cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat( - tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234), + delim(cat( + tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234), tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1234), - tag(31, WireFormatLite::WIRETYPE_VARINT), varint(1234) - )))), - delim(cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat( - tag(1, WireFormatLite::WIRETYPE_VARINT), varint(4321), + tag(31, WireFormatLite::WIRETYPE_VARINT), varint(1234))))), + delim(cat( + tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(4321), tag(3, WireFormatLite::WIRETYPE_VARINT), varint(4321), - tag(31, WireFormatLite::WIRETYPE_VARINT), varint(4321) - )))), + tag(31, WireFormatLite::WIRETYPE_VARINT), varint(4321))))), }; const std::string expected = @@ -820,9 +794,8 @@ void BinaryAndJsonConformanceSuite::TestValidDataForRepeatedScalarMessage() { values[i]); } - RunValidProtobufTest( - "RepeatedScalarMessageMerge", REQUIRED, proto, - field->name() + ": " + expected, is_proto3); + RunValidProtobufTest("RepeatedScalarMessageMerge", REQUIRED, proto, + field->name() + ": " + expected, is_proto3); } } @@ -920,107 +893,106 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() { int32 kInt32Min = -2147483648; uint32 kUint32Max = 4294967295UL; - TestValidDataForType(FieldDescriptor::TYPE_DOUBLE, { - {dbl(0.1), dbl(0.1)}, - {dbl(1.7976931348623157e+308), dbl(1.7976931348623157e+308)}, - {dbl(2.22507385850720138309e-308), dbl(2.22507385850720138309e-308)} - }); - TestValidDataForType(FieldDescriptor::TYPE_FLOAT, { - {flt(0.1), flt(0.1)}, - {flt(1.00000075e-36), flt(1.00000075e-36)}, - {flt(3.402823e+38), flt(3.402823e+38)}, // 3.40282347e+38 - {flt(1.17549435e-38f), flt(1.17549435e-38)} - }); - TestValidDataForType(FieldDescriptor::TYPE_INT64, { - {varint(12345), varint(12345)}, - {varint(kInt64Max), varint(kInt64Max)}, - {varint(kInt64Min), varint(kInt64Min)} - }); - TestValidDataForType(FieldDescriptor::TYPE_UINT64, { - {varint(12345), varint(12345)}, - {varint(kUint64Max), varint(kUint64Max)}, - {varint(0), varint(0)} - }); - TestValidDataForType(FieldDescriptor::TYPE_INT32, { - {varint(12345), varint(12345)}, - {longvarint(12345, 2), varint(12345)}, - {longvarint(12345, 7), varint(12345)}, - {varint(kInt32Max), varint(kInt32Max)}, - {varint(kInt32Min), varint(kInt32Min)}, - {varint(1LL << 33), varint(0)}, - {varint((1LL << 33) - 1), varint(-1)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_UINT32, { - {varint(12345), varint(12345)}, - {longvarint(12345, 2), varint(12345)}, - {longvarint(12345, 7), varint(12345)}, - {varint(kUint32Max), varint(kUint32Max)}, // UINT32_MAX - {varint(0), varint(0)}, - {varint(1LL << 33), varint(0)}, - {varint((1LL << 33) - 1), varint((1LL << 32) - 1)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_FIXED64, { - {u64(12345), u64(12345)}, - {u64(kUint64Max), u64(kUint64Max)}, - {u64(0), u64(0)} - }); - TestValidDataForType(FieldDescriptor::TYPE_FIXED32, { - {u32(12345), u32(12345)}, - {u32(kUint32Max), u32(kUint32Max)}, // UINT32_MAX - {u32(0), u32(0)} - }); - TestValidDataForType(FieldDescriptor::TYPE_SFIXED64, { - {u64(12345), u64(12345)}, - {u64(kInt64Max), u64(kInt64Max)}, - {u64(kInt64Min), u64(kInt64Min)} - }); - TestValidDataForType(FieldDescriptor::TYPE_SFIXED32, { - {u32(12345), u32(12345)}, - {u32(kInt32Max), u32(kInt32Max)}, - {u32(kInt32Min), u32(kInt32Min)} - }); - TestValidDataForType(FieldDescriptor::TYPE_BOOL, { - {varint(1), varint(1)}, - {varint(0), varint(0)}, - {varint(12345678), varint(1)} - }); - TestValidDataForType(FieldDescriptor::TYPE_SINT32, { - {zz32(12345), zz32(12345)}, - {zz32(kInt32Max), zz32(kInt32Max)}, - {zz32(kInt32Min), zz32(kInt32Min)} - }); - TestValidDataForType(FieldDescriptor::TYPE_SINT64, { - {zz64(12345), zz64(12345)}, - {zz64(kInt64Max), zz64(kInt64Max)}, - {zz64(kInt64Min), zz64(kInt64Min)} - }); - TestValidDataForType(FieldDescriptor::TYPE_STRING, { - {delim("Hello world!"), delim("Hello world!")}, - {delim("\'\"\?\\\a\b\f\n\r\t\v"), - delim("\'\"\?\\\a\b\f\n\r\t\v")}, // escape - {delim("谷歌"), delim("谷歌")}, // Google in Chinese - {delim("\u8C37\u6B4C"), delim("谷歌")}, // unicode escape - {delim("\u8c37\u6b4c"), delim("谷歌")}, // lowercase unicode - {delim("\xF0\x9F\x98\x81"), delim("\xF0\x9F\x98\x81")}, // emoji: 😁 - {delim(""), delim("")}, - }); - TestValidDataForType(FieldDescriptor::TYPE_BYTES, { - {delim("\x01\x02"), delim("\x01\x02")}, - {delim("\xfb"), delim("\xfb")}, - {delim(""), delim("")}, - }); + TestValidDataForType( + FieldDescriptor::TYPE_DOUBLE, + {{dbl(0.1), dbl(0.1)}, + {dbl(1.7976931348623157e+308), dbl(1.7976931348623157e+308)}, + {dbl(2.22507385850720138309e-308), dbl(2.22507385850720138309e-308)}}); + TestValidDataForType( + FieldDescriptor::TYPE_FLOAT, + {{flt(0.1), flt(0.1)}, + {flt(1.00000075e-36), flt(1.00000075e-36)}, + {flt(3.402823e+38), flt(3.402823e+38)}, // 3.40282347e+38 + {flt(1.17549435e-38f), flt(1.17549435e-38)}}); + TestValidDataForType(FieldDescriptor::TYPE_INT64, + {{varint(12345), varint(12345)}, + {varint(kInt64Max), varint(kInt64Max)}, + {varint(kInt64Min), varint(kInt64Min)}}); + TestValidDataForType(FieldDescriptor::TYPE_UINT64, + {{varint(12345), varint(12345)}, + {varint(kUint64Max), varint(kUint64Max)}, + {varint(0), varint(0)}}); + TestValidDataForType(FieldDescriptor::TYPE_INT32, + { + {varint(12345), varint(12345)}, + {longvarint(12345, 2), varint(12345)}, + {longvarint(12345, 7), varint(12345)}, + {varint(kInt32Max), varint(kInt32Max)}, + {varint(kInt32Min), varint(kInt32Min)}, + {varint(1LL << 33), varint(0)}, + {varint((1LL << 33) - 1), varint(-1)}, + }); + TestValidDataForType( + FieldDescriptor::TYPE_UINT32, + { + {varint(12345), varint(12345)}, + {longvarint(12345, 2), varint(12345)}, + {longvarint(12345, 7), varint(12345)}, + {varint(kUint32Max), varint(kUint32Max)}, // UINT32_MAX + {varint(0), varint(0)}, + {varint(1LL << 33), varint(0)}, + {varint((1LL << 33) - 1), varint((1LL << 32) - 1)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_FIXED64, + {{u64(12345), u64(12345)}, + {u64(kUint64Max), u64(kUint64Max)}, + {u64(0), u64(0)}}); + TestValidDataForType(FieldDescriptor::TYPE_FIXED32, + {{u32(12345), u32(12345)}, + {u32(kUint32Max), u32(kUint32Max)}, // UINT32_MAX + {u32(0), u32(0)}}); + TestValidDataForType(FieldDescriptor::TYPE_SFIXED64, + {{u64(12345), u64(12345)}, + {u64(kInt64Max), u64(kInt64Max)}, + {u64(kInt64Min), u64(kInt64Min)}}); + TestValidDataForType(FieldDescriptor::TYPE_SFIXED32, + {{u32(12345), u32(12345)}, + {u32(kInt32Max), u32(kInt32Max)}, + {u32(kInt32Min), u32(kInt32Min)}}); + TestValidDataForType(FieldDescriptor::TYPE_BOOL, + {{varint(1), varint(1)}, + {varint(0), varint(0)}, + {varint(12345678), varint(1)}}); + TestValidDataForType(FieldDescriptor::TYPE_SINT32, + {{zz32(12345), zz32(12345)}, + {zz32(kInt32Max), zz32(kInt32Max)}, + {zz32(kInt32Min), zz32(kInt32Min)}}); + TestValidDataForType(FieldDescriptor::TYPE_SINT64, + {{zz64(12345), zz64(12345)}, + {zz64(kInt64Max), zz64(kInt64Max)}, + {zz64(kInt64Min), zz64(kInt64Min)}}); + TestValidDataForType( + FieldDescriptor::TYPE_STRING, + { + {delim("Hello world!"), delim("Hello world!")}, + {delim("\'\"\?\\\a\b\f\n\r\t\v"), + delim("\'\"\?\\\a\b\f\n\r\t\v")}, // escape + {delim("谷歌"), delim("谷歌")}, // Google in Chinese + {delim("\u8C37\u6B4C"), delim("谷歌")}, // unicode escape + {delim("\u8c37\u6b4c"), delim("谷歌")}, // lowercase unicode + {delim("\xF0\x9F\x98\x81"), delim("\xF0\x9F\x98\x81")}, // emoji: 😁 + {delim(""), delim("")}, + }); + TestValidDataForType(FieldDescriptor::TYPE_BYTES, + { + {delim("\x01\x02"), delim("\x01\x02")}, + {delim("\xfb"), delim("\xfb")}, + {delim(""), delim("")}, + }); TestValidDataForType(FieldDescriptor::TYPE_ENUM, { - {varint(0), varint(0)}, - {varint(1), varint(1)}, - {varint(2), varint(2)}, - {varint(-1), varint(-1)}, - }); + {varint(0), varint(0)}, + {varint(1), varint(1)}, + {varint(2), varint(2)}, + {varint(-1), varint(-1)}, + }); TestValidDataForRepeatedScalarMessage(); - TestValidDataForType(FieldDescriptor::TYPE_MESSAGE, { - {delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234))), - delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234)))}, - {delim(""), delim("")}, - }); + TestValidDataForType( + FieldDescriptor::TYPE_MESSAGE, + { + {delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234))), + delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234)))}, + {delim(""), delim("")}, + }); // TODO(haberman): // TestValidDataForType(FieldDescriptor::TYPE_GROUP diff --git a/conformance/conformance_cpp.cc b/conformance/conformance_cpp.cc index 5a1f21404d..c7f4b2d4b3 100644 --- a/conformance/conformance_cpp.cc +++ b/conformance/conformance_cpp.cc @@ -60,32 +60,6 @@ using std::string; static const char kTypeUrlPrefix[] = "type.googleapis.com"; const char* kFailures[] = { -#if !GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - "Required.Proto2.ProtobufInput." - "PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE", - "Required.Proto2.ProtobufInput." - "PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64", - "Required.Proto3.ProtobufInput." - "PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE", - "Required.Proto3.ProtobufInput." - "PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64", -#endif }; static string GetTypeUrl(const Descriptor* message) { diff --git a/conformance/conformance_objc.m b/conformance/conformance_objc.m index 1d677034e6..ab751c81de 100644 --- a/conformance/conformance_objc.m +++ b/conformance/conformance_objc.m @@ -80,8 +80,8 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) { msgClass = [TestAllTypesProto2 class]; } else { response.runtimeError = - [NSString stringWithFormat: - @"Protobuf request had an unknown message_type: %@", request.messageType]; + [NSString stringWithFormat:@"Protobuf request had an unknown message_type: %@", + request.messageType]; break; } NSError *error = nil; diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc index 0ad929aadb..0743b5e361 100644 --- a/conformance/conformance_test.cc +++ b/conformance/conformance_test.cc @@ -71,7 +71,7 @@ static string ToOctString(const string& binary_string) { return oct_string; } -} +} // namespace namespace google { namespace protobuf { @@ -239,21 +239,18 @@ void ConformanceTestSuite::RunValidInputTest( void ConformanceTestSuite::RunValidBinaryInputTest( const ConformanceRequestSetting& setting, - const string& equivalent_wire_format, - bool require_same_wire_format) { + const string& equivalent_wire_format, bool require_same_wire_format) { const ConformanceRequest& request = setting.GetRequest(); ConformanceResponse response; RunTest(setting.GetTestName(), request, &response); - VerifyResponse(setting, equivalent_wire_format, response, - true, require_same_wire_format); + VerifyResponse(setting, equivalent_wire_format, response, true, + require_same_wire_format); } void ConformanceTestSuite::VerifyResponse( const ConformanceRequestSetting& setting, - const string& equivalent_wire_format, - const ConformanceResponse& response, - bool need_report_success, - bool require_same_wire_format) { + const string& equivalent_wire_format, const ConformanceResponse& response, + bool need_report_success, bool require_same_wire_format) { Message* test_message = setting.GetTestMessage(); const ConformanceRequest& request = setting.GetRequest(); const string& test_name = setting.GetTestName(); @@ -296,8 +293,8 @@ void ConformanceTestSuite::VerifyResponse( if (require_same_wire_format) { GOOGLE_DCHECK_EQ(response.result_case(), - ConformanceResponse::kProtobufPayload); - const string& protobuf_payload = response.protobuf_payload(); + ConformanceResponse::kProtobufPayload); + const string& protobuf_payload = response.protobuf_payload(); check = equivalent_wire_format == protobuf_payload; differences = StrCat("Expect: ", ToOctString(equivalent_wire_format), ", but got: ", ToOctString(protobuf_payload)); diff --git a/conformance/conformance_test.h b/conformance/conformance_test.h index 2f42d83e15..6a993de0ea 100644 --- a/conformance/conformance_test.h +++ b/conformance/conformance_test.h @@ -38,14 +38,15 @@ #ifndef CONFORMANCE_CONFORMANCE_TEST_H #define CONFORMANCE_CONFORMANCE_TEST_H -#include -#include - #include #include #include #include +#include +#include +#include + #include "conformance.pb.h" namespace conformance { @@ -88,7 +89,13 @@ class ForkPipeRunner : public ConformanceTestRunner { static int Run(int argc, char *argv[], const std::vector& suites); - ForkPipeRunner(const std::string &executable) + ForkPipeRunner(const std::string& executable, + const std::vector& executable_args) + : child_pid_(-1), + executable_(executable), + executable_args_(executable_args) {} + + explicit ForkPipeRunner(const std::string& executable) : child_pid_(-1), executable_(executable) {} virtual ~ForkPipeRunner() {} @@ -108,6 +115,7 @@ class ForkPipeRunner : public ConformanceTestRunner { int read_fd_; pid_t child_pid_; std::string executable_; + const std::vector executable_args_; std::string current_test_name_; }; @@ -257,12 +265,10 @@ class ConformanceTestSuite { const ConformanceRequestSetting& setting, Message* test_message) = 0; - void VerifyResponse( - const ConformanceRequestSetting& setting, - const string& equivalent_wire_format, - const conformance::ConformanceResponse& response, - bool need_report_success, - bool require_same_wire_format); + void VerifyResponse(const ConformanceRequestSetting& setting, + const string& equivalent_wire_format, + const conformance::ConformanceResponse& response, + bool need_report_success, bool require_same_wire_format); void ReportSuccess(const std::string& test_name); void ReportFailure(const string& test_name, diff --git a/conformance/conformance_test_runner.cc b/conformance/conformance_test_runner.cc index e7aa0a552a..c68b2c7e95 100644 --- a/conformance/conformance_test_runner.cc +++ b/conformance/conformance_test_runner.cc @@ -195,7 +195,8 @@ int ForkPipeRunner::Run( } bool all_ok = true; for (ConformanceTestSuite* suite : suites) { - char *program; + string program; + std::vector program_args; string failure_list_filename; conformance::FailureSet failure_list; @@ -221,15 +222,15 @@ int ForkPipeRunner::Run( UsageError(); } } else { - if (arg != argc - 1) { - fprintf(stderr, "Too many arguments.\n"); - UsageError(); + program += argv[arg]; + while (arg < argc) { + program_args.push_back(argv[arg]); + arg++; } - program = argv[arg]; } } - ForkPipeRunner runner(program); + ForkPipeRunner runner(program, program_args); std::string output; all_ok = all_ok && @@ -295,8 +296,14 @@ void ForkPipeRunner::SpawnTestProgram() { memcpy(executable.get(), executable_.c_str(), executable_.size()); executable[executable_.size()] = '\0'; - char *const argv[] = {executable.get(), NULL}; - CHECK_SYSCALL(execv(executable.get(), argv)); // Never returns. + std::vector argv; + argv.push_back(executable.get()); + for (int i = 0; i < executable_args_.size(); ++i) { + argv.push_back(executable_args_[i].c_str()); + } + argv.push_back(nullptr); + // Never returns. + CHECK_SYSCALL(execv(executable.get(), const_cast(argv.data()))); } } diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb index 101fe159cf..95fe4f345e 100644 Binary files a/csharp/src/Google.Protobuf.Test/testprotos.pb and b/csharp/src/Google.Protobuf.Test/testprotos.pb differ diff --git a/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java b/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java index cde78f3a10..4e3cf42718 100644 --- a/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java +++ b/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java @@ -146,6 +146,15 @@ public abstract class AbstractMessageLite< Builder.addAll(values, list); } + /** Interface for an enum which signifies which field in a {@code oneof} was specified. */ + protected interface InternalOneOfEnum { + /** + * Retrieves the field number of the field which was set in this {@code oneof}, or {@code 0} if + * none were. + */ + int getNumber(); + } + /** * A partial implementation of the {@link Message.Builder} interface which implements as many * methods of that interface as possible in terms of other methods. diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java index ae5e56c5fc..6fe2d01eca 100644 --- a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java +++ b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java @@ -2365,6 +2365,11 @@ public abstract class GeneratedMessageV3 extends AbstractMessage } try { return new MethodHandleInvoker(accessor); + } catch (NoClassDefFoundError e) { + // Fall back to reflection if MethodHandleInvoker isn't available, + // allowing clients that don't want to use method handles to opt out + // by deleting the class. + return accessor; } catch (IllegalAccessException e) { throw new RuntimeException(e); } @@ -2703,6 +2708,11 @@ public abstract class GeneratedMessageV3 extends AbstractMessage } try { return new MethodHandleInvoker(accessor); + } catch (NoClassDefFoundError e) { + // Fall back to reflection if MethodHandleInvoker isn't available, + // allowing clients that don't want to use method handles to opt out + // by deleting the class. + return accessor; } catch (IllegalAccessException e) { throw new RuntimeException(e); } diff --git a/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java b/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java index 74c2012749..b435327ab8 100644 --- a/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java +++ b/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java @@ -43,6 +43,9 @@ import java.util.logging.Logger; final class UnsafeUtil { private static final Logger logger = Logger.getLogger(UnsafeUtil.class.getName()); private static final sun.misc.Unsafe UNSAFE = getUnsafe(); + private static final Class MEMORY_CLASS = Android.getMemoryClass(); + private static final boolean IS_ANDROID_64 = determineAndroidSupportByAddressSize(long.class); + private static final boolean IS_ANDROID_32 = determineAndroidSupportByAddressSize(int.class); private static final MemoryAccessor MEMORY_ACCESSOR = getMemoryAccessor(); private static final boolean HAS_UNSAFE_BYTEBUFFER_OPERATIONS = supportsUnsafeByteBufferOperations(); @@ -89,6 +92,9 @@ final class UnsafeUtil { return HAS_UNSAFE_BYTEBUFFER_OPERATIONS; } + static boolean isAndroid64() { + return IS_ANDROID_64; + } @SuppressWarnings("unchecked") // safe by method contract static T allocateInstance(Class clazz) { @@ -314,6 +320,16 @@ final class UnsafeUtil { if (UNSAFE == null) { return null; } + if (Android.isOnAndroidDevice()) { + if (IS_ANDROID_64) { + return new Android64MemoryAccessor(UNSAFE); + } else if (IS_ANDROID_32) { + return new Android32MemoryAccessor(UNSAFE); + } else { + return null; + } + } + return new JvmMemoryAccessor(UNSAFE); } @@ -333,6 +349,9 @@ final class UnsafeUtil { clazz.getMethod("putLong", Object.class, long.class, long.class); clazz.getMethod("getObject", Object.class, long.class); clazz.getMethod("putObject", Object.class, long.class, Object.class); + if (Android.isOnAndroidDevice()) { + return true; + } clazz.getMethod("getByte", Object.class, long.class); clazz.getMethod("putByte", Object.class, long.class, byte.class); clazz.getMethod("getBoolean", Object.class, long.class); @@ -365,6 +384,9 @@ final class UnsafeUtil { return false; } + if (Android.isOnAndroidDevice()) { + return true; + } clazz.getMethod("getByte", long.class); clazz.getMethod("putByte", long.class, byte.class); clazz.getMethod("getInt", long.class); @@ -382,9 +404,36 @@ final class UnsafeUtil { return false; } + private static boolean determineAndroidSupportByAddressSize(Class addressClass) { + if (!Android.isOnAndroidDevice()) { + return false; + } + try { + Class clazz = MEMORY_CLASS; + clazz.getMethod("peekLong", addressClass, boolean.class); + clazz.getMethod("pokeLong", addressClass, long.class, boolean.class); + clazz.getMethod("pokeInt", addressClass, int.class, boolean.class); + clazz.getMethod("peekInt", addressClass, boolean.class); + clazz.getMethod("pokeByte", addressClass, byte.class); + clazz.getMethod("peekByte", addressClass); + clazz.getMethod("pokeByteArray", addressClass, byte[].class, int.class, int.class); + clazz.getMethod("peekByteArray", addressClass, byte[].class, int.class, int.class); + return true; + } catch (Throwable t) { + return false; + } + } /** Finds the address field within a direct {@link Buffer}. */ private static Field bufferAddressField() { + if (Android.isOnAndroidDevice()) { + // Old versions of Android had renamed the address field to 'effectiveDirectAddress', but + // recent versions of Android (>M?) use the OpenJDK implementation. Fall through in that case. + Field field = field(Buffer.class, "effectiveDirectAddress"); + if (field != null) { + return field; + } + } Field field = field(Buffer.class, "address"); return field != null && field.getType() == long.class ? field : null; } @@ -656,4 +705,273 @@ final class UnsafeUtil { } } + private static final class Android64MemoryAccessor extends MemoryAccessor { + + Android64MemoryAccessor(sun.misc.Unsafe unsafe) { + super(unsafe); + } + + @Override + public byte getByte(long address) { + throw new UnsupportedOperationException(); + } + + @Override + public void putByte(long address, byte value) { + throw new UnsupportedOperationException(); + } + + @Override + public int getInt(long address) { + throw new UnsupportedOperationException(); + } + + @Override + public void putInt(long address, int value) { + throw new UnsupportedOperationException(); + } + + @Override + public long getLong(long address) { + throw new UnsupportedOperationException(); + } + + @Override + public void putLong(long address, long value) { + throw new UnsupportedOperationException(); + } + + @Override + public byte getByte(Object target, long offset) { + if (IS_BIG_ENDIAN) { + return getByteBigEndian(target, offset); + } else { + return getByteLittleEndian(target, offset); + } + } + + @Override + public void putByte(Object target, long offset, byte value) { + if (IS_BIG_ENDIAN) { + putByteBigEndian(target, offset, value); + } else { + putByteLittleEndian(target, offset, value); + } + } + + @Override + public boolean getBoolean(Object target, long offset) { + if (IS_BIG_ENDIAN) { + return getBooleanBigEndian(target, offset); + } else { + return getBooleanLittleEndian(target, offset); + } + } + + @Override + public void putBoolean(Object target, long offset, boolean value) { + if (IS_BIG_ENDIAN) { + putBooleanBigEndian(target, offset, value); + } else { + putBooleanLittleEndian(target, offset, value); + } + } + + @Override + public float getFloat(Object target, long offset) { + return Float.intBitsToFloat(getInt(target, offset)); + } + + @Override + public void putFloat(Object target, long offset, float value) { + putInt(target, offset, Float.floatToIntBits(value)); + } + + @Override + public double getDouble(Object target, long offset) { + return Double.longBitsToDouble(getLong(target, offset)); + } + + @Override + public void putDouble(Object target, long offset, double value) { + putLong(target, offset, Double.doubleToLongBits(value)); + } + + @Override + public void copyMemory(long srcOffset, byte[] target, long targetIndex, long length) { + throw new UnsupportedOperationException(); + } + + @Override + public void copyMemory(byte[] src, long srcIndex, long targetOffset, long length) { + throw new UnsupportedOperationException(); + } + + @Override + public Object getStaticObject(Field field) { + try { + return field.get(null); + } catch (IllegalAccessException e) { + return null; + } + } + } + + private static final class Android32MemoryAccessor extends MemoryAccessor { + + /** Mask used to convert a 64 bit memory address to a 32 bit address. */ + private static final long SMALL_ADDRESS_MASK = 0x00000000FFFFFFFF; + + /** Truncate a {@code long} address into a short {@code int} address. */ + private static int smallAddress(long address) { + return (int) (SMALL_ADDRESS_MASK & address); + } + + Android32MemoryAccessor(sun.misc.Unsafe unsafe) { + super(unsafe); + } + + @Override + public byte getByte(long address) { + throw new UnsupportedOperationException(); + } + + @Override + public void putByte(long address, byte value) { + throw new UnsupportedOperationException(); + } + + @Override + public int getInt(long address) { + throw new UnsupportedOperationException(); + } + + @Override + public void putInt(long address, int value) { + throw new UnsupportedOperationException(); + } + + @Override + public long getLong(long address) { + throw new UnsupportedOperationException(); + } + + @Override + public void putLong(long address, long value) { + throw new UnsupportedOperationException(); + } + + @Override + public byte getByte(Object target, long offset) { + if (IS_BIG_ENDIAN) { + return getByteBigEndian(target, offset); + } else { + return getByteLittleEndian(target, offset); + } + } + + @Override + public void putByte(Object target, long offset, byte value) { + if (IS_BIG_ENDIAN) { + putByteBigEndian(target, offset, value); + } else { + putByteLittleEndian(target, offset, value); + } + } + + @Override + public boolean getBoolean(Object target, long offset) { + if (IS_BIG_ENDIAN) { + return getBooleanBigEndian(target, offset); + } else { + return getBooleanLittleEndian(target, offset); + } + } + + @Override + public void putBoolean(Object target, long offset, boolean value) { + if (IS_BIG_ENDIAN) { + putBooleanBigEndian(target, offset, value); + } else { + putBooleanLittleEndian(target, offset, value); + } + } + + @Override + public float getFloat(Object target, long offset) { + return Float.intBitsToFloat(getInt(target, offset)); + } + + @Override + public void putFloat(Object target, long offset, float value) { + putInt(target, offset, Float.floatToIntBits(value)); + } + + @Override + public double getDouble(Object target, long offset) { + return Double.longBitsToDouble(getLong(target, offset)); + } + + @Override + public void putDouble(Object target, long offset, double value) { + putLong(target, offset, Double.doubleToLongBits(value)); + } + + @Override + public void copyMemory(long srcOffset, byte[] target, long targetIndex, long length) { + throw new UnsupportedOperationException(); + } + + @Override + public void copyMemory(byte[] src, long srcIndex, long targetOffset, long length) { + throw new UnsupportedOperationException(); + } + + @Override + public Object getStaticObject(Field field) { + try { + return field.get(null); + } catch (IllegalAccessException e) { + return null; + } + } + } + + private static byte getByteBigEndian(Object target, long offset) { + return (byte) ((getInt(target, offset & ~3) >>> ((~offset & 3) << 3)) & 0xFF); + } + + private static byte getByteLittleEndian(Object target, long offset) { + return (byte) ((getInt(target, offset & ~3) >>> ((offset & 3) << 3)) & 0xFF); + } + + private static void putByteBigEndian(Object target, long offset, byte value) { + int intValue = getInt(target, offset & ~3); + int shift = ((~(int) offset) & 3) << 3; + int output = (intValue & ~(0xFF << shift)) | ((0xFF & value) << shift); + putInt(target, offset & ~3, output); + } + + private static void putByteLittleEndian(Object target, long offset, byte value) { + int intValue = getInt(target, offset & ~3); + int shift = (((int) offset) & 3) << 3; + int output = (intValue & ~(0xFF << shift)) | ((0xFF & value) << shift); + putInt(target, offset & ~3, output); + } + + private static boolean getBooleanBigEndian(Object target, long offset) { + return getByteBigEndian(target, offset) != 0; + } + + private static boolean getBooleanLittleEndian(Object target, long offset) { + return getByteLittleEndian(target, offset) != 0; + } + + private static void putBooleanBigEndian(Object target, long offset, boolean value) { + putByteBigEndian(target, offset, (byte) (value ? 1 : 0)); + } + + private static void putBooleanLittleEndian(Object target, long offset, boolean value) { + putByteLittleEndian(target, offset, (byte) (value ? 1 : 0)); + } } diff --git a/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java b/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java index 6af1493331..92458226ab 100644 --- a/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java +++ b/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java @@ -345,8 +345,8 @@ public class FieldMaskUtil { } /** - * Merges fields specified by a FieldMask from one message to another with the - * specified merge options. + * Merges fields specified by a FieldMask from one message to another with the specified merge + * options. The destination will remain unchanged if an empty FieldMask is provided. */ public static void merge( FieldMask mask, Message source, Message.Builder destination, MergeOptions options) { diff --git a/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java b/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java index b7addab936..baae2244f9 100644 --- a/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java +++ b/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java @@ -182,11 +182,19 @@ public class FieldMaskTreeTest extends TestCase { FieldMaskUtil.MergeOptions options = new FieldMaskUtil.MergeOptions(); - // Test merging each individual field. + // Test merging with an empty FieldMask. NestedTestAllTypes.Builder builder = NestedTestAllTypes.newBuilder(); + builder.getPayloadBuilder().addRepeatedInt32(1000); + merge(new FieldMaskTree(), source, builder, options, useDynamicMessage); + NestedTestAllTypes.Builder expected = NestedTestAllTypes.newBuilder(); + expected.getPayloadBuilder().addRepeatedInt32(1000); + assertEquals(expected.build(), builder.build()); + + // Test merging each individual field. + builder = NestedTestAllTypes.newBuilder(); merge(new FieldMaskTree().addFieldPath("payload.optional_int32"), source, builder, options, useDynamicMessage); - NestedTestAllTypes.Builder expected = NestedTestAllTypes.newBuilder(); + expected = NestedTestAllTypes.newBuilder(); expected.getPayloadBuilder().setOptionalInt32(1234); assertEquals(expected.build(), builder.build()); diff --git a/js/binary/decoder.js b/js/binary/decoder.js index 45cf611efc..e0cd12e043 100644 --- a/js/binary/decoder.js +++ b/js/binary/decoder.js @@ -44,7 +44,6 @@ */ goog.provide('jspb.BinaryDecoder'); -goog.provide('jspb.BinaryIterator'); goog.require('goog.asserts'); goog.require('goog.crypt'); @@ -52,164 +51,6 @@ goog.require('jspb.utils'); -/** - * Simple helper class for traversing the contents of repeated scalar fields. - * that may or may not have been packed into a wire-format blob. - * @param {?jspb.BinaryDecoder=} opt_decoder - * @param {?function(this:jspb.BinaryDecoder):(number|boolean|string)=} - * opt_next The decoder method to use for next(). - * @param {?Array=} opt_elements - * @constructor - * @struct - */ -jspb.BinaryIterator = function(opt_decoder, opt_next, opt_elements) { - /** @private {?jspb.BinaryDecoder} */ - this.decoder_ = null; - - /** - * The BinaryDecoder member function used when iterating over packed data. - * @private {?function(this:jspb.BinaryDecoder):(number|boolean|string)} - */ - this.nextMethod_ = null; - - /** @private {?Array} */ - this.elements_ = null; - - /** @private {number} */ - this.cursor_ = 0; - - /** @private {number|boolean|string|null} */ - this.nextValue_ = null; - - /** @private {boolean} */ - this.atEnd_ = true; - - this.init_(opt_decoder, opt_next, opt_elements); -}; - - -/** - * @param {?jspb.BinaryDecoder=} opt_decoder - * @param {?function(this:jspb.BinaryDecoder):(number|boolean|string)=} - * opt_next The decoder method to use for next(). - * @param {?Array=} opt_elements - * @private - */ -jspb.BinaryIterator.prototype.init_ = - function(opt_decoder, opt_next, opt_elements) { - if (opt_decoder && opt_next) { - this.decoder_ = opt_decoder; - this.nextMethod_ = opt_next; - } - this.elements_ = opt_elements || null; - this.cursor_ = 0; - this.nextValue_ = null; - this.atEnd_ = !this.decoder_ && !this.elements_; - - this.next(); -}; - - -/** - * Global pool of BinaryIterator instances. - * @private {!Array} - */ -jspb.BinaryIterator.instanceCache_ = []; - - -/** - * Allocates a BinaryIterator from the cache, creating a new one if the cache - * is empty. - * @param {?jspb.BinaryDecoder=} opt_decoder - * @param {?function(this:jspb.BinaryDecoder):(number|boolean|string)=} - * opt_next The decoder method to use for next(). - * @param {?Array=} opt_elements - * @return {!jspb.BinaryIterator} - */ -jspb.BinaryIterator.alloc = function(opt_decoder, opt_next, opt_elements) { - if (jspb.BinaryIterator.instanceCache_.length) { - var iterator = jspb.BinaryIterator.instanceCache_.pop(); - iterator.init_(opt_decoder, opt_next, opt_elements); - return iterator; - } else { - return new jspb.BinaryIterator(opt_decoder, opt_next, opt_elements); - } -}; - - -/** - * Puts this instance back in the instance cache. - */ -jspb.BinaryIterator.prototype.free = function() { - this.clear(); - if (jspb.BinaryIterator.instanceCache_.length < 100) { - jspb.BinaryIterator.instanceCache_.push(this); - } -}; - - -/** - * Clears the iterator. - */ -jspb.BinaryIterator.prototype.clear = function() { - if (this.decoder_) { - this.decoder_.free(); - } - this.decoder_ = null; - this.nextMethod_ = null; - this.elements_ = null; - this.cursor_ = 0; - this.nextValue_ = null; - this.atEnd_ = true; -}; - - -/** - * Returns the element at the iterator, or null if the iterator is invalid or - * past the end of the decoder/array. - * @return {number|boolean|string|null} - */ -jspb.BinaryIterator.prototype.get = function() { - return this.nextValue_; -}; - - -/** - * Returns true if the iterator is at the end of the decoder/array. - * @return {boolean} - */ -jspb.BinaryIterator.prototype.atEnd = function() { - return this.atEnd_; -}; - - -/** - * Returns the element at the iterator and steps to the next element, - * equivalent to '*pointer++' in C. - * @return {number|boolean|string|null} - */ -jspb.BinaryIterator.prototype.next = function() { - var lastValue = this.nextValue_; - if (this.decoder_) { - if (this.decoder_.atEnd()) { - this.nextValue_ = null; - this.atEnd_ = true; - } else { - this.nextValue_ = this.nextMethod_.call(this.decoder_); - } - } else if (this.elements_) { - if (this.cursor_ == this.elements_.length) { - this.nextValue_ = null; - this.atEnd_ = true; - } else { - this.nextValue_ = this.elements_[this.cursor_++]; - } - } - return lastValue; -}; - - - /** * BinaryDecoder implements the decoders for all the wire types specified in * https://developers.google.com/protocol-buffers/docs/encoding. @@ -482,6 +323,32 @@ jspb.BinaryDecoder.prototype.readSplitVarint64 = function(convert) { }; +/** + * Reads a signed zigzag encoded varint from the binary stream and invokes + * the conversion function with the value in two signed 32 bit integers to + * produce the result. Since this does not convert the value to a number, no + * precision is lost. + * + * It's possible for an unsigned varint to be incorrectly encoded - more than + * 64 bits' worth of data could be present. If this happens, this method will + * throw an error. + * + * Zigzag encoding is a modification of varint encoding that reduces the + * storage overhead for small negative integers - for more details on the + * format, see https://developers.google.com/protocol-buffers/docs/encoding + * + * @param {function(number, number): T} convert Conversion function to produce + * the result value, takes parameters (lowBits, highBits). + * @return {T} + * @template T + */ +jspb.BinaryDecoder.prototype.readSplitZigzagVarint64 = function(convert) { + return this.readSplitVarint64(function(low, high) { + return jspb.utils.fromZigzag64(low, high, convert); + }); +}; + + /** * Reads a 64-bit fixed-width value from the stream and invokes the conversion * function with the value in two signed 32 bit integers to produce the result. @@ -731,9 +598,25 @@ jspb.BinaryDecoder.prototype.readZigzagVarint64 = function() { }; +/** + * Reads a signed, zigzag-encoded 64-bit varint from the binary stream + * losslessly and returns it as an 8-character Unicode string for use as a hash + * table key. + * + * Zigzag encoding is a modification of varint encoding that reduces the + * storage overhead for small negative integers - for more details on the + * format, see https://developers.google.com/protocol-buffers/docs/encoding + * + * @return {string} The decoded zigzag varint in hash64 format. + */ +jspb.BinaryDecoder.prototype.readZigzagVarintHash64 = function() { + return this.readSplitZigzagVarint64(jspb.utils.joinHash64); +}; + + /** * Reads a signed, zigzag-encoded 64-bit varint from the binary stream and - * returns its valud as a string. + * returns its value as a string. * * Zigzag encoding is a modification of varint encoding that reduces the * storage overhead for small negative integers - for more details on the @@ -743,9 +626,7 @@ jspb.BinaryDecoder.prototype.readZigzagVarint64 = function() { * string. */ jspb.BinaryDecoder.prototype.readZigzagVarint64String = function() { - // TODO(haberman): write lossless 64-bit zig-zag math. - var value = this.readZigzagVarint64(); - return value.toString(); + return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString); }; diff --git a/js/binary/decoder_test.js b/js/binary/decoder_test.js index c5be8057da..393f2f7267 100644 --- a/js/binary/decoder_test.js +++ b/js/binary/decoder_test.js @@ -235,6 +235,95 @@ describe('binaryDecoderTest', function() { }); }); + describe('sint64', function() { + var /** !jspb.BinaryDecoder */ decoder; + + var hashA = + String.fromCharCode(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + var hashB = + String.fromCharCode(0x12, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + var hashC = + String.fromCharCode(0x12, 0x34, 0x56, 0x78, 0x87, 0x65, 0x43, 0x21); + var hashD = + String.fromCharCode(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); + beforeEach(function() { + var encoder = new jspb.BinaryEncoder(); + + encoder.writeZigzagVarintHash64(hashA); + encoder.writeZigzagVarintHash64(hashB); + encoder.writeZigzagVarintHash64(hashC); + encoder.writeZigzagVarintHash64(hashD); + + decoder = jspb.BinaryDecoder.alloc(encoder.end()); + }); + + it('reads 64-bit integers as decimal strings', function() { + const signed = true; + expect(decoder.readZigzagVarint64String()) + .toEqual(jspb.utils.hash64ToDecimalString(hashA, signed)); + expect(decoder.readZigzagVarint64String()) + .toEqual(jspb.utils.hash64ToDecimalString(hashB, signed)); + expect(decoder.readZigzagVarint64String()) + .toEqual(jspb.utils.hash64ToDecimalString(hashC, signed)); + expect(decoder.readZigzagVarint64String()) + .toEqual(jspb.utils.hash64ToDecimalString(hashD, signed)); + }); + + it('reads 64-bit integers as hash strings', function() { + expect(decoder.readZigzagVarintHash64()).toEqual(hashA); + expect(decoder.readZigzagVarintHash64()).toEqual(hashB); + expect(decoder.readZigzagVarintHash64()).toEqual(hashC); + expect(decoder.readZigzagVarintHash64()).toEqual(hashD); + }); + + it('reads split 64 bit zigzag integers', function() { + function hexJoin(bitsLow, bitsHigh) { + return `0x${(bitsHigh >>> 0).toString(16)}:0x${ + (bitsLow >>> 0).toString(16)}`; + } + function hexJoinHash(hash64) { + jspb.utils.splitHash64(hash64); + return hexJoin(jspb.utils.split64Low, jspb.utils.split64High); + } + + expect(decoder.readSplitZigzagVarint64(hexJoin)) + .toEqual(hexJoinHash(hashA)); + expect(decoder.readSplitZigzagVarint64(hexJoin)) + .toEqual(hexJoinHash(hashB)); + expect(decoder.readSplitZigzagVarint64(hexJoin)) + .toEqual(hexJoinHash(hashC)); + expect(decoder.readSplitZigzagVarint64(hexJoin)) + .toEqual(hexJoinHash(hashD)); + }); + + it('does zigzag encoding properly', function() { + // Test cases direcly from the protobuf dev guide. + // https://engdoc.corp.google.com/eng/howto/protocolbuffers/developerguide/encoding.shtml?cl=head#types + var testCases = [ + {original: '0', zigzag: '0'}, + {original: '-1', zigzag: '1'}, + {original: '1', zigzag: '2'}, + {original: '-2', zigzag: '3'}, + {original: '2147483647', zigzag: '4294967294'}, + {original: '-2147483648', zigzag: '4294967295'}, + // 64-bit extremes, not in dev guide. + {original: '9223372036854775807', zigzag: '18446744073709551614'}, + {original: '-9223372036854775808', zigzag: '18446744073709551615'}, + ]; + var encoder = new jspb.BinaryEncoder(); + testCases.forEach(function(c) { + encoder.writeZigzagVarint64String(c.original); + }); + var buffer = encoder.end(); + var zigzagDecoder = jspb.BinaryDecoder.alloc(buffer); + var varintDecoder = jspb.BinaryDecoder.alloc(buffer); + testCases.forEach(function(c) { + expect(zigzagDecoder.readZigzagVarint64String()).toEqual(c.original); + expect(varintDecoder.readUnsignedVarint64String()).toEqual(c.zigzag); + }); + }); + }); + /** * Tests reading and writing large strings */ diff --git a/js/binary/encoder.js b/js/binary/encoder.js index b2013f6340..0b48e05066 100644 --- a/js/binary/encoder.js +++ b/js/binary/encoder.js @@ -232,13 +232,27 @@ jspb.BinaryEncoder.prototype.writeZigzagVarint64 = function(value) { * @param {string} value The integer to convert. */ jspb.BinaryEncoder.prototype.writeZigzagVarint64String = function(value) { - // TODO(haberman): write lossless 64-bit zig-zag math. - this.writeZigzagVarint64(parseInt(value, 10)); + this.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(value)); }; /** - * Writes a 8-bit unsigned integer to the buffer. Numbers outside the range + * Writes a 64-bit hash string (8 characters @ 8 bits of data each) to the + * buffer as a zigzag varint. + * @param {string} hash The hash to write. + */ +jspb.BinaryEncoder.prototype.writeZigzagVarintHash64 = function(hash) { + var self = this; + jspb.utils.splitHash64(hash); + jspb.utils.toZigzag64( + jspb.utils.split64Low, jspb.utils.split64High, function(lo, hi) { + self.writeSplitVarint64(lo >>> 0, hi >>> 0); + }); +}; + + +/** + * Writes an 8-bit unsigned integer to the buffer. Numbers outside the range * [0,2^8) will be truncated. * @param {number} value The value to write. */ @@ -294,7 +308,7 @@ jspb.BinaryEncoder.prototype.writeUint64 = function(value) { /** - * Writes a 8-bit integer to the buffer. Numbers outside the range + * Writes an 8-bit integer to the buffer. Numbers outside the range * [-2^7,2^7) will be truncated. * @param {number} value The value to write. */ diff --git a/js/binary/reader.js b/js/binary/reader.js index d1ab4079b4..9e193ac03e 100644 --- a/js/binary/reader.js +++ b/js/binary/reader.js @@ -49,6 +49,7 @@ goog.provide('jspb.BinaryReader'); goog.require('goog.asserts'); goog.require('jspb.BinaryConstants'); goog.require('jspb.BinaryDecoder'); +goog.require('jspb.utils'); @@ -941,7 +942,7 @@ jspb.BinaryReader.prototype.readBytes = function() { /** - * Reads a 64-bit varint or fixed64 field from the stream and returns it as a + * Reads a 64-bit varint or fixed64 field from the stream and returns it as an * 8-character Unicode string for use as a hash table key, or throws an error * if the next field in the stream is not of the correct wire type. * @@ -954,6 +955,20 @@ jspb.BinaryReader.prototype.readVarintHash64 = function() { }; +/** + * Reads an sint64 field from the stream and returns it as an 8-character + * Unicode string for use as a hash table key, or throws an error if the next + * field in the stream is not of the correct wire type. + * + * @return {string} The hash value. + */ +jspb.BinaryReader.prototype.readSintHash64 = function() { + goog.asserts.assert( + this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); + return this.decoder_.readZigzagVarintHash64(); +}; + + /** * Reads a 64-bit varint field from the stream and invokes `convert` to produce * the return value, or throws an error if the next field in the stream is not @@ -971,6 +986,25 @@ jspb.BinaryReader.prototype.readSplitVarint64 = function(convert) { }; +/** + * Reads a 64-bit zig-zag varint field from the stream and invokes `convert` to + * produce the return value, or throws an error if the next field in the stream + * is not of the correct wire type. + * + * @param {function(number, number): T} convert Conversion function to produce + * the result value, takes parameters (lowBits, highBits). + * @return {T} + * @template T + */ +jspb.BinaryReader.prototype.readSplitZigzagVarint64 = function(convert) { + goog.asserts.assert( + this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); + return this.decoder_.readSplitVarint64(function(lowBits, highBits) { + return jspb.utils.fromZigzag64(lowBits, highBits, convert); + }); +}; + + /** * Reads a 64-bit varint or fixed64 field from the stream and returns it as a * 8-character Unicode string for use as a hash table key, or throws an error diff --git a/js/binary/reader_test.js b/js/binary/reader_test.js index 618e9add2b..daa0ab6985 100644 --- a/js/binary/reader_test.js +++ b/js/binary/reader_test.js @@ -414,6 +414,7 @@ describe('binaryReaderTest', function() { var writer = new jspb.BinaryWriter(); writer.writeInt64String(1, '4294967296'); writer.writeSfixed64String(2, '4294967298'); + writer.writeInt64String(3, '3'); // 3 is the zig-zag encoding of -2. var reader = jspb.BinaryReader.alloc(writer.getResultBuffer()); function rejoin(lowBits, highBits) { @@ -426,6 +427,10 @@ describe('binaryReaderTest', function() { reader.nextField(); expect(reader.getFieldNumber()).toEqual(2); expect(reader.readSplitFixed64(rejoin)).toEqual(0x100000002); + + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(3); + expect(reader.readSplitZigzagVarint64(rejoin)).toEqual(-2); }); /** @@ -490,6 +495,11 @@ describe('binaryReaderTest', function() { jspb.BinaryReader.prototype.readSint64, jspb.BinaryWriter.prototype.writeSint64, 1, -Math.pow(2, 63), Math.pow(2, 63) - 513, Math.round); + + doTestSignedField_( + jspb.BinaryReader.prototype.readSintHash64, + jspb.BinaryWriter.prototype.writeSintHash64, 1, -Math.pow(2, 63), + Math.pow(2, 63) - 513, jspb.utils.numberToHash64); }); diff --git a/js/binary/utils.js b/js/binary/utils.js index 0cf0ef02da..f0425e319e 100644 --- a/js/binary/utils.js +++ b/js/binary/utils.js @@ -296,7 +296,7 @@ jspb.utils.splitHash64 = function(hash) { * @return {number} */ jspb.utils.joinUint64 = function(bitsLow, bitsHigh) { - return bitsHigh * jspb.BinaryConstants.TWO_TO_32 + bitsLow; + return bitsHigh * jspb.BinaryConstants.TWO_TO_32 + (bitsLow >>> 0); }; @@ -322,6 +322,33 @@ jspb.utils.joinInt64 = function(bitsLow, bitsHigh) { return sign ? -result : result; }; +/** + * Converts split 64-bit values from standard two's complement encoding to + * zig-zag encoding. Invokes the provided function to produce final result. + * + * @param {number} bitsLow + * @param {number} bitsHigh + * @param {function(number, number): T} convert Conversion function to produce + * the result value, takes parameters (lowBits, highBits). + * @return {T} + * @template T + */ +jspb.utils.toZigzag64 = function(bitsLow, bitsHigh, convert) { + // See + // https://engdoc.corp.google.com/eng/howto/protocolbuffers/developerguide/encoding.shtml?cl=head#types + // 64-bit math is: (n << 1) ^ (n >> 63) + // + // To do this in 32 bits, we can get a 32-bit sign-flipping mask from the + // high word. + // Then we can operate on each word individually, with the addition of the + // "carry" to get the most significant bit from the low word into the high + // word. + var signFlipMask = bitsHigh >> 31; + bitsHigh = (bitsHigh << 1 | bitsLow >>> 31) ^ signFlipMask; + bitsLow = (bitsLow << 1) ^ signFlipMask; + return convert(bitsLow, bitsHigh); +}; + /** * Joins two 32-bit values into a 64-bit unsigned integer and applies zigzag @@ -331,21 +358,33 @@ jspb.utils.joinInt64 = function(bitsLow, bitsHigh) { * @return {number} */ jspb.utils.joinZigzag64 = function(bitsLow, bitsHigh) { - // Extract the sign bit and shift right by one. - var sign = bitsLow & 1; - bitsLow = ((bitsLow >>> 1) | (bitsHigh << 31)) >>> 0; - bitsHigh = bitsHigh >>> 1; + return jspb.utils.fromZigzag64(bitsLow, bitsHigh, jspb.utils.joinInt64); +}; - // Increment the split value if the sign bit was set. - if (sign) { - bitsLow = (bitsLow + 1) >>> 0; - if (bitsLow == 0) { - bitsHigh = (bitsHigh + 1) >>> 0; - } - } - var result = jspb.utils.joinUint64(bitsLow, bitsHigh); - return sign ? -result : result; +/** + * Converts split 64-bit values from zigzag encoding to standard two's + * complement encoding. Invokes the provided function to produce final result. + * + * @param {number} bitsLow + * @param {number} bitsHigh + * @param {function(number, number): T} convert Conversion function to produce + * the result value, takes parameters (lowBits, highBits). + * @return {T} + * @template T + */ +jspb.utils.fromZigzag64 = function(bitsLow, bitsHigh, convert) { + // 64 bit math is: + // signmask = (zigzag & 1) ? -1 : 0; + // twosComplement = (zigzag >> 1) ^ signmask; + // + // To work with 32 bit, we can operate on both but "carry" the lowest bit + // from the high word by shifting it up 31 bits to be the most significant bit + // of the low word. + var signFlipMask = -(bitsLow & 1); + bitsLow = ((bitsLow >>> 1) | (bitsHigh << 31)) ^ signFlipMask; + bitsHigh = (bitsHigh >>> 1) ^ signFlipMask; + return convert(bitsLow, bitsHigh); }; diff --git a/js/binary/utils_test.js b/js/binary/utils_test.js index d4c1ef7172..c1b0789f80 100644 --- a/js/binary/utils_test.js +++ b/js/binary/utils_test.js @@ -465,6 +465,53 @@ describe('binaryUtilsTest', function() { } }); + /** + * Tests zigzag conversions. + */ + it('can encode and decode zigzag 64', function() { + function stringToHiLoPair(str) { + jspb.utils.splitDecimalString(str); + return { + lo: jspb.utils.split64Low >>> 0, + hi: jspb.utils.split64High >>> 0 + }; + } + function makeHiLoPair(lo, hi) { + return {lo: lo >>> 0, hi: hi >>> 0}; + } + // Test cases direcly from the protobuf dev guide. + // https://engdoc.corp.google.com/eng/howto/protocolbuffers/developerguide/encoding.shtml?cl=head#types + var testCases = [ + {original: stringToHiLoPair('0'), zigzag: stringToHiLoPair('0')}, + {original: stringToHiLoPair('-1'), zigzag: stringToHiLoPair('1')}, + {original: stringToHiLoPair('1'), zigzag: stringToHiLoPair('2')}, + {original: stringToHiLoPair('-2'), zigzag: stringToHiLoPair('3')}, + { + original: stringToHiLoPair('2147483647'), + zigzag: stringToHiLoPair('4294967294') + }, + { + original: stringToHiLoPair('-2147483648'), + zigzag: stringToHiLoPair('4294967295') + }, + // 64-bit extremes + { + original: stringToHiLoPair('9223372036854775807'), + zigzag: stringToHiLoPair('18446744073709551614') + }, + { + original: stringToHiLoPair('-9223372036854775808'), + zigzag: stringToHiLoPair('18446744073709551615') + }, + ]; + for (const c of testCases) { + expect(jspb.utils.toZigzag64(c.original.lo, c.original.hi, makeHiLoPair)) + .toEqual(c.zigzag); + expect(jspb.utils.fromZigzag64(c.zigzag.lo, c.zigzag.hi, makeHiLoPair)) + .toEqual(c.original); + } + }); + /** * Tests counting packed varints. diff --git a/js/binary/writer.js b/js/binary/writer.js index 017d4818a8..8c5bff810e 100644 --- a/js/binary/writer.js +++ b/js/binary/writer.js @@ -236,12 +236,11 @@ jspb.BinaryWriter.prototype.getResultBuffer = function() { /** * Converts the encoded data into a base64-encoded string. - * @param {boolean=} opt_webSafe True indicates we should use a websafe - * alphabet, which does not require escaping for use in URLs. + * @param {!goog.crypt.base64.Alphabet=} alphabet Which flavor of base64 to use. * @return {string} */ -jspb.BinaryWriter.prototype.getResultBase64String = function(opt_webSafe) { - return goog.crypt.base64.encodeByteArray(this.getResultBuffer(), opt_webSafe); +jspb.BinaryWriter.prototype.getResultBase64String = function(alphabet) { + return goog.crypt.base64.encodeByteArray(this.getResultBuffer(), alphabet); }; @@ -450,6 +449,19 @@ jspb.BinaryWriter.prototype.writeZigzagVarint64String_ = function( }; +/** + * Writes a zigzag varint field to the buffer without range checking. + * @param {number} field The field number. + * @param {string?} value The value to write. + * @private + */ +jspb.BinaryWriter.prototype.writeZigzagVarintHash64_ = function(field, value) { + if (value == null) return; + this.writeFieldHeader_(field, jspb.BinaryConstants.WireType.VARINT); + this.encoder_.writeZigzagVarintHash64(value); +}; + + /** * Writes an int32 field to the buffer. Numbers outside the range [-2^31,2^31) * will be truncated. @@ -563,7 +575,7 @@ jspb.BinaryWriter.prototype.writeUint64String = function(field, value) { /** - * Writes a sint32 field to the buffer. Numbers outside the range [-2^31,2^31) + * Writes an sint32 field to the buffer. Numbers outside the range [-2^31,2^31) * will be truncated. * @param {number} field The field number. * @param {number?} value The value to write. @@ -577,7 +589,7 @@ jspb.BinaryWriter.prototype.writeSint32 = function(field, value) { /** - * Writes a sint64 field to the buffer. Numbers outside the range [-2^63,2^63) + * Writes an sint64 field to the buffer. Numbers outside the range [-2^63,2^63) * will be truncated. * @param {number} field The field number. * @param {number?} value The value to write. @@ -591,15 +603,25 @@ jspb.BinaryWriter.prototype.writeSint64 = function(field, value) { /** - * Writes a sint64 field to the buffer. Numbers outside the range [-2^63,2^63) + * Writes an sint64 field to the buffer from a hash64 encoded value. Numbers + * outside the range [-2^63,2^63) will be truncated. + * @param {number} field The field number. + * @param {string?} value The hash64 string to write. + */ +jspb.BinaryWriter.prototype.writeSintHash64 = function(field, value) { + if (value == null) return; + this.writeZigzagVarintHash64_(field, value); +}; + + +/** + * Writes an sint64 field to the buffer. Numbers outside the range [-2^63,2^63) * will be truncated. * @param {number} field The field number. * @param {string?} value The decimal string to write. */ jspb.BinaryWriter.prototype.writeSint64String = function(field, value) { if (value == null) return; - goog.asserts.assert((+value >= -jspb.BinaryConstants.TWO_TO_63) && - (+value < jspb.BinaryConstants.TWO_TO_63)); this.writeZigzagVarint64String_(field, value); }; @@ -912,6 +934,22 @@ jspb.BinaryWriter.prototype.writeSplitVarint64 = function( }; +/** + * Writes a 64-bit field to the buffer as a zigzag encoded varint. + * @param {number} field The field number. + * @param {number} lowBits The low 32 bits. + * @param {number} highBits The high 32 bits. + */ +jspb.BinaryWriter.prototype.writeSplitZigzagVarint64 = function( + field, lowBits, highBits) { + this.writeFieldHeader_(field, jspb.BinaryConstants.WireType.VARINT); + var encoder = this.encoder_; + jspb.utils.toZigzag64(lowBits, highBits, function(lowBits, highBits) { + encoder.writeSplitVarint64(lowBits >>> 0, highBits >>> 0); + }); +}; + + /** * Writes an array of numbers to the buffer as a repeated 32-bit int field. * @param {number} field The field number. @@ -986,6 +1024,23 @@ jspb.BinaryWriter.prototype.writeRepeatedSplitVarint64 = function( }; +/** + * Writes an array of 64-bit values to the buffer as a zigzag varint. + * @param {number} field The field number. + * @param {?Array} value The value. + * @param {function(T): number} lo Function to get low bits. + * @param {function(T): number} hi Function to get high bits. + * @template T + */ +jspb.BinaryWriter.prototype.writeRepeatedSplitZigzagVarint64 = function( + field, value, lo, hi) { + if (value == null) return; + for (var i = 0; i < value.length; i++) { + this.writeSplitZigzagVarint64(field, lo(value[i]), hi(value[i])); + } +}; + + /** * Writes an array of numbers formatted as strings to the buffer as a repeated * 64-bit int field. @@ -1095,6 +1150,20 @@ jspb.BinaryWriter.prototype.writeRepeatedSint64String = function(field, value) { }; +/** + * Writes an array of hash64 strings to the buffer as a repeated signed 64-bit + * int field. + * @param {number} field The field number. + * @param {?Array} value The array of ints to write. + */ +jspb.BinaryWriter.prototype.writeRepeatedSintHash64 = function(field, value) { + if (value == null) return; + for (var i = 0; i < value.length; i++) { + this.writeZigzagVarintHash64_(field, value[i]); + } +}; + + /** * Writes an array of numbers to the buffer as a repeated fixed32 field. This * works for both signed and unsigned fixed32s. @@ -1411,6 +1480,29 @@ jspb.BinaryWriter.prototype.writePackedSplitVarint64 = function( }; +/** + * Writes an array of 64-bit values to the buffer as a zigzag varint. + * @param {number} field The field number. + * @param {?Array} value The value. + * @param {function(T): number} lo Function to get low bits. + * @param {function(T): number} hi Function to get high bits. + * @template T + */ +jspb.BinaryWriter.prototype.writePackedSplitZigzagVarint64 = function( + field, value, lo, hi) { + if (value == null) return; + var bookmark = this.beginDelimited_(field); + var encoder = this.encoder_; + for (var i = 0; i < value.length; i++) { + jspb.utils.toZigzag64( + lo(value[i]), hi(value[i]), function(bitsLow, bitsHigh) { + encoder.writeSplitVarint64(bitsLow >>> 0, bitsHigh >>> 0); + }); + } + this.endDelimited_(bookmark); +}; + + /** * Writes an array of numbers represented as strings to the buffer as a packed * 64-bit int field. @@ -1533,8 +1625,24 @@ jspb.BinaryWriter.prototype.writePackedSint64String = function(field, value) { if (value == null || !value.length) return; var bookmark = this.beginDelimited_(field); for (var i = 0; i < value.length; i++) { - // TODO(haberman): make lossless - this.encoder_.writeZigzagVarint64(parseInt(value[i], 10)); + this.encoder_.writeZigzagVarintHash64( + jspb.utils.decimalStringToHash64(value[i])); + } + this.endDelimited_(bookmark); +}; + + +/** + * Writes an array of hash 64 strings to the buffer as a packed signed 64-bit + * int field. + * @param {number} field The field number. + * @param {?Array} value The array of decimal strings to write. + */ +jspb.BinaryWriter.prototype.writePackedSintHash64 = function(field, value) { + if (value == null || !value.length) return; + var bookmark = this.beginDelimited_(field); + for (var i = 0; i < value.length; i++) { + this.encoder_.writeZigzagVarintHash64(value[i]); } this.endDelimited_(bookmark); }; diff --git a/js/binary/writer_test.js b/js/binary/writer_test.js index b4860a1df4..0590464308 100644 --- a/js/binary/writer_test.js +++ b/js/binary/writer_test.js @@ -42,6 +42,7 @@ goog.require('goog.crypt'); goog.require('goog.testing.asserts'); goog.require('jspb.BinaryReader'); goog.require('jspb.BinaryWriter'); +goog.require('jspb.utils'); /** @@ -128,8 +129,13 @@ describe('binaryWriterTest', function() { var writer = new jspb.BinaryWriter(); writer.writeBytes(1, new Uint8Array([127])); assertEquals('CgF/', writer.getResultBase64String()); - assertEquals('CgF/', writer.getResultBase64String(false)); - assertEquals('CgF_', writer.getResultBase64String(true)); + assertEquals( + 'CgF/', + writer.getResultBase64String(goog.crypt.base64.Alphabet.DEFAULT)); + assertEquals( + 'CgF_', + writer.getResultBase64String( + goog.crypt.base64.Alphabet.WEBSAFE_NO_PADDING)); }); it('writes split 64 fields', function() { @@ -201,4 +207,116 @@ describe('binaryWriterTest', function() { String(4 * 2 ** 32 + 3), ]); }); + + it('writes zigzag 64 fields', function() { + // Test cases direcly from the protobuf dev guide. + // https://engdoc.corp.google.com/eng/howto/protocolbuffers/developerguide/encoding.shtml?cl=head#types + var testCases = [ + {original: '0', zigzag: '0'}, + {original: '-1', zigzag: '1'}, + {original: '1', zigzag: '2'}, + {original: '-2', zigzag: '3'}, + {original: '2147483647', zigzag: '4294967294'}, + {original: '-2147483648', zigzag: '4294967295'}, + // 64-bit extremes, not in dev guide. + {original: '9223372036854775807', zigzag: '18446744073709551614'}, + {original: '-9223372036854775808', zigzag: '18446744073709551615'}, + ]; + function decimalToLowBits(v) { + jspb.utils.splitDecimalString(v); + return jspb.utils.split64Low >>> 0; + } + function decimalToHighBits(v) { + jspb.utils.splitDecimalString(v); + return jspb.utils.split64High >>> 0; + } + + var writer = new jspb.BinaryWriter(); + testCases.forEach(function(c) { + writer.writeSint64String(1, c.original); + writer.writeSintHash64(1, jspb.utils.decimalStringToHash64(c.original)); + jspb.utils.splitDecimalString(c.original); + writer.writeSplitZigzagVarint64( + 1, jspb.utils.split64Low, jspb.utils.split64High); + }); + + writer.writeRepeatedSint64String(2, testCases.map(function(c) { + return c.original; + })); + + writer.writeRepeatedSintHash64(3, testCases.map(function(c) { + return jspb.utils.decimalStringToHash64(c.original); + })); + + writer.writeRepeatedSplitZigzagVarint64( + 4, testCases.map(function(c) { + return c.original; + }), + decimalToLowBits, decimalToHighBits); + + writer.writePackedSint64String(5, testCases.map(function(c) { + return c.original; + })); + + writer.writePackedSintHash64(6, testCases.map(function(c) { + return jspb.utils.decimalStringToHash64(c.original); + })); + + writer.writePackedSplitZigzagVarint64( + 7, testCases.map(function(c) { + return c.original; + }), + decimalToLowBits, decimalToHighBits); + + // Verify by reading the stream as normal int64 fields and checking with + // the canonical zigzag encoding of each value. + var reader = jspb.BinaryReader.alloc(writer.getResultBuffer()); + testCases.forEach(function(c) { + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(1); + expect(reader.readUint64String()).toEqual(c.zigzag); + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(1); + expect(reader.readUint64String()).toEqual(c.zigzag); + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(1); + expect(reader.readUint64String()).toEqual(c.zigzag); + }); + + testCases.forEach(function(c) { + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(2); + expect(reader.readUint64String()).toEqual(c.zigzag); + }); + + testCases.forEach(function(c) { + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(3); + expect(reader.readUint64String()).toEqual(c.zigzag); + }); + + testCases.forEach(function(c) { + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(4); + expect(reader.readUint64String()).toEqual(c.zigzag); + }); + + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(5); + expect(reader.readPackedUint64String()).toEqual(testCases.map(function(c) { + return c.zigzag; + })); + + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(6); + expect(reader.readPackedUint64String()).toEqual(testCases.map(function(c) { + return c.zigzag; + })); + + reader.nextField(); + expect(reader.getFieldNumber()).toEqual(7); + expect(reader.readPackedUint64String()).toEqual(testCases.map(function(c) { + return c.zigzag; + })); + }); }); diff --git a/js/compatibility_tests/v3.0.0/binary/proto_test.js b/js/compatibility_tests/v3.0.0/binary/proto_test.js index 14d0f42e95..1364834570 100644 --- a/js/compatibility_tests/v3.0.0/binary/proto_test.js +++ b/js/compatibility_tests/v3.0.0/binary/proto_test.js @@ -172,7 +172,7 @@ function fillAllFields(msg) { * @return {boolean} */ function bytesCompare(arr, expected) { - if (goog.isString(arr)) { + if (typeof arr === 'string') { arr = goog.crypt.base64.decodeStringToUint8Array(arr); } if (arr.length != expected.length) { @@ -477,8 +477,8 @@ describe('protoBinaryTest', function() { var msg = new proto.jspb.test.TestAllTypes(); function assertGetters() { - assertTrue(goog.isString(msg.getRepeatedBytesList_asB64()[0])); - assertTrue(goog.isString(msg.getRepeatedBytesList_asB64()[1])); + assertTrue(typeof msg.getRepeatedBytesList_asB64()[0] === 'string'); + assertTrue(typeof msg.getRepeatedBytesList_asB64()[1] === 'string'); assertTrue(msg.getRepeatedBytesList_asU8()[0] instanceof Uint8Array); assertTrue(msg.getRepeatedBytesList_asU8()[1] instanceof Uint8Array); diff --git a/js/compatibility_tests/v3.0.0/binary/utils_test.js b/js/compatibility_tests/v3.0.0/binary/utils_test.js index d27e5ea2c6..abc36aac36 100644 --- a/js/compatibility_tests/v3.0.0/binary/utils_test.js +++ b/js/compatibility_tests/v3.0.0/binary/utils_test.js @@ -355,7 +355,7 @@ describe('binaryUtilsTest', function() { */ function test(x, opt_bits) { jspb.utils.splitFloat32(x); - if (goog.isDef(opt_bits)) { + if (opt_bits !== undefined) { if (opt_bits != jspb.utils.split64Low) throw 'fail!'; } if (truncate(x) != jspb.utils.joinFloat32(jspb.utils.split64Low, @@ -422,10 +422,10 @@ describe('binaryUtilsTest', function() { */ function test(x, opt_highBits, opt_lowBits) { jspb.utils.splitFloat64(x); - if (goog.isDef(opt_highBits)) { + if (opt_highBits !== undefined) { if (opt_highBits != jspb.utils.split64High) throw 'fail!'; } - if (goog.isDef(opt_lowBits)) { + if (opt_lowBits !== undefined) { if (opt_lowBits != jspb.utils.split64Low) throw 'fail!'; } if (x != jspb.utils.joinFloat64(jspb.utils.split64Low, diff --git a/js/compatibility_tests/v3.0.0/message_test.js b/js/compatibility_tests/v3.0.0/message_test.js index b779143115..79a12e09cc 100644 --- a/js/compatibility_tests/v3.0.0/message_test.js +++ b/js/compatibility_tests/v3.0.0/message_test.js @@ -1057,8 +1057,9 @@ describe('Message test suite', function() { it('testFloatingPointFieldsSupportNan', function() { var assertNan = function(x) { - assertTrue('Expected ' + x + ' (' + goog.typeOf(x) + ') to be NaN.', - goog.isNumber(x) && isNaN(x)); + assertTrue( + 'Expected ' + x + ' (' + goog.typeOf(x) + ') to be NaN.', + typeof x === 'number' && isNaN(x)); }; var message = new proto.jspb.test.FloatingPointFields([ diff --git a/js/compatibility_tests/v3.0.0/proto3_test.js b/js/compatibility_tests/v3.0.0/proto3_test.js index fab0fd44ff..d020a11fc4 100644 --- a/js/compatibility_tests/v3.0.0/proto3_test.js +++ b/js/compatibility_tests/v3.0.0/proto3_test.js @@ -50,7 +50,7 @@ var BYTES_B64 = goog.crypt.base64.encodeByteArray(BYTES); * @return {boolean} */ function bytesCompare(arr, expected) { - if (goog.isString(arr)) { + if (typeof arr === 'string') { arr = goog.crypt.base64.decodeStringToUint8Array(arr); } if (arr.length != expected.length) { diff --git a/js/compatibility_tests/v3.1.0/binary/proto_test.js b/js/compatibility_tests/v3.1.0/binary/proto_test.js index 26e1d30f1c..ff9d97262b 100644 --- a/js/compatibility_tests/v3.1.0/binary/proto_test.js +++ b/js/compatibility_tests/v3.1.0/binary/proto_test.js @@ -172,7 +172,7 @@ function fillAllFields(msg) { * @return {boolean} */ function bytesCompare(arr, expected) { - if (goog.isString(arr)) { + if (typeof arr === 'string') { arr = goog.crypt.base64.decodeStringToUint8Array(arr); } if (arr.length != expected.length) { @@ -477,8 +477,8 @@ describe('protoBinaryTest', function() { var msg = new proto.jspb.test.TestAllTypes(); function assertGetters() { - assertTrue(goog.isString(msg.getRepeatedBytesList_asB64()[0])); - assertTrue(goog.isString(msg.getRepeatedBytesList_asB64()[1])); + assertTrue(typeof msg.getRepeatedBytesList_asB64()[0] === 'string'); + assertTrue(typeof msg.getRepeatedBytesList_asB64()[1] === 'string'); assertTrue(msg.getRepeatedBytesList_asU8()[0] instanceof Uint8Array); assertTrue(msg.getRepeatedBytesList_asU8()[1] instanceof Uint8Array); diff --git a/js/compatibility_tests/v3.1.0/binary/utils_test.js b/js/compatibility_tests/v3.1.0/binary/utils_test.js index d27e5ea2c6..abc36aac36 100644 --- a/js/compatibility_tests/v3.1.0/binary/utils_test.js +++ b/js/compatibility_tests/v3.1.0/binary/utils_test.js @@ -355,7 +355,7 @@ describe('binaryUtilsTest', function() { */ function test(x, opt_bits) { jspb.utils.splitFloat32(x); - if (goog.isDef(opt_bits)) { + if (opt_bits !== undefined) { if (opt_bits != jspb.utils.split64Low) throw 'fail!'; } if (truncate(x) != jspb.utils.joinFloat32(jspb.utils.split64Low, @@ -422,10 +422,10 @@ describe('binaryUtilsTest', function() { */ function test(x, opt_highBits, opt_lowBits) { jspb.utils.splitFloat64(x); - if (goog.isDef(opt_highBits)) { + if (opt_highBits !== undefined) { if (opt_highBits != jspb.utils.split64High) throw 'fail!'; } - if (goog.isDef(opt_lowBits)) { + if (opt_lowBits !== undefined) { if (opt_lowBits != jspb.utils.split64Low) throw 'fail!'; } if (x != jspb.utils.joinFloat64(jspb.utils.split64Low, diff --git a/js/compatibility_tests/v3.1.0/message_test.js b/js/compatibility_tests/v3.1.0/message_test.js index d5c73742b6..80a1c52b65 100644 --- a/js/compatibility_tests/v3.1.0/message_test.js +++ b/js/compatibility_tests/v3.1.0/message_test.js @@ -1009,8 +1009,9 @@ describe('Message test suite', function() { it('testFloatingPointFieldsSupportNan', function() { var assertNan = function(x) { - assertTrue('Expected ' + x + ' (' + goog.typeOf(x) + ') to be NaN.', - goog.isNumber(x) && isNaN(x)); + assertTrue( + 'Expected ' + x + ' (' + goog.typeOf(x) + ') to be NaN.', + typeof x === 'number' && isNaN(x)); }; var message = new proto.jspb.test.FloatingPointFields([ diff --git a/js/compatibility_tests/v3.1.0/proto3_test.js b/js/compatibility_tests/v3.1.0/proto3_test.js index 3c929effd5..696af3397f 100644 --- a/js/compatibility_tests/v3.1.0/proto3_test.js +++ b/js/compatibility_tests/v3.1.0/proto3_test.js @@ -50,7 +50,7 @@ var BYTES_B64 = goog.crypt.base64.encodeByteArray(BYTES); * @return {boolean} */ function bytesCompare(arr, expected) { - if (goog.isString(arr)) { + if (typeof arr === 'string') { arr = goog.crypt.base64.decodeStringToUint8Array(arr); } if (arr.length != expected.length) { diff --git a/js/map.js b/js/map.js index b9a48afed7..589a2938d5 100644 --- a/js/map.js +++ b/js/map.js @@ -461,15 +461,21 @@ jspb.Map.prototype.serializeBinary = function( * The BinaryReader parsing callback for type V, if V is a message type * * @param {K=} opt_defaultKey - * The default value for the type of map keys. Accepting map - * entries with unset keys is required for maps to be backwards compatible - * with the repeated message representation described here: goo.gl/zuoLAC + * The default value for the type of map keys. Accepting map entries with + * unset keys is required for maps to be backwards compatible with the + * repeated message representation described here: goo.gl/zuoLAC + * + * @param {V=} opt_defaultValue + * The default value for the type of map values. Accepting map entries with + * unset values is required for maps to be backwards compatible with the + * repeated message representation described here: goo.gl/zuoLAC * */ jspb.Map.deserializeBinary = function(map, reader, keyReaderFn, valueReaderFn, - opt_valueReaderCallback, opt_defaultKey) { + opt_valueReaderCallback, opt_defaultKey, + opt_defaultValue) { var key = opt_defaultKey; - var value = undefined; + var value = opt_defaultValue; while (reader.nextField()) { if (reader.isEndGroup()) { @@ -484,7 +490,11 @@ jspb.Map.deserializeBinary = function(map, reader, keyReaderFn, valueReaderFn, // Value. if (map.valueCtor_) { goog.asserts.assert(opt_valueReaderCallback); - value = new map.valueCtor_(); + if (!value) { + // Old generator still doesn't provide default value message. + // Need this for backward compatibility. + value = new map.valueCtor_(); + } valueReaderFn.call(reader, value, opt_valueReaderCallback); } else { value = diff --git a/js/maps_test.js b/js/maps_test.js index 4640c98a46..1cbff7b300 100755 --- a/js/maps_test.js +++ b/js/maps_test.js @@ -36,10 +36,18 @@ goog.require('proto.jspb.test.MapValueEnum'); goog.require('proto.jspb.test.MapValueMessage'); goog.require('proto.jspb.test.TestMapFields'); goog.require('proto.jspb.test.TestMapFieldsOptionalKeys'); +goog.require('proto.jspb.test.TestMapFieldsOptionalValues'); goog.require('proto.jspb.test.MapEntryOptionalKeysStringKey'); goog.require('proto.jspb.test.MapEntryOptionalKeysInt32Key'); goog.require('proto.jspb.test.MapEntryOptionalKeysInt64Key'); goog.require('proto.jspb.test.MapEntryOptionalKeysBoolKey'); +goog.require('proto.jspb.test.MapEntryOptionalValuesStringValue'); +goog.require('proto.jspb.test.MapEntryOptionalValuesInt32Value'); +goog.require('proto.jspb.test.MapEntryOptionalValuesInt64Value'); +goog.require('proto.jspb.test.MapEntryOptionalValuesBoolValue'); +goog.require('proto.jspb.test.MapEntryOptionalValuesDoubleValue'); +goog.require('proto.jspb.test.MapEntryOptionalValuesEnumValue'); +goog.require('proto.jspb.test.MapEntryOptionalValuesMessageValue'); // CommonJS-LoadFromFile: test_pb proto.jspb.test goog.require('proto.jspb.test.MapValueMessageNoBinary'); @@ -54,7 +62,12 @@ function checkMapEquals(map, entries) { var arr = map.toArray(); assertEquals(arr.length, entries.length); for (var i = 0; i < arr.length; i++) { - assertElementsEquals(arr[i], entries[i]); + if (Array.isArray(arr[i])) { + assertTrue(Array.isArray(entries[i])); + assertArrayEquals(arr[i], entries[i]); + } else { + assertElementsEquals(arr[i], entries[i]); + } } } @@ -265,8 +278,10 @@ function makeTests(msgInfo, submessageCtor, suffix) { var decoded = msgInfo.deserializeBinary(serialized); checkMapFields(decoded); }); + /** - * Tests deserialization of undefined map keys go to default values in binary format. + * Tests deserialization of undefined map keys go to default values in + * binary format. */ it('testMapDeserializationForUndefinedKeys', function() { var testMessageOptionalKeys = new proto.jspb.test.TestMapFieldsOptionalKeys(); @@ -298,6 +313,67 @@ function makeTests(msgInfo, submessageCtor, suffix) { [false, 'd'] ]); }); + + /** + * Tests deserialization of undefined map values go to default values in + * binary format. + */ + it('testMapDeserializationForUndefinedValues', function() { + var testMessageOptionalValues = + new proto.jspb.test.TestMapFieldsOptionalValues(); + var mapEntryStringValue = + new proto.jspb.test.MapEntryOptionalValuesStringValue(); + mapEntryStringValue.setKey("a"); + testMessageOptionalValues.setMapStringString(mapEntryStringValue); + var mapEntryInt32Value = + new proto.jspb.test.MapEntryOptionalValuesInt32Value(); + mapEntryInt32Value.setKey("b"); + testMessageOptionalValues.setMapStringInt32(mapEntryInt32Value); + var mapEntryInt64Value = + new proto.jspb.test.MapEntryOptionalValuesInt64Value(); + mapEntryInt64Value.setKey("c"); + testMessageOptionalValues.setMapStringInt64(mapEntryInt64Value); + var mapEntryBoolValue = + new proto.jspb.test.MapEntryOptionalValuesBoolValue(); + mapEntryBoolValue.setKey("d"); + testMessageOptionalValues.setMapStringBool(mapEntryBoolValue); + var mapEntryDoubleValue = + new proto.jspb.test.MapEntryOptionalValuesDoubleValue(); + mapEntryDoubleValue.setKey("e"); + testMessageOptionalValues.setMapStringDouble(mapEntryDoubleValue); + var mapEntryEnumValue = + new proto.jspb.test.MapEntryOptionalValuesEnumValue(); + mapEntryEnumValue.setKey("f"); + testMessageOptionalValues.setMapStringEnum(mapEntryEnumValue); + var mapEntryMessageValue = + new proto.jspb.test.MapEntryOptionalValuesMessageValue(); + mapEntryMessageValue.setKey("g"); + testMessageOptionalValues.setMapStringMsg(mapEntryMessageValue); + var deserializedMessage = msgInfo.deserializeBinary( + testMessageOptionalValues.serializeBinary() + ); + checkMapEquals(deserializedMessage.getMapStringStringMap(), [ + ['a', ''] + ]); + checkMapEquals(deserializedMessage.getMapStringInt32Map(), [ + ['b', 0] + ]); + checkMapEquals(deserializedMessage.getMapStringInt64Map(), [ + ['c', 0] + ]); + checkMapEquals(deserializedMessage.getMapStringBoolMap(), [ + ['d', false] + ]); + checkMapEquals(deserializedMessage.getMapStringDoubleMap(), [ + ['e', 0.0] + ]); + checkMapEquals(deserializedMessage.getMapStringEnumMap(), [ + ['f', 0] + ]); + checkMapEquals(deserializedMessage.getMapStringMsgMap(), [ + ['g', []] + ]); + }); } diff --git a/js/message.js b/js/message.js index 0957c6db77..52c541eb40 100644 --- a/js/message.js +++ b/js/message.js @@ -1860,7 +1860,6 @@ jspb.Message.clone_ = function(obj) { * @param {Function} constructor The message constructor. */ jspb.Message.registerMessageType = function(id, constructor) { - jspb.Message.registry_[id] = constructor; // This is needed so we can later access messageId directly on the contructor, // otherwise it is not available due to 'property collapsing' by the compiler. /** @@ -1868,15 +1867,6 @@ jspb.Message.registerMessageType = function(id, constructor) { */ constructor.messageId = id; }; - - -/** - * The registry of message ids to message constructors. - * @private - */ -jspb.Message.registry_ = {}; - - /** * The extensions registered on MessageSet. This is a map of extension * field number to field info object. This should be considered as a diff --git a/js/package.json b/js/package.json index 202e8e4c41..37dfe67e3f 100644 --- a/js/package.json +++ b/js/package.json @@ -8,11 +8,11 @@ ], "dependencies": {}, "devDependencies": { - "glob": "~6.0.4", - "google-closure-compiler": "~20190301.0.0", - "google-closure-library": "~20190301.0.0", - "gulp": "~4.0.1", - "jasmine": "~2.4.1" + "glob": "~7.1.4", + "google-closure-compiler": "~20190819.0.0", + "google-closure-library": "~20190819.0.0", + "gulp": "~4.0.2", + "jasmine": "~3.4.0" }, "scripts": { "test": "node ./node_modules/gulp/bin/gulp.js test" diff --git a/js/testbinary.proto b/js/testbinary.proto index 2e548454da..a141285644 100644 --- a/js/testbinary.proto +++ b/js/testbinary.proto @@ -232,6 +232,56 @@ message TestMapFieldsOptionalKeys { // End mock-map entries +// These proto are 'mock map' entries to test the above map deserializing with +// undefined values. Make sure TestMapFieldsOptionalValues is written to be +// deserialized by TestMapFields +message MapEntryOptionalValuesStringValue { + optional string key = 1; + optional string value = 2; +} + +message MapEntryOptionalValuesInt32Value { + optional string key = 1; + optional int32 value = 2; +} + +message MapEntryOptionalValuesInt64Value { + optional string key = 1; + optional int64 value = 2; +} + +message MapEntryOptionalValuesBoolValue { + optional string key = 1; + optional bool value = 2; +} + +message MapEntryOptionalValuesDoubleValue { + optional string key = 1; + optional double value = 2; +} + +message MapEntryOptionalValuesEnumValue { + optional string key = 1; + optional MapValueEnum value = 2; +} + +message MapEntryOptionalValuesMessageValue { + optional string key = 1; + optional MapValueMessage value = 2; +} + +message TestMapFieldsOptionalValues { + optional MapEntryOptionalValuesStringValue map_string_string = 1; + optional MapEntryOptionalValuesInt32Value map_string_int32 = 2; + optional MapEntryOptionalValuesInt64Value map_string_int64 = 3; + optional MapEntryOptionalValuesBoolValue map_string_bool = 4; + optional MapEntryOptionalValuesDoubleValue map_string_double = 5; + optional MapEntryOptionalValuesEnumValue map_string_enum = 6; + optional MapEntryOptionalValuesMessageValue map_string_msg = 7; +} + +// End mock-map entries + enum MapValueEnum { MAP_VALUE_FOO = 0; MAP_VALUE_BAR = 1; diff --git a/python/google/protobuf/descriptor_pool.py b/python/google/protobuf/descriptor_pool.py index f41dc522c6..d99d3f88ac 100644 --- a/python/google/protobuf/descriptor_pool.py +++ b/python/google/protobuf/descriptor_pool.py @@ -68,6 +68,22 @@ from google.protobuf import text_encoding _USE_C_DESCRIPTORS = descriptor._USE_C_DESCRIPTORS # pylint: disable=protected-access +def _Deprecated(func): + """Mark functions as deprecated.""" + + def NewFunc(*args, **kwargs): + warnings.warn( + 'Call to deprecated function %s(). Note: Do add unlinked descriptors ' + 'to descriptor_pool is wrong. Use Add() or AddSerializedFile() ' + 'instead.' % func.__name__, + category=DeprecationWarning) + return func(*args, **kwargs) + NewFunc.__name__ = func.__name__ + NewFunc.__doc__ = func.__doc__ + NewFunc.__dict__.update(func.__dict__) + return NewFunc + + def _NormalizeFullyQualifiedName(name): """Remove leading period from fully-qualified type name. @@ -199,7 +215,14 @@ class DescriptorPool(object): serialized_file_desc_proto) self.Add(file_desc_proto) + # Add Descriptor to descriptor pool is dreprecated. Please use Add() + # or AddSerializedFile() to add a FileDescriptorProto instead. + @_Deprecated def AddDescriptor(self, desc): + self._AddDescriptor(desc) + + # Never call this method. It is for internal usage only. + def _AddDescriptor(self, desc): """Adds a Descriptor to the pool, non-recursively. If the Descriptor contains nested messages or enums, the caller must @@ -217,7 +240,14 @@ class DescriptorPool(object): self._descriptors[desc.full_name] = desc self._AddFileDescriptor(desc.file) + # Add EnumDescriptor to descriptor pool is dreprecated. Please use Add() + # or AddSerializedFile() to add a FileDescriptorProto instead. + @_Deprecated def AddEnumDescriptor(self, enum_desc): + self._AddEnumDescriptor(enum_desc) + + # Never call this method. It is for internal usage only. + def _AddEnumDescriptor(self, enum_desc): """Adds an EnumDescriptor to the pool. This method also registers the FileDescriptor associated with the enum. @@ -251,7 +281,14 @@ class DescriptorPool(object): self._top_enum_values[full_name] = enum_value self._AddFileDescriptor(enum_desc.file) + # Add ServiceDescriptor to descriptor pool is dreprecated. Please use Add() + # or AddSerializedFile() to add a FileDescriptorProto instead. + @_Deprecated def AddServiceDescriptor(self, service_desc): + self._AddServiceDescriptor(service_desc) + + # Never call this method. It is for internal usage only. + def _AddServiceDescriptor(self, service_desc): """Adds a ServiceDescriptor to the pool. Args: @@ -265,7 +302,14 @@ class DescriptorPool(object): service_desc.file.name) self._service_descriptors[service_desc.full_name] = service_desc + # Add ExtensionDescriptor to descriptor pool is dreprecated. Please use Add() + # or AddSerializedFile() to add a FileDescriptorProto instead. + @_Deprecated def AddExtensionDescriptor(self, extension): + self._AddExtensionDescriptor(extension) + + # Never call this method. It is for internal usage only. + def _AddExtensionDescriptor(self, extension): """Adds a FieldDescriptor describing an extension to the pool. Args: @@ -307,7 +351,12 @@ class DescriptorPool(object): self._extensions_by_name[extension.containing_type][ extension.message_type.full_name] = extension + @_Deprecated def AddFileDescriptor(self, file_desc): + self._InternalAddFileDescriptor(file_desc) + + # Never call this method. It is for internal usage only. + def _InternalAddFileDescriptor(self, file_desc): """Adds a FileDescriptor to the pool, non-recursively. If the FileDescriptor contains messages or enums, the caller must explicitly diff --git a/python/google/protobuf/internal/decoder.py b/python/google/protobuf/internal/decoder.py index 845d774274..fddcf146dc 100755 --- a/python/google/protobuf/internal/decoder.py +++ b/python/google/protobuf/internal/decoder.py @@ -421,12 +421,19 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default): message._unknown_fields.append( (tag_bytes, buffer[value_start_pos:pos].tobytes())) + if message._unknown_field_set is None: + message._unknown_field_set = containers.UnknownFieldSet() + message._unknown_field_set._add( + field_number, wire_format.WIRETYPE_VARINT, element) # pylint: enable=protected-access if pos > endpoint: if element in enum_type.values_by_number: del value[-1] # Discard corrupt value. else: del message._unknown_fields[-1] + # pylint: disable=protected-access + del message._unknown_field_set._values[-1] + # pylint: enable=protected-access raise _DecodeError('Packed element was truncated.') return pos return DecodePackedField @@ -459,7 +466,11 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default): message._unknown_fields = [] message._unknown_fields.append( (tag_bytes, buffer[pos:new_pos].tobytes())) - # pylint: enable=protected-access + if message._unknown_field_set is None: + message._unknown_field_set = containers.UnknownFieldSet() + message._unknown_field_set._add( + field_number, wire_format.WIRETYPE_VARINT, element) + # pylint: enable=protected-access # Predict that the next tag is another copy of the same repeated # field. pos = new_pos + tag_len @@ -497,6 +508,10 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default): wire_format.WIRETYPE_VARINT) message._unknown_fields.append( (tag_bytes, buffer[value_start_pos:pos].tobytes())) + if message._unknown_field_set is None: + message._unknown_field_set = containers.UnknownFieldSet() + message._unknown_field_set._add( + field_number, wire_format.WIRETYPE_VARINT, enum_value) # pylint: enable=protected-access return pos return DecodeField @@ -812,6 +827,11 @@ def MessageSetItemDecoder(descriptor): message._unknown_fields = [] message._unknown_fields.append( (MESSAGE_SET_ITEM_TAG, buffer[message_set_item_start:pos].tobytes())) + if message._unknown_field_set is None: + message._unknown_field_set = containers.UnknownFieldSet() + message._unknown_field_set._add(type_id, + wire_format.WIRETYPE_LENGTH_DELIMITED, + buffer[message_start:message_end]) # pylint: enable=protected-access return pos diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py index 35d635e0b6..bff2d5f548 100755 --- a/python/google/protobuf/internal/descriptor_test.py +++ b/python/google/protobuf/internal/descriptor_test.py @@ -655,7 +655,8 @@ class GeneratedDescriptorTest(unittest.TestCase): nested_message_descriptor = unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR self.assertEqual(len(message_descriptor.nested_types), 3) self.assertFalse(None in message_descriptor.nested_types) - self.assertTrue(nested_message_descriptor in message_descriptor.nested_types) + self.assertTrue( + nested_message_descriptor in message_descriptor.nested_types) def testServiceDescriptor(self): service_descriptor = unittest_pb2.DESCRIPTOR.services_by_name['TestService'] diff --git a/python/google/protobuf/internal/extension_dict.py b/python/google/protobuf/internal/extension_dict.py index a8ce013d0a..a44bf9ddf4 100644 --- a/python/google/protobuf/internal/extension_dict.py +++ b/python/google/protobuf/internal/extension_dict.py @@ -162,6 +162,9 @@ class _ExtensionDict(object): type_checker.CheckValue(value)) self._extended_message._Modified() + def __delitem__(self, extension_handle): + self._extended_message.ClearExtension(extension_handle) + def _FindExtensionByName(self, name): """Tries to find a known extension with the specified name. diff --git a/python/google/protobuf/internal/python_message.py b/python/google/protobuf/internal/python_message.py index 8f3ec9db80..8e7d43a484 100755 --- a/python/google/protobuf/internal/python_message.py +++ b/python/google/protobuf/internal/python_message.py @@ -676,7 +676,6 @@ def _AddPropertiesForNonRepeatedScalarField(field, cls): property_name = _PropertyName(proto_field_name) type_checker = type_checkers.GetTypeChecker(field) default_value = field.default_value - valid_values = set() is_proto3 = field.containing_type.syntax == 'proto3' def getter(self): @@ -785,7 +784,8 @@ def _AddStaticMethods(cls): def RegisterExtension(extension_handle): extension_handle.containing_type = cls.DESCRIPTOR # TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available. - cls.DESCRIPTOR.file.pool.AddExtensionDescriptor(extension_handle) + # pylint: disable=protected-access + cls.DESCRIPTOR.file.pool._AddExtensionDescriptor(extension_handle) _AttachFieldHelpers(cls, extension_handle) cls.RegisterExtension = staticmethod(RegisterExtension) @@ -1072,7 +1072,6 @@ def _AddSerializeToStringMethod(message_descriptor, cls): def SerializeToString(self, **kwargs): # Check if the message has all of its required fields set. - errors = [] if not self.IsInitialized(): raise message_mod.EncodeError( 'Message %s is missing required fields: %s' % ( diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py index d486bb1ea9..786a7ca7dd 100755 --- a/python/google/protobuf/internal/reflection_test.py +++ b/python/google/protobuf/internal/reflection_test.py @@ -506,6 +506,11 @@ class ReflectionTest(unittest.TestCase): (unittest_pb2.optional_fixed32_extension, 1), (unittest_pb2.optional_string_extension , 'foo') ], proto.ListFields()) + del proto.Extensions[unittest_pb2.optional_fixed32_extension] + self.assertEqual( + [(unittest_pb2.optional_int32_extension, 5), + (unittest_pb2.optional_string_extension, 'foo')], + proto.ListFields()) def testRepeatedListExtensions(self): proto = unittest_pb2.TestAllExtensions() @@ -522,6 +527,12 @@ class ReflectionTest(unittest.TestCase): (unittest_pb2.repeated_fixed32_extension, [1]), (unittest_pb2.repeated_string_extension , ['foo', 'bar', 'baz']) ], proto.ListFields()) + del proto.Extensions[unittest_pb2.repeated_int32_extension] + del proto.Extensions[unittest_pb2.repeated_string_extension] + self.assertEqual( + [(unittest_pb2.optional_int32_extension, 21), + (unittest_pb2.repeated_fixed32_extension, [1])], + proto.ListFields()) def testListFieldsAndExtensions(self): proto = unittest_pb2.TestFieldOrderings() @@ -583,6 +594,7 @@ class ReflectionTest(unittest.TestCase): def testClearFieldWithUnknownFieldName(self): proto = unittest_pb2.TestAllTypes() self.assertRaises(ValueError, proto.ClearField, 'nonexistent_field') + self.assertRaises(ValueError, proto.ClearField, b'nonexistent_field') def testClearRemovesChildren(self): # Make sure there aren't any implementation bugs that are only partially @@ -1199,6 +1211,32 @@ class ReflectionTest(unittest.TestCase): self.assertEqual(prius.price, new_prius.price) self.assertEqual(prius.owners, new_prius.owners) + def testExtensionDelete(self): + extendee_proto = more_extensions_pb2.ExtendedMessage() + + extension_int32 = more_extensions_pb2.optional_int_extension + extendee_proto.Extensions[extension_int32] = 23 + + extension_repeated = more_extensions_pb2.repeated_int_extension + extendee_proto.Extensions[extension_repeated].append(11) + + extension_msg = more_extensions_pb2.optional_message_extension + extendee_proto.Extensions[extension_msg].foreign_message_int = 56 + + self.assertEqual(len(extendee_proto.Extensions), 3) + del extendee_proto.Extensions[extension_msg] + self.assertEqual(len(extendee_proto.Extensions), 2) + del extendee_proto.Extensions[extension_repeated] + self.assertEqual(len(extendee_proto.Extensions), 1) + # Delete a none exist extension. It is OK to "del m.Extensions[ext]" + # even if the extension is not present in the message; we don't + # raise KeyError. This is consistent with "m.Extensions[ext]" + # returning a default value even if we did not set anything. + del extendee_proto.Extensions[extension_repeated] + self.assertEqual(len(extendee_proto.Extensions), 1) + del extendee_proto.Extensions[extension_int32] + self.assertEqual(len(extendee_proto.Extensions), 0) + def testExtensionIter(self): extendee_proto = more_extensions_pb2.ExtendedMessage() @@ -1820,6 +1858,7 @@ class ReflectionTest(unittest.TestCase): proto = unittest_pb2.TestRequired() self.assertFalse(proto.IsInitialized(errors)) self.assertEqual(errors, ['a', 'b', 'c']) + self.assertRaises(TypeError, proto.IsInitialized, 1, 2, 3) @unittest.skipIf( api_implementation.Type() != 'cpp' or api_implementation.Version() != 2, diff --git a/python/google/protobuf/internal/text_format_test.py b/python/google/protobuf/internal/text_format_test.py index c705dcd768..e661551c08 100755 --- a/python/google/protobuf/internal/text_format_test.py +++ b/python/google/protobuf/internal/text_format_test.py @@ -845,17 +845,18 @@ class OnlyWorksWithProto2RightNowTests(TextFormatBase): all_data = message.SerializeToString() empty_message = unittest_pb2.TestEmptyMessage() empty_message.ParseFromString(all_data) - self.assertEqual('1: 101\n' - '12: 4636878028842991616\n' - '14: "hello"\n' - '15: "103"\n' - '16 {\n' - ' 17: 104\n' - '}\n' - '18 {\n' - ' 1: 105\n' - '}\n', + self.assertEqual(' 1: 101\n' + ' 12: 4636878028842991616\n' + ' 14: "hello"\n' + ' 15: "103"\n' + ' 16 {\n' + ' 17: 104\n' + ' }\n' + ' 18 {\n' + ' 1: 105\n' + ' }\n', text_format.MessageToString(empty_message, + indent=2, print_unknown_fields=True)) self.assertEqual('1: 101 ' '12: 4636878028842991616 ' diff --git a/python/google/protobuf/internal/unknown_fields_test.py b/python/google/protobuf/internal/unknown_fields_test.py index bcc4a46d6e..fc5f38be16 100755 --- a/python/google/protobuf/internal/unknown_fields_test.py +++ b/python/google/protobuf/internal/unknown_fields_test.py @@ -50,6 +50,7 @@ from google.protobuf.internal import missing_enum_values_pb2 from google.protobuf.internal import test_util from google.protobuf.internal import testing_refleaks from google.protobuf.internal import type_checkers +from google.protobuf.internal import wire_format from google.protobuf import descriptor @@ -91,7 +92,7 @@ class UnknownFieldsTest(unittest.TestCase): # Add an unknown extension. item = raw.item.add() - item.type_id = 98418603 + item.type_id = 98218603 message1 = message_set_extensions_pb2.TestMessageSetExtension1() message1.i = 12345 item.message = message1.SerializeToString() @@ -102,6 +103,19 @@ class UnknownFieldsTest(unittest.TestCase): proto = message_set_extensions_pb2.TestMessageSet() proto.MergeFromString(serialized) + unknown_fields = proto.UnknownFields() + self.assertEqual(len(unknown_fields), 1) + # Unknown field should have wire format data which can be parsed back to + # original message. + self.assertEqual(unknown_fields[0].field_number, item.type_id) + self.assertEqual(unknown_fields[0].wire_type, + wire_format.WIRETYPE_LENGTH_DELIMITED) + d = unknown_fields[0].data + message_new = message_set_extensions_pb2.TestMessageSetExtension1() + message_new.ParseFromString(d.tobytes() if isinstance(d, ( + memoryview)) else d) + self.assertEqual(message1, message_new) + # Verify that the unknown extension is serialized unchanged reserialized = proto.SerializeToString() new_raw = unittest_mset_pb2.RawMessageSet() @@ -344,6 +358,7 @@ class UnknownFieldsAccessorsTest(unittest.TestCase): def testUnknownExtensions(self): message = unittest_pb2.TestEmptyMessageWithExtensions() message.ParseFromString(self.all_fields_data) + self.assertEqual(len(message.UnknownFields()), 97) self.assertEqual(message.SerializeToString(), self.all_fields_data) @@ -378,12 +393,18 @@ class UnknownEnumValuesTest(unittest.TestCase): def CheckUnknownField(self, name, expected_value): field_descriptor = self.descriptor.fields_by_name[name] unknown_fields = self.missing_message.UnknownFields() + count = 0 for field in unknown_fields: if field.field_number == field_descriptor.number: + count += 1 if field_descriptor.label == descriptor.FieldDescriptor.LABEL_REPEATED: self.assertIn(field.data, expected_value) else: self.assertEqual(expected_value, field.data) + if field_descriptor.label == descriptor.FieldDescriptor.LABEL_REPEATED: + self.assertEqual(count, len(expected_value)) + else: + self.assertEqual(count, 1) def testUnknownParseMismatchEnumValue(self): just_string = missing_enum_values_pb2.JustString() @@ -413,6 +434,8 @@ class UnknownEnumValuesTest(unittest.TestCase): self.assertEqual([], self.missing_message.packed_nested_enum) def testCheckUnknownFieldValueForEnum(self): + unknown_fields = self.missing_message.UnknownFields() + self.assertEqual(len(unknown_fields), 5) self.CheckUnknownField('optional_nested_enum', self.message.optional_nested_enum) self.CheckUnknownField('repeated_nested_enum', diff --git a/python/google/protobuf/pyext/extension_dict.cc b/python/google/protobuf/pyext/extension_dict.cc index 35b6ec6922..bb62d4cd3c 100644 --- a/python/google/protobuf/pyext/extension_dict.cc +++ b/python/google/protobuf/pyext/extension_dict.cc @@ -214,6 +214,10 @@ int ass_subscript(ExtensionDict* self, PyObject* key, PyObject* value) { return -1; } + if (value == nullptr) { + return cmessage::ClearFieldByDescriptor(self->parent, descriptor); + } + if (descriptor->label() != FieldDescriptor::LABEL_OPTIONAL || descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { PyErr_SetString(PyExc_TypeError, "Extension is repeated and/or composite " diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc index 43e5896562..1f018a7b14 100644 --- a/python/google/protobuf/pyext/message.cc +++ b/python/google/protobuf/pyext/message.cc @@ -66,7 +66,6 @@ #include #include #include -#include #include #include @@ -1332,7 +1331,7 @@ static void Dealloc(CMessage* self) { PyObject* IsInitialized(CMessage* self, PyObject* args) { PyObject* errors = NULL; - if (PyArg_ParseTuple(args, "|O", &errors) < 0) { + if (!PyArg_ParseTuple(args, "|O", &errors)) { return NULL; } if (self->message->IsInitialized()) { @@ -1360,20 +1359,18 @@ PyObject* IsInitialized(CMessage* self, PyObject* args) { Py_RETURN_FALSE; } -PyObject* HasFieldByDescriptor( - CMessage* self, const FieldDescriptor* field_descriptor) { +int HasFieldByDescriptor(CMessage* self, + const FieldDescriptor* field_descriptor) { Message* message = self->message; if (!CheckFieldBelongsToMessage(field_descriptor, message)) { - return NULL; + return -1; } if (field_descriptor->label() == FieldDescriptor::LABEL_REPEATED) { PyErr_SetString(PyExc_KeyError, "Field is repeated. A singular method is required."); - return NULL; + return -1; } - bool has_field = - message->GetReflection()->HasField(*message, field_descriptor); - return PyBool_FromLong(has_field ? 1 : 0); + return message->GetReflection()->HasField(*message, field_descriptor); } const FieldDescriptor* FindFieldWithOneofs( @@ -1475,10 +1472,10 @@ PyObject* ClearExtension(CMessage* self, PyObject* extension) { if (descriptor == NULL) { return NULL; } - if (InternalReleaseFieldByDescriptor(self, descriptor) < 0) { - return NULL; + if (ClearFieldByDescriptor(self, descriptor) < 0) { + return nullptr; } - return ClearFieldByDescriptor(self, descriptor); + Py_RETURN_NONE; } PyObject* HasExtension(CMessage* self, PyObject* extension) { @@ -1486,7 +1483,12 @@ PyObject* HasExtension(CMessage* self, PyObject* extension) { if (descriptor == NULL) { return NULL; } - return HasFieldByDescriptor(self, descriptor); + int has_field = HasFieldByDescriptor(self, descriptor); + if (has_field < 0) { + return nullptr; + } else { + return PyBool_FromLong(has_field); + } } // --------------------------------------------------------------------- @@ -1597,57 +1599,45 @@ int InternalReleaseFieldByDescriptor( containers_to_release); } -PyObject* ClearFieldByDescriptor( - CMessage* self, - const FieldDescriptor* field_descriptor) { +int ClearFieldByDescriptor(CMessage* self, + const FieldDescriptor* field_descriptor) { if (!CheckFieldBelongsToMessage(field_descriptor, self->message)) { - return NULL; + return -1; + } + if (InternalReleaseFieldByDescriptor(self, field_descriptor) < 0) { + return -1; } AssureWritable(self); Message* message = self->message; message->GetReflection()->ClearField(message, field_descriptor); - Py_RETURN_NONE; + return 0; } PyObject* ClearField(CMessage* self, PyObject* arg) { - if (!(PyString_Check(arg) || PyUnicode_Check(arg))) { - PyErr_SetString(PyExc_TypeError, "field name must be a string"); - return NULL; - } -#if PY_MAJOR_VERSION < 3 char* field_name; - Py_ssize_t size; - if (PyString_AsStringAndSize(arg, &field_name, &size) < 0) { + Py_ssize_t field_size; + if (PyString_AsStringAndSize(arg, &field_name, &field_size) < 0) { return NULL; } -#else - Py_ssize_t size; - const char* field_name = PyUnicode_AsUTF8AndSize(arg, &size); -#endif AssureWritable(self); - Message* message = self->message; - ScopedPyObjectPtr arg_in_oneof; bool is_in_oneof; - const FieldDescriptor* field_descriptor = - FindFieldWithOneofs(message, string(field_name, size), &is_in_oneof); + const FieldDescriptor* field_descriptor = FindFieldWithOneofs( + self->message, string(field_name, field_size), &is_in_oneof); if (field_descriptor == NULL) { - if (!is_in_oneof) { + if (is_in_oneof) { + // We gave the name of a oneof, and none of its fields are set. + Py_RETURN_NONE; + } else { PyErr_Format(PyExc_ValueError, "Protocol message has no \"%s\" field.", field_name); return NULL; - } else { - Py_RETURN_NONE; } - } else if (is_in_oneof) { - const string& name = field_descriptor->name(); - arg_in_oneof.reset(PyString_FromStringAndSize(name.c_str(), name.size())); - arg = arg_in_oneof.get(); } - if (InternalReleaseFieldByDescriptor(self, field_descriptor) < 0) { - return NULL; + if (ClearFieldByDescriptor(self, field_descriptor) < 0) { + return nullptr; } - return ClearFieldByDescriptor(self, field_descriptor); + Py_RETURN_NONE; } PyObject* Clear(CMessage* self) { @@ -1750,6 +1740,15 @@ static PyObject* InternalSerializeToString( if (size == 0) { return PyBytes_FromString(""); } + + if (size > INT_MAX) { + PyErr_Format(PyExc_ValueError, + "Message %s exceeds maximum protobuf " + "size of 2GB: %zu", + GetMessageName(self).c_str(), size); + return nullptr; + } + PyObject* result = PyBytes_FromStringAndSize(NULL, size); if (result == NULL) { return NULL; @@ -1935,32 +1934,42 @@ static PyObject* MergeFromString(CMessage* self, PyObject* arg) { AssureWritable(self); - io::CodedInputStream input( - reinterpret_cast(data), data_length); - if (allow_oversize_protos) { - input.SetTotalBytesLimit(INT_MAX, INT_MAX); - input.SetRecursionLimit(INT_MAX); - } PyMessageFactory* factory = GetFactoryForMessage(self); - input.SetExtensionRegistry(factory->pool->pool, factory->message_factory); - bool success = self->message->MergePartialFromCodedStream(&input); + int depth = allow_oversize_protos + ? INT_MAX + : io::CodedInputStream::GetDefaultRecursionLimit(); + const char* ptr; + internal::ParseContext ctx( + depth, false, &ptr, + StringPiece(static_cast(data), data_length)); + ctx.data().pool = factory->pool->pool; + ctx.data().factory = factory->message_factory; + + ptr = self->message->_InternalParse(ptr, &ctx); + // Child message might be lazily created before MergeFrom. Make sure they // are mutable at this point if child messages are really created. if (FixupMessageAfterMerge(self) < 0) { return NULL; } - if (success) { - if (!input.ConsumedEntireMessage()) { - // TODO(jieluo): Raise error and return NULL instead. - // b/27494216 - PyErr_Warn(NULL, "Unexpected end-group tag: Not all data was converted"); - } - return PyInt_FromLong(input.CurrentPosition()); - } else { + // Python makes distinction in error message, between a general parse failure + // and in-correct ending on a terminating tag. Hence we need to be a bit more + // explicit in our correctness checks. + if (ptr == nullptr || ctx.BytesUntilLimit(ptr) < 0) { + // Parse error or the parser overshoot the limit. PyErr_Format(DecodeError_class, "Error parsing message"); return NULL; } + // ctx has an explicit limit set (length of string_view), so we have to + // check we ended at that limit. + if (!ctx.EndedAtLimit()) { + // TODO(jieluo): Raise error and return NULL instead. + // b/27494216 + PyErr_Warn(nullptr, "Unexpected end-group tag: Not all data was converted"); + return PyInt_FromLong(data_length - ctx.BytesUntilLimit(ptr)); + } + return PyInt_FromLong(data_length); } static PyObject* ParseFromString(CMessage* self, PyObject* arg) { diff --git a/python/google/protobuf/pyext/message.h b/python/google/protobuf/pyext/message.h index 55be297fce..2f20e2a04f 100644 --- a/python/google/protobuf/pyext/message.h +++ b/python/google/protobuf/pyext/message.h @@ -224,28 +224,19 @@ bool SetSubmessage(CMessage* self, CMessage* submessage); // Corresponds to message api method Clear. PyObject* Clear(CMessage* self); -// Clears the data described by the given descriptor. Used to clear extensions -// (which don't have names). Extension release is handled by ExtensionDict -// class, not this function. -// TODO(anuraag): Try to make this discrepancy in release semantics with -// ClearField less confusing. +// Clears the data described by the given descriptor. +// Returns -1 on error. // // Corresponds to reflection api method ClearField. -PyObject* ClearFieldByDescriptor( - CMessage* self, const FieldDescriptor* descriptor); - -// Clears the data for the given field name. The message is released if there -// are any external references. -// -// Corresponds to reflection api method ClearField. -PyObject* ClearField(CMessage* self, PyObject* arg); +int ClearFieldByDescriptor(CMessage* self, const FieldDescriptor* descriptor); // Checks if the message has the field described by the descriptor. Used for // extensions (which have no name). +// Returns 1 if true, 0 if false, and -1 on error. // // Corresponds to reflection api method HasField -PyObject* HasFieldByDescriptor( - CMessage* self, const FieldDescriptor* field_descriptor); +int HasFieldByDescriptor(CMessage* self, + const FieldDescriptor* field_descriptor); // Checks if the message has the named field. // diff --git a/python/google/protobuf/symbol_database.py b/python/google/protobuf/symbol_database.py index 5ad869f49a..4020b156cd 100644 --- a/python/google/protobuf/symbol_database.py +++ b/python/google/protobuf/symbol_database.py @@ -58,6 +58,7 @@ Example usage: """ +from google.protobuf.internal import api_implementation from google.protobuf import descriptor_pool from google.protobuf import message_factory @@ -88,7 +89,9 @@ class SymbolDatabase(message_factory.MessageFactory): Args: message_descriptor: a descriptor.MessageDescriptor. """ - self.pool.AddDescriptor(message_descriptor) + if api_implementation.Type() == 'python': + # pylint: disable=protected-access + self.pool._AddDescriptor(message_descriptor) def RegisterEnumDescriptor(self, enum_descriptor): """Registers the given enum descriptor in the local database. @@ -99,7 +102,9 @@ class SymbolDatabase(message_factory.MessageFactory): Returns: The provided descriptor. """ - self.pool.AddEnumDescriptor(enum_descriptor) + if api_implementation.Type() == 'python': + # pylint: disable=protected-access + self.pool._AddEnumDescriptor(enum_descriptor) return enum_descriptor def RegisterServiceDescriptor(self, service_descriptor): @@ -111,7 +116,9 @@ class SymbolDatabase(message_factory.MessageFactory): Returns: The provided descriptor. """ - self.pool.AddServiceDescriptor(service_descriptor) + if api_implementation.Type() == 'python': + # pylint: disable=protected-access + self.pool._AddServiceDescriptor(service_descriptor) def RegisterFileDescriptor(self, file_descriptor): """Registers the given file descriptor in the local database. @@ -122,7 +129,9 @@ class SymbolDatabase(message_factory.MessageFactory): Returns: The provided descriptor. """ - self.pool.AddFileDescriptor(file_descriptor) + if api_implementation.Type() == 'python': + # pylint: disable=protected-access + self.pool._InternalAddFileDescriptor(file_descriptor) def GetSymbol(self, symbol): """Tries to find a symbol in the local database. diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py index 9f860741e4..ecdfd5a714 100755 --- a/python/google/protobuf/text_format.py +++ b/python/google/protobuf/text_format.py @@ -42,6 +42,9 @@ Simple usage example: __author__ = 'kenton@google.com (Kenton Varda)' +# TODO(b/129989314) Import thread contention leads to test failures. +import encodings.raw_unicode_escape # pylint: disable=unused-import +import encodings.unicode_escape # pylint: disable=unused-import import io import re @@ -455,8 +458,8 @@ class _Printer(object): if self.as_one_line: out.write('} ') else: - out.write('}\n') self.indent -= 2 + out.write(' ' * self.indent + '}\n') elif field.wire_type == WIRETYPE_LENGTH_DELIMITED: try: # If this field is parseable as a Message, it is probably @@ -479,8 +482,8 @@ class _Printer(object): if self.as_one_line: out.write('} ') else: - out.write('}\n') self.indent -= 2 + out.write(' ' * self.indent + '}\n') else: # A string or bytes field. self.as_utf8 may not work. out.write(': \"') diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index aa720e3ce1..898987bdb7 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -171,7 +171,6 @@ void Any::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { @@ -212,63 +211,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Any::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Any) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string type_url = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_type_url())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_type_url().data(), static_cast(this->_internal_type_url().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Any.type_url")); - } else { - goto handle_unusual; - } - break; - } - - // bytes value = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadBytes( - input, this->_internal_mutable_value())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Any) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Any) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Any::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index f378d9b090..d85bb6c436 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -151,12 +151,7 @@ class PROTOBUF_EXPORT Any : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 1c943d13ad..001079d82e 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -215,7 +215,7 @@ Api::Api(const Api& from) if (!from._internal_version().empty()) { version_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.version_); } - if (from.has_source_context()) { + if (from._internal_has_source_context()) { source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); } else { source_context_ = nullptr; @@ -272,7 +272,6 @@ void Api::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { @@ -293,7 +292,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_methods(), ptr); + ptr = ctx->ParseMessage(_internal_add_methods(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); @@ -305,7 +304,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_options(), ptr); + ptr = ctx->ParseMessage(_internal_add_options(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); @@ -321,7 +320,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern // .google.protobuf.SourceContext source_context = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { - ptr = ctx->ParseMessage(mutable_source_context(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -331,7 +330,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_mixins(), ptr); + ptr = ctx->ParseMessage(_internal_add_mixins(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); @@ -342,7 +341,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); - set_syntax(static_cast(val)); + _internal_set_syntax(static_cast(val)); } else goto handle_unusual; continue; default: { @@ -364,125 +363,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Api::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Api) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Api.name")); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Method methods = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_methods())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Option options = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_options())); - } else { - goto handle_unusual; - } - break; - } - - // string version = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_version())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_version().data(), static_cast(this->_internal_version().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Api.version")); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.SourceContext source_context = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_source_context())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Mixin mixins = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_mixins())); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.Syntax syntax = 7; - case 7: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (56 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - set_syntax(static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(value)); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Api) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Api) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Api::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -501,19 +381,19 @@ failure: } // repeated .google.protobuf.Method methods = 2; - for (auto it = this->methods_.pointer_begin(), - end = this->methods_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_methods_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(2, **it, target, stream); + InternalWriteMessageToArray(2, this->_internal_methods(i), target, stream); } // repeated .google.protobuf.Option options = 3; - for (auto it = this->options_.pointer_begin(), - end = this->options_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_options_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(3, **it, target, stream); + InternalWriteMessageToArray(3, this->_internal_options(i), target, stream); } // string version = 4; @@ -535,18 +415,18 @@ failure: } // repeated .google.protobuf.Mixin mixins = 6; - for (auto it = this->mixins_.pointer_begin(), - end = this->mixins_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_mixins_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(6, **it, target, stream); + InternalWriteMessageToArray(6, this->_internal_mixins(i), target, stream); } // .google.protobuf.Syntax syntax = 7; if (this->syntax() != 0) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 7, this->syntax(), target); + 7, this->_internal_syntax(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -566,21 +446,21 @@ size_t Api::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.Method methods = 2; - total_size += 1UL * this->methods_size(); + total_size += 1UL * this->_internal_methods_size(); for (const auto& msg : this->methods_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.Option options = 3; - total_size += 1UL * this->options_size(); + total_size += 1UL * this->_internal_options_size(); for (const auto& msg : this->options_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.Mixin mixins = 6; - total_size += 1UL * this->mixins_size(); + total_size += 1UL * this->_internal_mixins_size(); for (const auto& msg : this->mixins_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -610,7 +490,7 @@ size_t Api::ByteSizeLong() const { // .google.protobuf.Syntax syntax = 7; if (this->syntax() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->syntax()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -656,10 +536,10 @@ void Api::MergeFrom(const Api& from) { version_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.version_); } if (from.has_source_context()) { - mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from.source_context()); + _internal_mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); } if (from.syntax() != 0) { - set_syntax(from.syntax()); + _internal_set_syntax(from._internal_syntax()); } } @@ -785,7 +665,6 @@ void Method::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { @@ -834,7 +713,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_options(), ptr); + ptr = ctx->ParseMessage(_internal_add_options(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); @@ -845,7 +724,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); - set_syntax(static_cast(val)); + _internal_set_syntax(static_cast(val)); } else goto handle_unusual; continue; default: { @@ -867,133 +746,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Method::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Method) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Method.name")); - } else { - goto handle_unusual; - } - break; - } - - // string request_type_url = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_request_type_url())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_request_type_url().data(), static_cast(this->_internal_request_type_url().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Method.request_type_url")); - } else { - goto handle_unusual; - } - break; - } - - // bool request_streaming = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &request_streaming_))); - } else { - goto handle_unusual; - } - break; - } - - // string response_type_url = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_response_type_url())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_response_type_url().data(), static_cast(this->_internal_response_type_url().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Method.response_type_url")); - } else { - goto handle_unusual; - } - break; - } - - // bool response_streaming = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (40 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &response_streaming_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Option options = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_options())); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.Syntax syntax = 7; - case 7: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (56 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - set_syntax(static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(value)); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Method) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Method) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Method::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1024,7 +776,7 @@ failure: // bool request_streaming = 3; if (this->request_streaming() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->request_streaming(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_request_streaming(), target); } // string response_type_url = 4; @@ -1040,22 +792,22 @@ failure: // bool response_streaming = 5; if (this->response_streaming() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->response_streaming(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_response_streaming(), target); } // repeated .google.protobuf.Option options = 6; - for (auto it = this->options_.pointer_begin(), - end = this->options_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_options_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(6, **it, target, stream); + InternalWriteMessageToArray(6, this->_internal_options(i), target, stream); } // .google.protobuf.Syntax syntax = 7; if (this->syntax() != 0) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 7, this->syntax(), target); + 7, this->_internal_syntax(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1075,7 +827,7 @@ size_t Method::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.Option options = 6; - total_size += 1UL * this->options_size(); + total_size += 1UL * this->_internal_options_size(); for (const auto& msg : this->options_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -1115,7 +867,7 @@ size_t Method::ByteSizeLong() const { // .google.protobuf.Syntax syntax = 7; if (this->syntax() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->syntax()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1163,13 +915,13 @@ void Method::MergeFrom(const Method& from) { response_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.response_type_url_); } if (from.request_streaming() != 0) { - set_request_streaming(from.request_streaming()); + _internal_set_request_streaming(from._internal_request_streaming()); } if (from.response_streaming() != 0) { - set_response_streaming(from.response_streaming()); + _internal_set_response_streaming(from._internal_response_streaming()); } if (from.syntax() != 0) { - set_syntax(from.syntax()); + _internal_set_syntax(from._internal_syntax()); } } @@ -1275,7 +1027,6 @@ void Mixin::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { @@ -1316,67 +1067,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Mixin::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Mixin) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Mixin.name")); - } else { - goto handle_unusual; - } - break; - } - - // string root = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_root())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_root().data(), static_cast(this->_internal_root().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Mixin.root")); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Mixin) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Mixin) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Mixin::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 0d919e3868..4ced2978c9 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -145,12 +145,7 @@ class PROTOBUF_EXPORT Api : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -197,10 +192,17 @@ class PROTOBUF_EXPORT Api : }; // repeated .google.protobuf.Method methods = 2; int methods_size() const; + private: + int _internal_methods_size() const; + public: void clear_methods(); PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >* mutable_methods(); + private: + const PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const; + PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods(); + public: const PROTOBUF_NAMESPACE_ID::Method& methods(int index) const; PROTOBUF_NAMESPACE_ID::Method* add_methods(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& @@ -208,10 +210,17 @@ class PROTOBUF_EXPORT Api : // repeated .google.protobuf.Option options = 3; int options_size() const; + private: + int _internal_options_size() const; + public: void clear_options(); PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); + private: + const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + public: const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; PROTOBUF_NAMESPACE_ID::Option* add_options(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& @@ -219,10 +228,17 @@ class PROTOBUF_EXPORT Api : // repeated .google.protobuf.Mixin mixins = 6; int mixins_size() const; + private: + int _internal_mixins_size() const; + public: void clear_mixins(); PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >* mutable_mixins(); + private: + const PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const; + PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins(); + public: const PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const; PROTOBUF_NAMESPACE_ID::Mixin* add_mixins(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& @@ -270,11 +286,19 @@ class PROTOBUF_EXPORT Api : PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + private: + const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; + PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); + public: // .google.protobuf.Syntax syntax = 7; void clear_syntax(); PROTOBUF_NAMESPACE_ID::Syntax syntax() const; void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + private: + PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Api) private: @@ -362,12 +386,7 @@ class PROTOBUF_EXPORT Method : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -414,10 +433,17 @@ class PROTOBUF_EXPORT Method : }; // repeated .google.protobuf.Option options = 6; int options_size() const; + private: + int _internal_options_size() const; + public: void clear_options(); PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); + private: + const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + public: const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; PROTOBUF_NAMESPACE_ID::Option* add_options(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& @@ -475,16 +501,28 @@ class PROTOBUF_EXPORT Method : void clear_request_streaming(); bool request_streaming() const; void set_request_streaming(bool value); + private: + bool _internal_request_streaming() const; + void _internal_set_request_streaming(bool value); + public: // bool response_streaming = 5; void clear_response_streaming(); bool response_streaming() const; void set_response_streaming(bool value); + private: + bool _internal_response_streaming() const; + void _internal_set_response_streaming(bool value); + public: // .google.protobuf.Syntax syntax = 7; void clear_syntax(); PROTOBUF_NAMESPACE_ID::Syntax syntax() const; void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + private: + PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Method) private: @@ -572,12 +610,7 @@ class PROTOBUF_EXPORT Mixin : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -731,9 +764,12 @@ inline void Api::set_allocated_name(std::string* name) { } // repeated .google.protobuf.Method methods = 2; -inline int Api::methods_size() const { +inline int Api::_internal_methods_size() const { return methods_.size(); } +inline int Api::methods_size() const { + return _internal_methods_size(); +} inline void Api::clear_methods() { methods_.Clear(); } @@ -746,13 +782,19 @@ Api::mutable_methods() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) return &methods_; } +inline const PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const { + return methods_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Method& Api::methods(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.methods) - return methods_.Get(index); + return _internal_methods(index); +} +inline PROTOBUF_NAMESPACE_ID::Method* Api::_internal_add_methods() { + return methods_.Add(); } inline PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() { // @@protoc_insertion_point(field_add:google.protobuf.Api.methods) - return methods_.Add(); + return _internal_add_methods(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& Api::methods() const { @@ -761,9 +803,12 @@ Api::methods() const { } // repeated .google.protobuf.Option options = 3; -inline int Api::options_size() const { +inline int Api::_internal_options_size() const { return options_.size(); } +inline int Api::options_size() const { + return _internal_options_size(); +} inline PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) return options_.Mutable(index); @@ -773,13 +818,19 @@ Api::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) return &options_; } +inline const PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const { + return options_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Option& Api::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.options) - return options_.Get(index); + return _internal_options(index); +} +inline PROTOBUF_NAMESPACE_ID::Option* Api::_internal_add_options() { + return options_.Add(); } inline PROTOBUF_NAMESPACE_ID::Option* Api::add_options() { // @@protoc_insertion_point(field_add:google.protobuf.Api.options) - return options_.Add(); + return _internal_add_options(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& Api::options() const { @@ -848,15 +899,21 @@ inline void Api::set_allocated_version(std::string* version) { } // .google.protobuf.SourceContext source_context = 5; -inline bool Api::has_source_context() const { +inline bool Api::_internal_has_source_context() const { return this != internal_default_instance() && source_context_ != nullptr; } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const { +inline bool Api::has_source_context() const { + return _internal_has_source_context(); +} +inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; - // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) + return _internal_source_context(); +} inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) @@ -864,15 +921,18 @@ inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { source_context_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { +inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { if (source_context_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); source_context_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) return source_context_; } +inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) + return _internal_mutable_source_context(); +} inline void Api::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -893,9 +953,12 @@ inline void Api::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceConte } // repeated .google.protobuf.Mixin mixins = 6; -inline int Api::mixins_size() const { +inline int Api::_internal_mixins_size() const { return mixins_.size(); } +inline int Api::mixins_size() const { + return _internal_mixins_size(); +} inline void Api::clear_mixins() { mixins_.Clear(); } @@ -908,13 +971,19 @@ Api::mutable_mixins() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins) return &mixins_; } +inline const PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const { + return mixins_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Mixin& Api::mixins(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins) - return mixins_.Get(index); + return _internal_mixins(index); +} +inline PROTOBUF_NAMESPACE_ID::Mixin* Api::_internal_add_mixins() { + return mixins_.Add(); } inline PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() { // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins) - return mixins_.Add(); + return _internal_add_mixins(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& Api::mixins() const { @@ -926,13 +995,19 @@ Api::mixins() const { inline void Api::clear_syntax() { syntax_ = 0; } +inline PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { + return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +} inline PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax) - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); + return _internal_syntax(); } -inline void Api::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Api::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; +} +inline void Api::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { + _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax) } @@ -1064,13 +1139,19 @@ inline void Method::set_allocated_request_type_url(std::string* request_type_url inline void Method::clear_request_streaming() { request_streaming_ = false; } +inline bool Method::_internal_request_streaming() const { + return request_streaming_; +} inline bool Method::request_streaming() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming) - return request_streaming_; + return _internal_request_streaming(); } -inline void Method::set_request_streaming(bool value) { +inline void Method::_internal_set_request_streaming(bool value) { request_streaming_ = value; +} +inline void Method::set_request_streaming(bool value) { + _internal_set_request_streaming(value); // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming) } @@ -1138,20 +1219,29 @@ inline void Method::set_allocated_response_type_url(std::string* response_type_u inline void Method::clear_response_streaming() { response_streaming_ = false; } +inline bool Method::_internal_response_streaming() const { + return response_streaming_; +} inline bool Method::response_streaming() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming) - return response_streaming_; + return _internal_response_streaming(); } -inline void Method::set_response_streaming(bool value) { +inline void Method::_internal_set_response_streaming(bool value) { response_streaming_ = value; +} +inline void Method::set_response_streaming(bool value) { + _internal_set_response_streaming(value); // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming) } // repeated .google.protobuf.Option options = 6; -inline int Method::options_size() const { +inline int Method::_internal_options_size() const { return options_.size(); } +inline int Method::options_size() const { + return _internal_options_size(); +} inline PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) return options_.Mutable(index); @@ -1161,13 +1251,19 @@ Method::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) return &options_; } +inline const PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const { + return options_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Option& Method::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Method.options) - return options_.Get(index); + return _internal_options(index); +} +inline PROTOBUF_NAMESPACE_ID::Option* Method::_internal_add_options() { + return options_.Add(); } inline PROTOBUF_NAMESPACE_ID::Option* Method::add_options() { // @@protoc_insertion_point(field_add:google.protobuf.Method.options) - return options_.Add(); + return _internal_add_options(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& Method::options() const { @@ -1179,13 +1275,19 @@ Method::options() const { inline void Method::clear_syntax() { syntax_ = 0; } +inline PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { + return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +} inline PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax) - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); + return _internal_syntax(); } -inline void Method::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Method::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; +} +inline void Method::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { + _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax) } diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index 4a678d5e66..63f022474f 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -690,7 +690,7 @@ class PROTOBUF_EXPORT alignas(8) Arena final { !has_get_arena::value, int>::type = 0> PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) { - (void) value; + (void)value; return nullptr; } diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 8222d7dcbc..4d25c3a58a 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -413,7 +413,9 @@ class CommandLineInterface::MemoryOutputStream // implements ZeroCopyOutputStream --------------------------------- virtual bool Next(void** data, int* size) { return inner_->Next(data, size); } virtual void BackUp(int count) { inner_->BackUp(count); } - virtual int64 ByteCount() const { return inner_->ByteCount(); } + virtual int64 ByteCount() const { + return inner_->ByteCount(); + } private: // Checks to see if "filename_.meta" exists in directory_; if so, fixes the @@ -1062,15 +1064,19 @@ bool CommandLineInterface::ParseInputFiles( DescriptorPool* descriptor_pool, std::vector* parsed_files) { + // Track unused imports in all source files + for (const auto& input_file : input_files_) { + descriptor_pool->AddUnusedImportTrackFile(input_file); + } + bool result = true; // Parse each file. for (const auto& input_file : input_files_) { // Import the file. - descriptor_pool->AddUnusedImportTrackFile(input_file); const FileDescriptor* parsed_file = descriptor_pool->FindFileByName(input_file); - descriptor_pool->ClearUnusedImportTrackFiles(); if (parsed_file == NULL) { - return false; + result = false; + break; } parsed_files->push_back(parsed_file); @@ -1080,7 +1086,8 @@ bool CommandLineInterface::ParseInputFiles( << ": This file contains services, but " "--disallow_services was used." << std::endl; - return false; + result = false; + break; } // Enforce --direct_dependencies @@ -1098,11 +1105,13 @@ bool CommandLineInterface::ParseInputFiles( } } if (indirect_imports) { - return false; + result = false; + break; } } } - return true; + descriptor_pool->ClearUnusedImportTrackFiles(); + return result; } void CommandLineInterface::Clear() { @@ -1431,13 +1440,12 @@ CommandLineInterface::InterpretArgument(const std::string& name, // On Windows, the shell (typically cmd.exe) does not expand wildcards in // file names (e.g. foo\*.proto), so we do it ourselves. switch (google::protobuf::io::win32::ExpandWildcards( - value, - [this](const string& path) { - this->input_files_.push_back(path); - })) { + value, + [this](const string& path) { this->input_files_.push_back(path); })) { case google::protobuf::io::win32::ExpandWildcardsResult::kSuccess: break; - case google::protobuf::io::win32::ExpandWildcardsResult::kErrorNoMatchingFile: + case google::protobuf::io::win32::ExpandWildcardsResult:: + kErrorNoMatchingFile: // Path does not exist, is not a file, or it's longer than MAX_PATH and // long path handling is disabled. std::cerr << "Invalid file name pattern or missing input file \"" @@ -1448,7 +1456,7 @@ CommandLineInterface::InterpretArgument(const std::string& name, << "\" to or from Windows style" << std::endl; return PARSE_ARGUMENT_FAIL; } -#else // not _WIN32 +#else // not _WIN32 // On other platforms than Windows (e.g. Linux, Mac OS) the shell (typically // Bash) expands wildcards. input_files_.push_back(value); diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index 01e69ee38e..6a9dec4f1c 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -56,9 +56,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -142,6 +142,10 @@ class CommandLineInterfaceTest : public testing::Test { // substring. void ExpectErrorSubstring(const std::string& expected_substring); + // Checks that Run() returned zero and the stderr contains the given + // substring. + void ExpectWarningSubstring(const std::string& expected_substring); + // Checks that the captured stdout is the same as the expected_text. void ExpectCapturedStdout(const std::string& expected_text); @@ -406,6 +410,12 @@ void CommandLineInterfaceTest::ExpectErrorSubstring( EXPECT_PRED_FORMAT2(testing::IsSubstring, expected_substring, error_text_); } +void CommandLineInterfaceTest::ExpectWarningSubstring( + const std::string& expected_substring) { + EXPECT_EQ(0, return_code_); + EXPECT_PRED_FORMAT2(testing::IsSubstring, expected_substring, error_text_); +} + #if defined(_WIN32) && !defined(__CYGWIN__) bool CommandLineInterfaceTest::HasAlternateErrorSubstring( const std::string& expected_substring) { @@ -835,6 +845,69 @@ TEST_F(CommandLineInterfaceTest, ExpectErrorSubstring("bar.proto: \"Baz\" is not defined."); } +TEST_F(CommandLineInterfaceTest, + OnlyReportsUnusedImportsForFilesBeingGenerated) { + CreateTempFile("unused.proto", + "syntax = \"proto2\";\n" + "message Unused {}\n"); + CreateTempFile("bar.proto", + "syntax = \"proto2\";\n" + "import \"unused.proto\";\n" + "message Bar {}\n"); + CreateTempFile("foo.proto", + "syntax = \"proto2\";\n" + "import \"bar.proto\";\n" + "message Foo {\n" + " optional Bar bar = 1;\n" + "}\n"); + + Run("protocol_compiler --test_out=$tmpdir " + "--proto_path=$tmpdir foo.proto"); + ExpectNoErrors(); +} + +TEST_F(CommandLineInterfaceTest, ReportsTransitiveMisingImports_LeafFirst) { + CreateTempFile("unused.proto", + "syntax = \"proto2\";\n" + "message Unused {}\n"); + CreateTempFile("bar.proto", + "syntax = \"proto2\";\n" + "import \"unused.proto\";\n" + "message Bar {}\n"); + CreateTempFile("foo.proto", + "syntax = \"proto2\";\n" + "import \"bar.proto\";\n" + "message Foo {\n" + " optional Bar bar = 1;\n" + "}\n"); + + Run("protocol_compiler --test_out=$tmpdir " + "--proto_path=$tmpdir bar.proto foo.proto"); + ExpectWarningSubstring( + "bar.proto:2:1: warning: Import unused.proto but not used."); +} + +TEST_F(CommandLineInterfaceTest, ReportsTransitiveMisingImports_LeafLast) { + CreateTempFile("unused.proto", + "syntax = \"proto2\";\n" + "message Unused {}\n"); + CreateTempFile("bar.proto", + "syntax = \"proto2\";\n" + "import \"unused.proto\";\n" + "message Bar {}\n"); + CreateTempFile("foo.proto", + "syntax = \"proto2\";\n" + "import \"bar.proto\";\n" + "message Foo {\n" + " optional Bar bar = 1;\n" + "}\n"); + + Run("protocol_compiler --test_out=$tmpdir " + "--proto_path=$tmpdir foo.proto bar.proto"); + ExpectWarningSubstring( + "bar.proto:2:1: warning: Import unused.proto but not used."); +} + TEST_F(CommandLineInterfaceTest, CreateDirectory) { // Test that when we output to a sub-directory, it is created. diff --git a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc index 3e2b3ce275..f14074d91c 100755 --- a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc @@ -44,6 +44,8 @@ #include +#include +#include #include #include #include @@ -51,15 +53,12 @@ #include #include #include +#include +#include #include #include #include -#include -#include -#include -#include - namespace google { namespace protobuf { namespace compiler { @@ -178,16 +177,16 @@ TEST(BootstrapTest, GeneratedFilesMatch) { } } -//test Generate in cpp_generator.cc -TEST(BootstrapTest, OptionNotExist) -{ +// test Generate in cpp_generator.cc +TEST(BootstrapTest, OptionNotExist) { cpp::CppGenerator generator; DescriptorPool pool; - GeneratorContext *generator_context = nullptr; + GeneratorContext* generator_context = nullptr; std::string parameter = "aaa"; string error; - ASSERT_FALSE(generator.Generate(pool.FindFileByName("google/protobuf/descriptor.proto"), - parameter, generator_context, &error)); + ASSERT_FALSE(generator.Generate( + pool.FindFileByName("google/protobuf/descriptor.proto"), parameter, + generator_context, &error)); EXPECT_EQ(error, "Unknown generator option: " + parameter); } diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index 9fdde41207..b89bc933a1 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -77,7 +77,11 @@ void EnumFieldGenerator::GenerateAccessorDeclarations( Formatter format(printer, variables_); format( "$deprecated_attr$$type$ ${1$$name$$}$() const;\n" - "$deprecated_attr$void ${1$set_$name$$}$($type$ value);\n", + "$deprecated_attr$void ${1$set_$name$$}$($type$ value);\n" + "private:\n" + "$type$ ${1$_internal_$name$$}$() const;\n" + "void ${1$_internal_set_$name$$}$($type$ value);\n" + "public:\n", descriptor_); } @@ -85,19 +89,25 @@ void EnumFieldGenerator::GenerateInlineAccessorDefinitions( io::Printer* printer) const { Formatter format(printer, variables_); format( + "inline $type$ $classname$::_internal_$name$() const {\n" + " return static_cast< $type$ >($name$_);\n" + "}\n" "inline $type$ $classname$::$name$() const {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return static_cast< $type$ >($name$_);\n" + " return _internal_$name$();\n" "}\n" - "inline void $classname$::set_$name$($type$ value) {\n" - "$annotate_accessor$"); + "inline void $classname$::_internal_set_$name$($type$ value) {\n"); if (!HasPreservingUnknownEnumSemantics(descriptor_)) { format(" assert($type$_IsValid(value));\n"); } format( " $set_hasbit$\n" " $name$_ = value;\n" + "}\n" + "inline void $classname$::set_$name$($type$ value) {\n" + "$annotate_accessor$" + " _internal_set_$name$(value);\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n"); } @@ -109,7 +119,7 @@ void EnumFieldGenerator::GenerateClearingCode(io::Printer* printer) const { void EnumFieldGenerator::GenerateMergingCode(io::Printer* printer) const { Formatter format(printer, variables_); - format("set_$name$(from.$name$());\n"); + format("_internal_set_$name$(from._internal_$name$());\n"); } void EnumFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { @@ -128,51 +138,22 @@ void EnumFieldGenerator::GenerateCopyConstructorCode( format("$name$_ = from.$name$_;\n"); } -void EnumFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "int value = 0;\n" - "DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n" - " int, ::$proto_ns$::internal::WireFormatLite::TYPE_ENUM>(\n" - " input, &value)));\n"); - if (HasPreservingUnknownEnumSemantics(descriptor_)) { - format("set_$name$(static_cast< $type$ >(value));\n"); - } else { - format( - "if ($type$_IsValid(value)) {\n" - " set_$name$(static_cast< $type$ >(value));\n"); - if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - "} else {\n" - " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<$uint64$>(value));\n"); - } else { - format( - "} else {\n" - " unknown_fields_stream.WriteVarint32($1$u);\n" - " unknown_fields_stream.WriteVarint32(\n" - " static_cast<$uint32$>(value));\n", - internal::WireFormat::MakeTag(descriptor_)); - } - format("}\n"); - } -} - void EnumFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); format( "stream->EnsureSpace(&target);\n" "target = ::$proto_ns$::internal::WireFormatLite::WriteEnumToArray(\n" - " $number$, this->$name$(), target);\n"); + " $number$, this->_internal_$name$(), target);\n"); } void EnumFieldGenerator::GenerateByteSize(io::Printer* printer) const { Formatter format(printer, variables_); format( "total_size += $tag_size$ +\n" - " ::$proto_ns$::internal::WireFormatLite::EnumSize(this->$name$());\n"); + " " + "::$proto_ns$::internal::WireFormatLite::EnumSize(this->_internal_$name$(" + "));\n"); } // =================================================================== @@ -189,26 +170,32 @@ void EnumOneofFieldGenerator::GenerateInlineAccessorDefinitions( io::Printer* printer) const { Formatter format(printer, variables_); format( - "inline $type$ $classname$::$name$() const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " if (has_$name$()) {\n" + "inline $type$ $classname$::_internal_$name$() const {\n" + " if (_internal_has_$name$()) {\n" " return static_cast< $type$ >($field_member$);\n" " }\n" " return static_cast< $type$ >($default$);\n" "}\n" - "inline void $classname$::set_$name$($type$ value) {\n" - "$annotate_accessor$"); + "inline $type$ $classname$::$name$() const {\n" + "$annotate_accessor$" + " // @@protoc_insertion_point(field_get:$full_name$)\n" + " return _internal_$name$();\n" + "}\n" + "inline void $classname$::_internal_set_$name$($type$ value) {\n"); if (!HasPreservingUnknownEnumSemantics(descriptor_)) { format(" assert($type$_IsValid(value));\n"); } format( - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " }\n" " $field_member$ = value;\n" + "}\n" + "inline void $classname$::set_$name$($type$ value) {\n" + "$annotate_accessor$" " // @@protoc_insertion_point(field_set:$full_name$)\n" + " _internal_set_$name$(value);\n" "}\n"); } @@ -251,6 +238,12 @@ void RepeatedEnumFieldGenerator::GenerateAccessorDeclarations( io::Printer* printer) const { Formatter format(printer, variables_); format( + "private:\n" + "$type$ ${1$_internal_$name$$}$(int index) const;\n" + "void ${1$_internal_add_$name$$}$($type$ value);\n" + "::$proto_ns$::RepeatedField* " + "${1$_internal_mutable_$name$$}$();\n" + "public:\n" "$deprecated_attr$$type$ ${1$$name$$}$(int index) const;\n" "$deprecated_attr$void ${1$set_$name$$}$(int index, $type$ value);\n" "$deprecated_attr$void ${1$add_$name$$}$($type$ value);\n" @@ -265,10 +258,13 @@ void RepeatedEnumFieldGenerator::GenerateInlineAccessorDefinitions( io::Printer* printer) const { Formatter format(printer, variables_); format( + "inline $type$ $classname$::_internal_$name$(int index) const {\n" + " return static_cast< $type$ >($name$_.Get(index));\n" + "}\n" "inline $type$ $classname$::$name$(int index) const {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return static_cast< $type$ >($name$_.Get(index));\n" + " return _internal_$name$(index);\n" "}\n" "inline void $classname$::set_$name$(int index, $type$ value) {\n" "$annotate_accessor$"); @@ -279,14 +275,17 @@ void RepeatedEnumFieldGenerator::GenerateInlineAccessorDefinitions( " $name$_.Set(index, value);\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" - "inline void $classname$::add_$name$($type$ value) {\n" - "$annotate_accessor$"); + "inline void $classname$::_internal_add_$name$($type$ value) {\n"); if (!HasPreservingUnknownEnumSemantics(descriptor_)) { format(" assert($type$_IsValid(value));\n"); } format( " $name$_.Add(value);\n" + "}\n" + "inline void $classname$::add_$name$($type$ value) {\n" + "$annotate_accessor$" " // @@protoc_insertion_point(field_add:$full_name$)\n" + " _internal_add_$name$(value);\n" "}\n" "inline const ::$proto_ns$::RepeatedField&\n" "$classname$::$name$() const {\n" @@ -295,10 +294,14 @@ void RepeatedEnumFieldGenerator::GenerateInlineAccessorDefinitions( " return $name$_;\n" "}\n" "inline ::$proto_ns$::RepeatedField*\n" + "$classname$::_internal_mutable_$name$() {\n" + " return &$name$_;\n" + "}\n" + "inline ::$proto_ns$::RepeatedField*\n" "$classname$::mutable_$name$() {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" - " return &$name$_;\n" + " return _internal_mutable_$name$();\n" "}\n"); } @@ -369,7 +372,7 @@ void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStreamWithPacking( " $number$,\n" " nullptr,\n" " nullptr,\n" - " this->mutable_$name$())));\n"); + " this->_internal_mutable_$name$())));\n"); } else if (UseUnknownFieldSet(descriptor_->file(), options_)) { format( "DO_((::$proto_ns$::internal::WireFormat::" @@ -378,7 +381,7 @@ void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStreamWithPacking( " $number$,\n" " $type$_IsValid,\n" " mutable_unknown_fields(),\n" - " this->mutable_$name$())));\n"); + " this->_internal_mutable_$name$())));\n"); } else { format( "DO_((::$proto_ns$::internal::" @@ -387,7 +390,7 @@ void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStreamWithPacking( " $number$,\n" " $type$_IsValid,\n" " &unknown_fields_stream,\n" - " this->mutable_$name$())));\n"); + " this->_internal_mutable_$name$())));\n"); } } else { format( @@ -405,7 +408,7 @@ void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStreamWithPacking( } else { format( " if ($type$_IsValid(value)) {\n" - " add_$name$(static_cast< $type$ >(value));\n" + " _internal_add_$name$(static_cast< $type$ >(value));\n" " } else {\n"); if (UseUnknownFieldSet(descriptor_->file(), options_)) { format( @@ -441,10 +444,10 @@ void RepeatedEnumFieldGenerator::GenerateSerializeWithCachedSizesToArray( "}\n"); } else { format( - "for (const auto& x : this->$name$()) {\n" + "for (int i = 0, n = this->_internal_$name$_size(); i < n; i++) {\n" " stream->EnsureSpace(&target);\n" " target = ::$proto_ns$::internal::WireFormatLite::WriteEnumToArray(\n" - " $number$, x, target);\n" + " $number$, this->_internal_$name$(i), target);\n" "}\n"); } } @@ -454,12 +457,13 @@ void RepeatedEnumFieldGenerator::GenerateByteSize(io::Printer* printer) const { format( "{\n" " size_t data_size = 0;\n" - " unsigned int count = static_cast(this->$name$_size());"); + " unsigned int count = static_cast(this->_internal_$name$_size());"); format.Indent(); format( "for (unsigned int i = 0; i < count; i++) {\n" " data_size += ::$proto_ns$::internal::WireFormatLite::EnumSize(\n" - " this->$name$(static_cast(i)));\n" + " this->_internal_$name$(static_cast(i)));\n" "}\n"); if (descriptor_->is_packed()) { diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.h b/src/google/protobuf/compiler/cpp/cpp_enum_field.h index 7226a7afb6..3b97608eaf 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.h @@ -58,7 +58,6 @@ class EnumFieldGenerator : public FieldGenerator { void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_field.cc b/src/google/protobuf/compiler/cpp/cpp_field.cc index e9b1d42165..890387eb65 100644 --- a/src/google/protobuf/compiler/cpp/cpp_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_field.cc @@ -113,17 +113,6 @@ void SetCommonOneofFieldVariables( FieldGenerator::~FieldGenerator() {} -void FieldGenerator::GenerateMergeFromCodedStreamWithPacking( - io::Printer* printer) const { - // Reaching here indicates a bug. Cases are: - // - This FieldGenerator should support packing, but this method should be - // overridden. - // - This FieldGenerator doesn't support packing, and this method should - // never have been called. - GOOGLE_LOG(FATAL) << "GenerateMergeFromCodedStreamWithPacking() " - << "called on field generator that does not support packing."; -} - FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer) diff --git a/src/google/protobuf/compiler/cpp/cpp_field.h b/src/google/protobuf/compiler/cpp/cpp_field.h index 470899ec65..aef9aaf304 100644 --- a/src/google/protobuf/compiler/cpp/cpp_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_field.h @@ -168,19 +168,6 @@ class FieldGenerator { virtual void GenerateDefaultInstanceAllocator( io::Printer* /*printer*/) const {} - // Generate lines to decode this field, which will be placed inside the - // message's MergeFromCodedStream() method. - virtual void GenerateMergeFromCodedStream(io::Printer* printer) const = 0; - - // Returns true if this field's "MergeFromCodedStream" code needs the arena - // to be defined as a variable. - virtual bool MergeFromCodedStreamNeedsArena() const { return false; } - - // Generate lines to decode this field from a packed value, which will be - // placed inside the message's MergeFromCodedStream() method. - virtual void GenerateMergeFromCodedStreamWithPacking( - io::Printer* printer) const; - // Generate lines to serialize this field directly to the array "target", // which are placed within the message's SerializeWithCachedSizesToArray() // method. This must also advance "target" past the written bytes. diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc index 8449b3573c..66565fb5b7 100644 --- a/src/google/protobuf/compiler/cpp/cpp_file.cc +++ b/src/google/protobuf/compiler/cpp/cpp_file.cc @@ -414,7 +414,7 @@ void FileGenerator::GenerateSourceIncludes(io::Printer* printer) { if (IsProto2MessageSetFile(file_, options_)) { format( // Implementation of proto1 MessageSet API methods. - "#include \"net/proto2/bridge/internal/message_set_util.h\"\n"); + "#include \"net/proto2/internal/message_set_util.h\"\n"); } if (options_.proto_h) { @@ -591,10 +591,6 @@ void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) { // Define default instances GenerateSourceDefaultInstance(idx, printer); - if (options_.lite_implicit_weak_fields) { - format("void $1$_ReferenceStrong() {}\n", - message_generators_[idx]->classname_); - } // Generate classes. format("\n"); @@ -665,10 +661,6 @@ void FileGenerator::GenerateSource(io::Printer* printer) { // Define default instances for (int i = 0; i < message_generators_.size(); i++) { GenerateSourceDefaultInstance(i, printer); - if (options_.lite_implicit_weak_fields) { - format("void $1$_ReferenceStrong() {}\n", - message_generators_[i]->classname_); - } } } @@ -1159,9 +1151,6 @@ class FileGenerator::ForwardDeclarations { "$dllexport_decl $extern $3$ $4$;\n", class_desc, classname, DefaultInstanceType(class_desc, options), DefaultInstanceName(class_desc, options)); - if (options.lite_implicit_weak_fields) { - format("void $1$_ReferenceStrong();\n", classname); - } } } diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc index 8f9b89c36e..ca8bcba6d1 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc @@ -202,7 +202,7 @@ void SetIntVar(const Options& options, const std::string& type, } bool HasInternalAccessors(const FieldOptions::CType ctype) { - return ctype == FieldOptions::STRING; + return ctype == FieldOptions::STRING || ctype == FieldOptions::CORD; } } // namespace @@ -399,11 +399,6 @@ std::string FileDllExport(const FileDescriptor* file, const Options& options) { return UniqueName("PROTOBUF_INTERNAL_EXPORT", file, options); } -std::string ReferenceFunctionName(const Descriptor* descriptor, - const Options& options) { - return QualifiedClassName(descriptor, options) + "_ReferenceStrong"; -} - std::string SuperClassName(const Descriptor* descriptor, const Options& options) { return "::" + ProtobufNamespace(options) + @@ -1505,9 +1500,11 @@ class ParseLoopGenerator { StrCat(", ", QualifiedClassName(field->enum_type(), options_), "_IsValid, &_internal_metadata_, ", field->number()); } - format_("ptr = $pi_ns$::Packed$1$Parser(mutable_$2$(), ptr, ctx$3$);\n", - DeclaredTypeMethodName(field->type()), FieldName(field), - enum_validator); + format_( + "ptr = $pi_ns$::Packed$1$Parser(_internal_mutable_$2$(), ptr, " + "ctx$3$);\n", + DeclaredTypeMethodName(field->type()), FieldName(field), + enum_validator); } else { auto field_type = field->type(); switch (field_type) { @@ -1537,8 +1534,8 @@ class ParseLoopGenerator { } else if (IsLazy(field, options_)) { if (field->containing_oneof() != nullptr) { format_( - "if (!has_$1$()) {\n" - " clear_$1$();\n" + "if (!_internal_has_$1$()) {\n" + " clear_$2$();\n" " $2$_.$1$_ = ::$proto_ns$::Arena::CreateMessage<\n" " $pi_ns$::LazyField>(" "GetArenaNoVirtual());\n" @@ -1575,7 +1572,7 @@ class ParseLoopGenerator { " _$classname$_default_instance_.$2$_), ptr);\n", field->number(), FieldName(field)); } else { - format_("ptr = ctx->ParseMessage($1$_$2$(), ptr);\n", + format_("ptr = ctx->ParseMessage(_internal_$1$_$2$(), ptr);\n", field->is_repeated() ? "add" : "mutable", FieldName(field)); } break; @@ -1619,7 +1616,8 @@ class ParseLoopGenerator { QualifiedClassName(field->enum_type(), options_)); format_.Indent(); } - format_("$1$_$2$(static_cast<$3$>(val));\n", prefix, FieldName(field), + format_("_internal_$1$_$2$(static_cast<$3$>(val));\n", prefix, + FieldName(field), QualifiedClassName(field->enum_type(), options_)); if (!HasPreservingUnknownEnumSemantics(field)) { format_.Outdent(); @@ -1639,7 +1637,7 @@ class ParseLoopGenerator { if (field->is_repeated() || field->containing_oneof()) { string prefix = field->is_repeated() ? "add" : "set"; format_( - "$1$_$2$($pi_ns$::ReadVarint$3$(&ptr));\n" + "_internal_$1$_$2$($pi_ns$::ReadVarint$3$(&ptr));\n" "CHK_(ptr);\n", prefix, FieldName(field), zigzag); } else { @@ -1661,7 +1659,7 @@ class ParseLoopGenerator { if (field->is_repeated() || field->containing_oneof()) { string prefix = field->is_repeated() ? "add" : "set"; format_( - "$1$_$2$($pi_ns$::UnalignedLoad<$3$>(ptr));\n" + "_internal_$1$_$2$($pi_ns$::UnalignedLoad<$3$>(ptr));\n" "ptr += sizeof($3$);\n", prefix, FieldName(field), type); } else { @@ -1682,7 +1680,7 @@ class ParseLoopGenerator { } case WireFormatLite::WIRETYPE_START_GROUP: { format_( - "ptr = ctx->ParseGroup($1$_$2$(), ptr, $3$);\n" + "ptr = ctx->ParseGroup(_internal_$1$_$2$(), ptr, $3$);\n" "CHK_(ptr);\n", field->is_repeated() ? "add" : "mutable", FieldName(field), tag); break; diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h index abb3979daf..3537bd1fc2 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -49,6 +49,7 @@ #include #include +// Must be included last. #include namespace google { @@ -153,12 +154,6 @@ std::string DescriptorTableName(const FileDescriptor* file, // dllexport needed for the target file, if any. std::string FileDllExport(const FileDescriptor* file, const Options& options); -// Returns the name of a no-op function that we can call to introduce a linker -// dependency on the given message type. This is used to implement implicit weak -// fields. -std::string ReferenceFunctionName(const Descriptor* descriptor, - const Options& options); - // Name of the base class: google::protobuf::Message or google::protobuf::MessageLite. std::string SuperClassName(const Descriptor* descriptor, const Options& options); diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc index 0c4634bb6b..bea315e957 100644 --- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc @@ -112,6 +112,12 @@ void MapFieldGenerator::GenerateAccessorDeclarations( io::Printer* printer) const { Formatter format(printer, variables_); format( + "private:\n" + "const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" + " ${1$_internal_$name$$}$() const;\n" + "::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" + " ${1$_internal_mutable_$name$$}$();\n" + "public:\n" "$deprecated_attr$const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" " ${1$$name$$}$() const;\n" "$deprecated_attr$::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" @@ -123,17 +129,25 @@ void MapFieldGenerator::GenerateInlineAccessorDefinitions( io::Printer* printer) const { Formatter format(printer, variables_); format( + "inline const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" + "$classname$::_internal_$name$() const {\n" + " return $name$_.GetMap();\n" + "}\n" "inline const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" "$classname$::$name$() const {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_map:$full_name$)\n" - " return $name$_.GetMap();\n" + " return _internal_$name$();\n" + "}\n" + "inline ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" + "$classname$::_internal_mutable_$name$() {\n" + " return $name$_.MutableMap();\n" "}\n" "inline ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" "$classname$::mutable_$name$() {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_mutable_map:$full_name$)\n" - " return $name$_.MutableMap();\n" + " return _internal_mutable_$name$();\n" "}\n"); } @@ -158,75 +172,6 @@ void MapFieldGenerator::GenerateCopyConstructorCode( GenerateMergingCode(printer); } -void MapFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - const FieldDescriptor* key_field = - descriptor_->message_type()->FindFieldByName("key"); - const FieldDescriptor* value_field = - descriptor_->message_type()->FindFieldByName("value"); - std::string key; - std::string value; - format( - "$map_classname$::Parser< ::$proto_ns$::internal::MapField$lite$<\n" - " $map_classname$,\n" - " $key_cpp$, $val_cpp$,\n" - " ::$proto_ns$::internal::WireFormatLite::$key_wire_type$,\n" - " ::$proto_ns$::internal::WireFormatLite::$val_wire_type$,\n" - " $default_enum_value$ >,\n" - " ::$proto_ns$::Map< $key_cpp$, $val_cpp$ > >" - " parser(&$name$_);\n"); - if (IsProto3Field(descriptor_) || - value_field->type() != FieldDescriptor::TYPE_ENUM) { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::ReadMessageNoVirtual(\n" - " input, &parser));\n"); - key = "parser.key()"; - value = "parser.value()"; - } else { - key = "entry->key()"; - value = "entry->value()"; - format("auto entry = parser.NewEntry();\n"); - format( - "std::string data;\n" - "DO_(::$proto_ns$::internal::WireFormatLite::ReadString(input, " - "&data));\n" - "DO_(entry->ParseFromString(data));\n" - "if ($val_cpp$_IsValid(*entry->mutable_value())) {\n" - " (*mutable_$name$())[entry->key()] =\n" - " static_cast< $val_cpp$ >(*entry->mutable_value());\n" - "} else {\n"); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - " mutable_unknown_fields()" - "->AddLengthDelimited($number$, data);\n"); - } else { - format( - " unknown_fields_stream.WriteVarint32($tag$u);\n" - " unknown_fields_stream.WriteVarint32(\n" - " static_cast< ::google::protobuf::uint32>(data.size()));\n" - " unknown_fields_stream.WriteString(data);\n"); - } - format("}\n"); - } - - if (key_field->type() == FieldDescriptor::TYPE_STRING) { - GenerateUtf8CheckCodeForString( - key_field, options_, true, - StrCat(key, ".data(), static_cast(", key, ".length()),\n") - .data(), - format); - } - if (value_field->type() == FieldDescriptor::TYPE_STRING) { - GenerateUtf8CheckCodeForString( - value_field, options_, true, - StrCat(value, ".data(), static_cast(", value, - ".length()),\n") - .data(), - format); - } -} - static void GenerateSerializationLoop(const Formatter& format, bool string_key, bool string_value, bool is_deterministic) { @@ -238,8 +183,8 @@ static void GenerateSerializationLoop(const Formatter& format, bool string_key, } else { format( "for (::$proto_ns$::Map< $key_cpp$, $val_cpp$ >::const_iterator\n" - " it = this->$name$().begin();\n" - " it != this->$name$().end(); ++it) {\n"); + " it = this->_internal_$name$().begin();\n" + " it != this->_internal_$name$().end(); ++it) {\n"); ptr = "it"; } format.Indent(); @@ -262,7 +207,7 @@ static void GenerateSerializationLoop(const Formatter& format, bool string_key, void MapFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); - format("if (!this->$name$().empty()) {\n"); + format("if (!this->_internal_$name$().empty()) {\n"); format.Indent(); const FieldDescriptor* key_field = descriptor_->message_type()->FindFieldByName("key"); @@ -313,15 +258,15 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizesToArray( format( "\n" "if (stream->IsSerializationDeterministic() &&\n" - " this->$name$().size() > 1) {\n" + " this->_internal_$name$().size() > 1) {\n" " ::std::unique_ptr items(\n" - " new SortItem[this->$name$().size()]);\n" + " new SortItem[this->_internal_$name$().size()]);\n" " typedef ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >::size_type " "size_type;\n" " size_type n = 0;\n" " for (::$proto_ns$::Map< $key_cpp$, $val_cpp$ >::const_iterator\n" - " it = this->$name$().begin();\n" - " it != this->$name$().end(); ++it, ++n) {\n" + " it = this->_internal_$name$().begin();\n" + " it != this->_internal_$name$().end(); ++it, ++n) {\n" " items[static_cast(n)] = SortItem(&*it);\n" " }\n" " ::std::sort(&items[0], &items[static_cast(n)], Less());\n"); @@ -341,10 +286,11 @@ void MapFieldGenerator::GenerateByteSize(io::Printer* printer) const { Formatter format(printer, variables_); format( "total_size += $tag_size$ *\n" - " ::$proto_ns$::internal::FromIntSize(this->$name$_size());\n" + " " + "::$proto_ns$::internal::FromIntSize(this->_internal_$name$_size());\n" "for (::$proto_ns$::Map< $key_cpp$, $val_cpp$ >::const_iterator\n" - " it = this->$name$().begin();\n" - " it != this->$name$().end(); ++it) {\n" + " it = this->_internal_$name$().begin();\n" + " it != this->_internal_$name$().end(); ++it) {\n" " total_size += $map_classname$::Funcs::ByteSizeLong(it->first, " "it->second);\n" "}\n"); diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.h b/src/google/protobuf/compiler/cpp/cpp_map_field.h index 45a70c43f3..e0c14f3ce2 100644 --- a/src/google/protobuf/compiler/cpp/cpp_map_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_map_field.h @@ -55,7 +55,6 @@ class MapFieldGenerator : public FieldGenerator { void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const {} void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index a02dd19959..30796b0244 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -185,7 +185,7 @@ bool EmitFieldNonDefaultCondition(io::Printer* printer, format.Indent(); return true; } else if (field->containing_oneof()) { - format("if (has_$name$()) {\n"); + format("if (_internal_has_$name$()) {\n"); format.Indent(); return true; } @@ -734,7 +734,12 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { format.AddMap(vars); if (field->is_repeated()) { - format("$deprecated_attr$int ${1$$name$_size$}$() const;\n", field); + format( + "$deprecated_attr$int ${1$$name$_size$}$() const;\n" + "private:\n" + "int ${1$_internal_$name$_size$}$() const;\n" + "public:\n", + field); } else if (HasHasMethod(field)) { format( "$deprecated_attr$bool ${1$has_$name$$}$() const;\n" @@ -745,7 +750,7 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { } else if (HasPrivateHasMethod(field)) { format( "private:\n" - "bool ${1$has_$name$$}$() const;\n" + "bool ${1$_internal_has_$name$$}$() const;\n" "public:\n", field); } @@ -804,7 +809,19 @@ void MessageGenerator::GenerateSingularFieldHasBits( strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); format( "inline bool $classname$::_internal_has_$name$() const {\n" - " return (_has_bits_[$has_array_index$] & 0x$has_mask$u) != 0;\n" + " bool value = " + "(_has_bits_[$has_array_index$] & 0x$has_mask$u) != 0;\n"); + + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && + !IsLazy(field, options_)) { + // We maintain the invariant that for a submessage x, has_x() returning + // true implies that x_ is not null. By giving this information to the + // compiler, we allow it to eliminate unnecessary null checks later on. + format(" PROTOBUF_ASSUME(!value || $name$_ != nullptr);\n"); + } + + format( + " return value;\n" "}\n" "inline bool $classname$::has_$name$() const {\n" "$annotate_accessor$" @@ -815,18 +832,21 @@ void MessageGenerator::GenerateSingularFieldHasBits( if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { if (IsLazy(field, options_)) { format( - "inline bool $classname$::has_$name$() const {\n" - "$annotate_accessor$" + "inline bool $classname$::_internal_has_$name$() const {\n" " return !$name$_.IsCleared();\n" "}\n"); } else { format( - "inline bool $classname$::has_$name$() const {\n" - "$annotate_accessor$" + "inline bool $classname$::_internal_has_$name$() const {\n" " return this != internal_default_instance() " "&& $name$_ != nullptr;\n" "}\n"); } + format( + "inline bool $classname$::has_$name$() const {\n" + "$annotate_accessor$" + " return _internal_has_$name$();\n" + "}\n"); } } } @@ -858,12 +878,7 @@ void MessageGenerator::GenerateOneofMemberHasBits(const FieldDescriptor* field, // // If has_$name$() is private, there is no need to add an internal accessor. // Only annotate public accessors. - if (HasPrivateHasMethod(field)) { - format( - "inline bool $classname$::has_$name$() const {\n" - " return $oneof_name$_case() == k$field_name$;\n" - "}\n"); - } else { + if (HasHasMethod(field)) { format( "inline bool $classname$::_internal_has_$name$() const {\n" " return $oneof_name$_case() == k$field_name$;\n" @@ -872,6 +887,11 @@ void MessageGenerator::GenerateOneofMemberHasBits(const FieldDescriptor* field, "$annotate_accessor$" " return _internal_has_$name$();\n" "}\n"); + } else if (HasPrivateHasMethod(field)) { + format( + "inline bool $classname$::_internal_has_$name$() const {\n" + " return $oneof_name$_case() == k$field_name$;\n" + "}\n"); } // set_has_$name$() for oneof fields is always private; hence should not be // annotated. @@ -896,7 +916,7 @@ void MessageGenerator::GenerateFieldClear(const FieldDescriptor* field, if (field->containing_oneof()) { // Clear this field only if it is the active field in this oneof, // otherwise ignore - format("if (has_$name$()) {\n"); + format("if (_internal_has_$name$()) {\n"); format.Indent(); field_generators_.get(field).GenerateClearingCode(format.printer()); format("clear_has_$oneof_name$();\n"); @@ -937,9 +957,12 @@ void MessageGenerator::GenerateFieldAccessorDefinitions(io::Printer* printer) { // Generate has_$name$() or $name$_size(). if (field->is_repeated()) { format( + "inline int $classname$::_internal_$name$_size() const {\n" + " return $name$_$1$.size();\n" + "}\n" "inline int $classname$::$name$_size() const {\n" "$annotate_accessor$" - " return $name$_$1$.size();\n" + " return _internal_$name$_size();\n" "}\n", IsImplicitWeakField(field, options_, scc_analyzer_) && field->message_type() @@ -1313,13 +1336,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "bool IsInitialized() const$ is_initialized_final$;\n" "\n" "size_t ByteSizeLong() const final;\n" - "#if $GOOGLE_PROTOBUF$_ENABLE_EXPERIMENTAL_PARSER\n" "const char* _InternalParse(const char* ptr, " "::$proto_ns$::internal::ParseContext* ctx) final;\n" - "#else\n" - "bool MergePartialFromCodedStream(\n" - " ::$proto_ns$::io::CodedInputStream* input) final;\n" - "#endif // $GOOGLE_PROTOBUF$_ENABLE_EXPERIMENTAL_PARSER\n" "$uint8$* InternalSerializeWithCachedSizesToArray(\n" " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " "const final;\n"); @@ -3226,7 +3244,7 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* printer) { format("if (cached_has_bits & 0x$1$u) {\n", mask); } else { - format("if (from.has_$1$()) {\n", FieldName(field)); + format("if (from._internal_has_$1$()) {\n", FieldName(field)); } format.Indent(); @@ -3384,322 +3402,15 @@ void MessageGenerator::GenerateMergeFromCodedStream(io::Printer* printer) { if (descriptor_->options().message_set_wire_format()) { // Special-case MessageSet. format( - "#if $GOOGLE_PROTOBUF$_ENABLE_EXPERIMENTAL_PARSER\n" "const char* $classname$::_InternalParse(const char* ptr,\n" " ::$proto_ns$::internal::ParseContext* ctx) {\n" " return _extensions_.ParseMessageSet(ptr, \n" " internal_default_instance(), &_internal_metadata_, ctx);\n" - "}\n" - "#else\n" - "bool $classname$::MergePartialFromCodedStream(\n" - " ::$proto_ns$::io::CodedInputStream* input) {\n" - " return _extensions_.ParseMessageSet(input,\n" - " internal_default_instance(), $mutable_unknown_fields$);\n" - "}\n" - "#endif // $GOOGLE_PROTOBUF$_ENABLE_EXPERIMENTAL_PARSER\n"); + "}\n"); return; } - format("#if $GOOGLE_PROTOBUF$_ENABLE_EXPERIMENTAL_PARSER\n"); GenerateParserLoop(descriptor_, max_has_bit_index_, options_, scc_analyzer_, printer); - format("#else // $GOOGLE_PROTOBUF$_ENABLE_EXPERIMENTAL_PARSER\n"); - std::vector ordered_fields = - SortFieldsByNumber(descriptor_); - - format( - "bool $classname$::MergePartialFromCodedStream(\n" - " ::$proto_ns$::io::CodedInputStream* input) {\n"); - - if (table_driven_) { - format.Indent(); - - const std::string lite = - UseUnknownFieldSet(descriptor_->file(), options_) ? "" : "Lite"; - - format( - "return ::$proto_ns$::internal::MergePartialFromCodedStream$1$(\n" - " this, ::$tablename$::schema[\n" - " $classname$::kIndexInFileMessages], input);\n", - lite); - - format.Outdent(); - - format("}\n"); - format("#endif // $GOOGLE_PROTOBUF$_ENABLE_EXPERIMENTAL_PARSER\n"); - return; - } - - if (SupportsArenas(descriptor_)) { - for (auto field : ordered_fields) { - const FieldGenerator& field_generator = field_generators_.get(field); - if (field_generator.MergeFromCodedStreamNeedsArena()) { - format(" ::$proto_ns$::Arena* arena = GetArenaNoVirtual();\n"); - break; - } - } - } - - format( - "#define DO_(EXPRESSION) if " - "(!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure\n" - " $uint32$ tag;\n"); - - if (!UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - " ::$proto_ns$::internal::LiteUnknownFieldSetter " - "unknown_fields_setter(\n" - " &_internal_metadata_);\n" - " ::$proto_ns$::io::StringOutputStream unknown_fields_output(\n" - " unknown_fields_setter.buffer());\n" - " ::$proto_ns$::io::CodedOutputStream unknown_fields_stream(\n" - " &unknown_fields_output, false);\n"); - } - - format(" // @@protoc_insertion_point(parse_start:$full_name$)\n"); - - format.Indent(); - format("for (;;) {\n"); - format.Indent(); - - // To calculate the maximum tag to expect, we look at the highest-numbered - // field. We need to be prepared to handle more than one wire type if that - // field is a packable repeated field, so to simplify things we assume the - // highest possible wire type of 5. - uint32 maxtag = - ordered_fields.empty() ? 0 : ordered_fields.back()->number() * 8 + 5; - const int kCutoff0 = 127; // fits in 1-byte varint - const int kCutoff1 = (127 << 7) + 127; // fits in 2-byte varint - - // We need to capture the last tag when parsing if this is a Group type, as - // our caller will verify (via CodedInputStream::LastTagWas) that the correct - // closing tag was received. - bool capture_last_tag = false; - const Descriptor* parent = descriptor_->containing_type(); - if (parent) { - for (auto field : FieldRange(parent)) { - if (field->type() == FieldDescriptor::TYPE_GROUP && - field->message_type() == descriptor_) { - capture_last_tag = true; - break; - } - } - - for (int i = 0; i < parent->extension_count(); i++) { - const FieldDescriptor* field = parent->extension(i); - if (field->type() == FieldDescriptor::TYPE_GROUP && - field->message_type() == descriptor_) { - capture_last_tag = true; - break; - } - } - } - - for (int i = 0; i < descriptor_->file()->extension_count(); i++) { - const FieldDescriptor* field = descriptor_->file()->extension(i); - if (field->type() == FieldDescriptor::TYPE_GROUP && - field->message_type() == descriptor_) { - capture_last_tag = true; - break; - } - } - - format( - "::std::pair<$uint32$, bool> p = " - "input->ReadTagWithCutoffNoLastTag($1$u);\n" - "tag = p.first;\n" - "if (!p.second) goto handle_unusual;\n", - maxtag <= kCutoff0 ? kCutoff0 : (maxtag <= kCutoff1 ? kCutoff1 : maxtag)); - - if (descriptor_->field_count() > 0) { - // We don't even want to print the switch() if we have no fields because - // MSVC dislikes switch() statements that contain only a default value. - - // Note: If we just switched on the tag rather than the field number, we - // could avoid the need for the if() to check the wire type at the beginning - // of each case. However, this is actually a bit slower in practice as it - // creates a jump table that is 8x larger and sparser, and meanwhile the - // if()s are highly predictable. - // - // Historically, we inserted checks to peek at the next tag on the wire and - // jump directly to the next case statement. While this avoids the jump - // table that the switch uses, it greatly increases code size (20-60%) and - // inserts branches that may fail (especially for real world protos that - // interleave--in field number order--hot and cold fields). Loadtests - // confirmed that removing this optimization is performance neutral. - if (num_weak_fields_ > 0) { - format("uint32 weak_offset;\n"); - } - format( - "switch (::$proto_ns$::internal::WireFormatLite::" - "GetTagFieldNumber(tag)) {\n"); - - format.Indent(); - - for (auto field : ordered_fields) { - PrintFieldComment(format, field); - if (IsWeak(field, options_)) { - format( - "case $1$:\n" - " weak_offset = offsetof($classname$DefaultTypeInternal, $2$_);\n" - " goto handle_weak_field_map;\n", - field->number(), FieldName(field)); - continue; - } - - format("case $1$: {\n", field->number()); - format.Indent(); - const FieldGenerator& field_generator = field_generators_.get(field); - - // Emit code to parse the common, expected case. - // MSVC is warning about truncating constant in the static_cast so - // we truncate the tag explicitly. - format("if (static_cast< $uint8$>(tag) == ($1$ & 0xFF)) {\n", - WireFormat::MakeTag(field)); - - format.Indent(); - if (field->is_packed()) { - field_generator.GenerateMergeFromCodedStreamWithPacking(printer); - } else { - field_generator.GenerateMergeFromCodedStream(printer); - } - format.Outdent(); - - // Emit code to parse unexpectedly packed or unpacked values. - if (field->is_packed()) { - internal::WireFormatLite::WireType wiretype = - WireFormat::WireTypeForFieldType(field->type()); - const uint32 tag = - internal::WireFormatLite::MakeTag(field->number(), wiretype); - format("} else if (static_cast< $uint8$>(tag) == ($1$ & 0xFF)) {\n", - tag); - - format.Indent(); - field_generator.GenerateMergeFromCodedStream(printer); - format.Outdent(); - } else if (field->is_packable() && !field->is_packed()) { - internal::WireFormatLite::WireType wiretype = - internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED; - const uint32 tag = - internal::WireFormatLite::MakeTag(field->number(), wiretype); - format("} else if (static_cast< $uint8$>(tag) == ($1$ & 0xFF)) {\n", - tag); - format.Indent(); - field_generator.GenerateMergeFromCodedStreamWithPacking(printer); - format.Outdent(); - } - - format( - "} else {\n" - " goto handle_unusual;\n" - "}\n"); - - format("break;\n"); - - format.Outdent(); - format("}\n\n"); - } - if (num_weak_fields_ > 0) { - format("handle_weak_field_map: {\n"); - format.Indent(); - - format( - "if ((tag & 0x7) != 2) goto handle_unusual;\n" - "DO_(_weak_field_map_.ReadMessage(input, tag >> 3,\n" - " &_$classname$_default_instance_, weak_offset));\n"); - format("break;\n"); - format.Outdent(); - format("}\n\n"); - } - format("default: {\n"); - format.Indent(); - } - - format.Outdent(); - format("handle_unusual:\n"); - format.Indent(); - // If tag is 0 or an end-group tag then this must be the end of the message. - if (capture_last_tag) { - format( - "if (tag == 0 ||\n" - " ::$proto_ns$::internal::WireFormatLite::GetTagWireType(tag) ==\n" - " ::$proto_ns$::internal::WireFormatLite::WIRETYPE_END_GROUP) {\n" - " input->SetLastTag(tag);\n" - " goto success;\n" - "}\n"); - } else { - format( - "if (tag == 0) {\n" - " goto success;\n" - "}\n"); - } - - // Handle extension ranges. - if (descriptor_->extension_range_count() > 0) { - format("if ("); - for (int i = 0; i < descriptor_->extension_range_count(); i++) { - const Descriptor::ExtensionRange* range = descriptor_->extension_range(i); - if (i > 0) format(" ||\n "); - - uint32 start_tag = WireFormatLite::MakeTag( - range->start, static_cast(0)); - uint32 end_tag = WireFormatLite::MakeTag( - range->end, static_cast(0)); - - if (range->end > FieldDescriptor::kMaxNumber) { - format("($1$u <= tag)", start_tag); - } else { - format("($1$u <= tag && tag < $2$u)", start_tag, end_tag); - } - } - format(") {\n"); - if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - " DO_(_extensions_.ParseField(tag, input,\n" - " internal_default_instance(),\n" - " $mutable_unknown_fields$));\n"); - } else { - format( - " DO_(_extensions_.ParseField(tag, input,\n" - " internal_default_instance(),\n" - " &unknown_fields_stream));\n"); - } - format( - " continue;\n" - "}\n"); - } - - // We really don't recognize this tag. Skip it. - if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - "DO_(::$proto_ns$::internal::WireFormat::SkipField(\n" - " input, tag, $mutable_unknown_fields$));\n"); - } else { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::SkipField(\n" - " input, tag, &unknown_fields_stream));\n"); - } - - if (descriptor_->field_count() > 0) { - format("break;\n"); - format.Outdent(); - format("}\n"); // default: - format.Outdent(); - format("}\n"); // switch - } - - format.Outdent(); - format.Outdent(); - format( - " }\n" // for (;;) - "success:\n" - " // @@protoc_insertion_point(parse_success:$full_name$)\n" - " return true;\n" - "failure:\n" - " // @@protoc_insertion_point(parse_failure:$full_name$)\n" - " return false;\n" - "#undef DO_\n" - "}\n"); - format("#endif // $GOOGLE_PROTOBUF$_ENABLE_EXPERIMENTAL_PARSER\n"); } void MessageGenerator::GenerateSerializeOneofFields( @@ -3715,12 +3426,13 @@ void MessageGenerator::GenerateSerializeOneofFields( format("switch ($1$_case()) {\n", oneof->name()); format.Indent(); for (auto field : fields) { - format("case k$1$:\n", UnderscoresToCamelCase(field->name(), true)); + format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); format.Indent(); field_generators_.get(field).GenerateSerializeWithCachedSizesToArray( printer); format("break;\n"); format.Outdent(); + format("}\n"); } format.Outdent(); // Doing nothing is an option. diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc index d8d5fdbd7a..10f1add441 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc @@ -66,8 +66,8 @@ void SetMessageVariables(const FieldDescriptor* descriptor, QualifiedDefaultInstancePtr(descriptor->message_type(), options); (*variables)["type_reference_function"] = implicit_weak - ? (" " + ReferenceFunctionName(descriptor->message_type(), options) + - "();\n") + ? (" " + (*variables)["proto_ns"] + "::internal::StrongReference(" + + (*variables)["type_default_instance"] + ");\n") : ""; // NOTE: Escaped here to unblock proto1->proto2 migration. // TODO(liujisi): Extend this to apply for other conflicting methods. @@ -108,7 +108,11 @@ void MessageFieldGenerator::GenerateAccessorDeclarations( "$deprecated_attr$$type$* ${1$$release_name$$}$();\n" "$deprecated_attr$$type$* ${1$mutable_$name$$}$();\n" "$deprecated_attr$void ${1$set_allocated_$name$$}$" - "($type$* $name$);\n", + "($type$* $name$);\n" + "private:\n" + "const $type$& ${1$_internal_$name$$}$() const;\n" + "$type$* ${1$_internal_mutable_$name$$}$();\n" + "public:\n", descriptor_); if (SupportsArenas(descriptor_)) { format( @@ -149,13 +153,16 @@ void MessageFieldGenerator::GenerateInlineAccessorDefinitions( io::Printer* printer) const { Formatter format(printer, variables_); format( - "inline const $type$& $classname$::$name$() const {\n" - "$annotate_accessor$" + "inline const $type$& $classname$::_internal_$name$() const {\n" "$type_reference_function$" " const $type$* p = $casted_member$;\n" - " // @@protoc_insertion_point(field_get:$full_name$)\n" " return p != nullptr ? *p : *reinterpret_cast(\n" " &$type_default_instance$);\n" + "}\n" + "inline const $type$& $classname$::$name$() const {\n" + "$annotate_accessor$" + " // @@protoc_insertion_point(field_get:$full_name$)\n" + " return _internal_$name$();\n" "}\n"); if (SupportsArenas(descriptor_)) { @@ -182,8 +189,7 @@ void MessageFieldGenerator::GenerateInlineAccessorDefinitions( "}\n"); format( - "inline $type$* $classname$::mutable_$name$() {\n" - "$annotate_accessor$" + "inline $type$* $classname$::_internal_mutable_$name$() {\n" "$type_reference_function$" " $set_hasbit$\n" " if ($name$_ == nullptr) {\n" @@ -195,8 +201,12 @@ void MessageFieldGenerator::GenerateInlineAccessorDefinitions( } format( " }\n" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $casted_member$;\n" + "}\n" + "inline $type$* $classname$::mutable_$name$() {\n" + "$annotate_accessor$" + " // @@protoc_insertion_point(field_mutable:$full_name$)\n" + " return _internal_mutable_$name$();\n" "}\n"); // We handle the most common case inline, and delegate less common cases to @@ -381,7 +391,9 @@ void MessageFieldGenerator::GenerateMergingCode(io::Printer* printer) const { "_Internal::mutable_$name$(this)->CheckTypeAndMergeFrom(\n" " _Internal::$name$(&from));\n"); } else { - format("mutable_$name$()->$type$::MergeFrom(from.$name$());\n"); + format( + "_internal_mutable_$name$()->$type$::MergeFrom(from._internal_$name$())" + ";\n"); } } @@ -413,31 +425,13 @@ void MessageFieldGenerator::GenerateCopyConstructorCode( io::Printer* printer) const { Formatter format(printer, variables_); format( - "if (from.has_$name$()) {\n" + "if (from._internal_has_$name$()) {\n" " $name$_ = new $type$(*from.$name$_);\n" "} else {\n" " $name$_ = nullptr;\n" "}\n"); } -void MessageFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (implicit_weak_field_) { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::ReadMessage(\n" - " input, _Internal::mutable_$name$(this)));\n"); - } else if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::ReadMessage(\n" - " input, mutable_$name$()));\n"); - } else { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::ReadGroup(\n" - " $number$, input, mutable_$name$()));\n"); - } -} - void MessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); @@ -528,12 +522,15 @@ void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions( "}\n"); format( + "inline const $type$& $classname$::_internal_$name$() const {\n" + " return _internal_has_$name$()\n" + " ? *$field_member$\n" + " : *reinterpret_cast< $type$*>(&$type_default_instance$);\n" + "}\n" "inline const $type$& $classname$::$name$() const {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return has_$name$()\n" - " ? *$field_member$\n" - " : *reinterpret_cast< $type$*>(&$type_default_instance$);\n" + " return _internal_$name$();\n" "}\n"); if (SupportsArenas(descriptor_)) { @@ -568,16 +565,19 @@ void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions( } format( - "inline $type$* $classname$::mutable_$name$() {\n" - "$annotate_accessor$" - " if (!has_$name$()) {\n" + "inline $type$* $classname$::_internal_mutable_$name$() {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$ = CreateMaybeMessage< $type$ >(\n" " GetArenaNoVirtual());\n" " }\n" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $field_member$;\n" + "}\n" + "inline $type$* $classname$::mutable_$name$() {\n" + "$annotate_accessor$" + " // @@protoc_insertion_point(field_mutable:$full_name$)\n" + " return _internal_mutable_$name$();\n" "}\n"); } @@ -646,6 +646,10 @@ void RepeatedMessageFieldGenerator::GenerateAccessorDeclarations( "$deprecated_attr$$type$* ${1$mutable_$name$$}$(int index);\n" "$deprecated_attr$::$proto_ns$::RepeatedPtrField< $type$ >*\n" " ${1$mutable_$name$$}$();\n" + "private:\n" + "const $type$& ${1$_internal_$name$$}$(int index) const;\n" + "$type$* ${1$_internal_add_$name$$}$();\n" + "public:\n" "$deprecated_attr$const $type$& ${1$$name$$}$(int index) const;\n" "$deprecated_attr$$type$* ${1$add_$name$$}$();\n" "$deprecated_attr$const ::$proto_ns$::RepeatedPtrField< $type$ >&\n" @@ -676,27 +680,33 @@ void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions( if (options_.safe_boundary_check) { format( - "inline const $type$& $classname$::$name$(int index) const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" + "inline const $type$& $classname$::_internal_$name$(int index) const " + "{\n" " return $name$_$weak$.InternalCheckedGet(index,\n" " *reinterpret_cast(&$type_default_instance$));\n" "}\n"); } else { format( - "inline const $type$& $classname$::$name$(int index) const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" + "inline const $type$& $classname$::_internal_$name$(int index) const " + "{\n" "$type_reference_function$" " return $name$_$weak$.Get(index);\n" "}\n"); } format( + "inline const $type$& $classname$::$name$(int index) const {\n" + "$annotate_accessor$" + " // @@protoc_insertion_point(field_get:$full_name$)\n" + " return _internal_$name$(index);\n" + "}\n" + "inline $type$* $classname$::_internal_add_$name$() {\n" + " return $name$_$weak$.Add();\n" + "}\n" "inline $type$* $classname$::add_$name$() {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_add:$full_name$)\n" - " return $name$_$weak$.Add();\n" + " return _internal_add_$name$();\n" "}\n"); format( @@ -732,47 +742,38 @@ void RepeatedMessageFieldGenerator::GenerateConstructorCode( // Not needed for repeated fields. } -void RepeatedMessageFieldGenerator::GenerateMergeFromCodedStream( +void RepeatedMessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); - if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { - if (implicit_weak_field_) { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::" - "ReadMessage(input, $name$_.AddWeak(\n" - " reinterpret_cast(\n" - " $type_default_instance_ptr$))));\n"); - } else { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::" - "ReadMessage(\n" - " input, add_$name$()));\n"); - } + if (implicit_weak_field_) { + format( + "for (auto it = this->$name$_.pointer_begin(),\n" + " end = this->$name$_.pointer_end(); it < end; ++it) {\n" + " stream->EnsureSpace(&target);\n" + " target = ::$proto_ns$::internal::WireFormatLite::\n" + " InternalWrite$declared_type$ToArray($number$, **it, target, " + "stream);\n" + "}\n"); } else { format( - "DO_(::$proto_ns$::internal::WireFormatLite::" - "ReadGroup($number$, input, add_$name$()));\n"); + "for (unsigned int i = 0,\n" + " n = static_cast(this->_internal_$name$_size()); i < " + "n; i++) " + "{\n" + " stream->EnsureSpace(&target);\n" + " target = ::$proto_ns$::internal::WireFormatLite::\n" + " InternalWrite$declared_type$ToArray($number$, " + "this->_internal_$name$(i), target, " + "stream);\n" + "}\n"); } } -void RepeatedMessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "for (auto it = this->$name$_.pointer_begin(),\n" - " end = this->$name$_.pointer_end(); it < end; ++it) {\n" - " stream->EnsureSpace(&target);\n" - " target = ::$proto_ns$::internal::WireFormatLite::\n" - " InternalWrite$declared_type$ToArray($number$, **it, target, " - "stream);\n" - "}\n"); -} - void RepeatedMessageFieldGenerator::GenerateByteSize( io::Printer* printer) const { Formatter format(printer, variables_); format( - "total_size += $tag_size$UL * this->$name$_size();\n" + "total_size += $tag_size$UL * this->_internal_$name$_size();\n" "for (const auto& msg : this->$name$_) {\n" " total_size +=\n" " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(msg);\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.h b/src/google/protobuf/compiler/cpp/cpp_message_field.h index 88b01e05d7..fe5cf13cbd 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_message_field.h @@ -66,7 +66,6 @@ class MessageFieldGenerator : public FieldGenerator { void GenerateDestructorCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; @@ -116,7 +115,6 @@ class RepeatedMessageFieldGenerator : public FieldGenerator { void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateCopyConstructorCode(io::Printer* printer) const {} - void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc index db9a300230..ca701b041a 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -136,7 +136,11 @@ void PrimitiveFieldGenerator::GenerateAccessorDeclarations( Formatter format(printer, variables_); format( "$deprecated_attr$$type$ ${1$$name$$}$() const;\n" - "$deprecated_attr$void ${1$set_$name$$}$($type$ value);\n", + "$deprecated_attr$void ${1$set_$name$$}$($type$ value);\n" + "private:\n" + "$type$ ${1$_internal_$name$$}$() const;\n" + "void ${1$_internal_set_$name$$}$($type$ value);\n" + "public:\n", descriptor_); } @@ -144,15 +148,21 @@ void PrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( io::Printer* printer) const { Formatter format(printer, variables_); format( + "inline $type$ $classname$::_internal_$name$() const {\n" + " return $name$_;\n" + "}\n" "inline $type$ $classname$::$name$() const {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return $name$_;\n" + " return _internal_$name$();\n" "}\n" - "inline void $classname$::set_$name$($type$ value) {\n" - "$annotate_accessor$" + "inline void $classname$::_internal_set_$name$($type$ value) {\n" " $set_hasbit$\n" " $name$_ = value;\n" + "}\n" + "inline void $classname$::set_$name$($type$ value) {\n" + "$annotate_accessor$" + " _internal_set_$name$(value);\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n"); } @@ -164,7 +174,7 @@ void PrimitiveFieldGenerator::GenerateClearingCode(io::Printer* printer) const { void PrimitiveFieldGenerator::GenerateMergingCode(io::Printer* printer) const { Formatter format(printer, variables_); - format("set_$name$(from.$name$());\n"); + format("_internal_set_$name$(from._internal_$name$());\n"); } void PrimitiveFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { @@ -184,17 +194,6 @@ void PrimitiveFieldGenerator::GenerateCopyConstructorCode( format("$name$_ = from.$name$_;\n"); } -void PrimitiveFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "$set_hasbit_io$\n" - "DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n" - " $type$, " - "::$proto_ns$::internal::WireFormatLite::$wire_format_field_type$>(\n" - " input, &$name$_)));\n"); -} - void PrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); @@ -202,7 +201,7 @@ void PrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray( "stream->EnsureSpace(&target);\n" "target = " "::$proto_ns$::internal::WireFormatLite::Write$declared_type$ToArray(" - "$number$, this->$name$(), target);\n"); + "$number$, this->_internal_$name$(), target);\n"); } void PrimitiveFieldGenerator::GenerateByteSize(io::Printer* printer) const { @@ -212,7 +211,7 @@ void PrimitiveFieldGenerator::GenerateByteSize(io::Printer* printer) const { format( "total_size += $tag_size$ +\n" " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" - " this->$name$());\n"); + " this->_internal_$name$());\n"); } else { format("total_size += $tag_size$ + $fixed_size$;\n"); } @@ -232,21 +231,27 @@ void PrimitiveOneofFieldGenerator::GenerateInlineAccessorDefinitions( io::Printer* printer) const { Formatter format(printer, variables_); format( - "inline $type$ $classname$::$name$() const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " if (has_$name$()) {\n" + "inline $type$ $classname$::_internal_$name$() const {\n" + " if (_internal_has_$name$()) {\n" " return $field_member$;\n" " }\n" " return $default$;\n" "}\n" - "inline void $classname$::set_$name$($type$ value) {\n" - "$annotate_accessor$" - " if (!has_$name$()) {\n" + "inline void $classname$::_internal_set_$name$($type$ value) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " }\n" " $field_member$ = value;\n" + "}\n" + "inline $type$ $classname$::$name$() const {\n" + "$annotate_accessor$" + " // @@protoc_insertion_point(field_get:$full_name$)\n" + " return _internal_$name$();\n" + "}\n" + "inline void $classname$::set_$name$($type$ value) {\n" + "$annotate_accessor$" + " _internal_set_$name$(value);\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n"); } @@ -268,18 +273,6 @@ void PrimitiveOneofFieldGenerator::GenerateConstructorCode( format("$ns$::_$classname$_default_instance_.$name$_ = $default$;\n"); } -void PrimitiveOneofFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "clear_$oneof_name$();\n" - "DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n" - " $type$, " - "::$proto_ns$::internal::WireFormatLite::$wire_format_field_type$>(\n" - " input, &$field_member$)));\n" - "set_has_$name$();\n"); -} - // =================================================================== RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( @@ -312,6 +305,14 @@ void RepeatedPrimitiveFieldGenerator::GenerateAccessorDeclarations( io::Printer* printer) const { Formatter format(printer, variables_); format( + "private:\n" + "$type$ ${1$_internal_$name$$}$(int index) const;\n" + "const ::$proto_ns$::RepeatedField< $type$ >&\n" + " ${1$_internal_$name$$}$() const;\n" + "void ${1$_internal_add_$name$$}$($type$ value);\n" + "::$proto_ns$::RepeatedField< $type$ >*\n" + " ${1$_internal_mutable_$name$$}$();\n" + "public:\n" "$deprecated_attr$$type$ ${1$$name$$}$(int index) const;\n" "$deprecated_attr$void ${1$set_$name$$}$(int index, $type$ value);\n" "$deprecated_attr$void ${1$add_$name$$}$($type$ value);\n" @@ -326,32 +327,46 @@ void RepeatedPrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( io::Printer* printer) const { Formatter format(printer, variables_); format( + "inline $type$ $classname$::_internal_$name$(int index) const {\n" + " return $name$_.Get(index);\n" + "}\n" "inline $type$ $classname$::$name$(int index) const {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return $name$_.Get(index);\n" + " return _internal_$name$(index);\n" "}\n" "inline void $classname$::set_$name$(int index, $type$ value) {\n" "$annotate_accessor$" " $name$_.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" + "}\n" "inline void $classname$::add_$name$($type$ value) {\n" "$annotate_accessor$" - " $name$_.Add(value);\n" + " _internal_add_$name$(value);\n" " // @@protoc_insertion_point(field_add:$full_name$)\n" "}\n" "inline const ::$proto_ns$::RepeatedField< $type$ >&\n" + "$classname$::_internal_$name$() const {\n" + " return $name$_;\n" + "}\n" + "inline const ::$proto_ns$::RepeatedField< $type$ >&\n" "$classname$::$name$() const {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_list:$full_name$)\n" - " return $name$_;\n" + " return _internal_$name$();\n" + "}\n" + "inline ::$proto_ns$::RepeatedField< $type$ >*\n" + "$classname$::_internal_mutable_$name$() {\n" + " return &$name$_;\n" "}\n" "inline ::$proto_ns$::RepeatedField< $type$ >*\n" "$classname$::mutable_$name$() {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" - " return &$name$_;\n" + " return _internal_mutable_$name$();\n" "}\n"); } @@ -384,34 +399,15 @@ void RepeatedPrimitiveFieldGenerator::GenerateCopyConstructorCode( format("$name$_.CopyFrom(from.$name$_);\n"); } -void RepeatedPrimitiveFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "DO_((::$proto_ns$::internal::WireFormatLite::$repeated_reader$<\n" - " $type$, " - "::$proto_ns$::internal::WireFormatLite::$wire_format_field_type$>(\n" - " $tag_size$, $tag$u, input, this->mutable_$name$())));\n"); -} - -void RepeatedPrimitiveFieldGenerator::GenerateMergeFromCodedStreamWithPacking( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "DO_((::$proto_ns$::internal::WireFormatLite::$packed_reader$<\n" - " $type$, " - "::$proto_ns$::internal::WireFormatLite::$wire_format_field_type$>(\n" - " input, this->mutable_$name$())));\n"); -} - void RepeatedPrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); if (descriptor_->is_packed()) { if (FixedSize(descriptor_->type()) > 0) { format( - "if (this->$name$_size() > 0) {\n" - " target = stream->WriteFixedPacked($number$, $name$_, target);\n" + "if (this->_internal_$name$_size() > 0) {\n" + " target = stream->WriteFixedPacked($number$, _internal_$name$(), " + "target);\n" "}\n"); } else { format( @@ -420,16 +416,17 @@ void RepeatedPrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray( "_$name$_cached_byte_size_.load(std::memory_order_relaxed);\n" " if (byte_size > 0) {\n" " target = stream->Write$declared_type$Packed(\n" - " $number$, $name$_, byte_size, target);\n" + " $number$, _internal_$name$(), byte_size, target);\n" " }\n" "}\n"); } } else { format( - "for (const auto& x : this->$name$()) {\n" + "for (int i = 0, n = this->_internal_$name$_size(); i < n; i++) {\n" " stream->EnsureSpace(&target);\n" " target = ::$proto_ns$::internal::WireFormatLite::" - "Write$declared_type$ToArray($number$, x, target);\n" + "Write$declared_type$ToArray($number$, this->_internal_$name$(i), " + "target);\n" "}\n"); } } @@ -446,7 +443,8 @@ void RepeatedPrimitiveFieldGenerator::GenerateByteSize( " $declared_type$Size(this->$name$_);\n"); } else { format( - "unsigned int count = static_cast(this->$name$_size());\n" + "unsigned int count = static_cast(this->_internal_$name$_size());\n" "size_t data_size = $fixed_size$UL * count;\n"); } @@ -465,7 +463,7 @@ void RepeatedPrimitiveFieldGenerator::GenerateByteSize( format( "total_size += $tag_size$ *\n" " " - "::$proto_ns$::internal::FromIntSize(this->$name$_size());\n" + "::$proto_ns$::internal::FromIntSize(this->_internal_$name$_size());\n" "total_size += data_size;\n"); } format.Outdent(); diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.h b/src/google/protobuf/compiler/cpp/cpp_primitive_field.h index 18b67ad47a..fe54ce3325 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.h @@ -59,7 +59,6 @@ class PrimitiveFieldGenerator : public FieldGenerator { void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; @@ -78,7 +77,6 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { void GenerateClearingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator); @@ -99,8 +97,6 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator { void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; - void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc index 76d0097357..966eeea577 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -602,44 +602,6 @@ void StringFieldGenerator::GenerateDefaultInstanceAllocator( } } -void StringFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - // The google3 version of proto2 has ArenaStrings and parses into them - // directly, but for the open-source release, we always parse into std::string - // instances. Note that for lite, we do similarly to the open source release - // and use std::string, not ArenaString. - if (!options_.opensource_runtime && !inlined_ && - SupportsArenas(descriptor_) && !lite_) { - // If arena != NULL, the current string is either an ArenaString (no - // destructor necessary) or a materialized std::string (and is on the - // Arena's destructor list). No call to ArenaStringPtr::Destroy is needed. - format( - "if (arena != nullptr) {\n" - " ::$proto_ns$::internal::TaggedPtr str =\n" - " ::$proto_ns$::internal::ReadArenaString(input, arena);\n" - " DO_(!str.IsNull());\n" - " $set_hasbit_io$\n" - " $name$_.UnsafeSetTaggedPointer(str);\n" - "} else {\n" - " DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n" - " input, this->_internal_mutable_$name$()));\n" - "}\n"); - } else { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n" - " input, this->_internal_mutable_$name$()));\n"); - } - - if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { - GenerateUtf8CheckCodeForString( - descriptor_, options_, true, - "this->_internal_$name$().data(), " - "static_cast(this->_internal_$name$().length()),\n", - format); - } -} - bool StringFieldGenerator::MergeFromCodedStreamNeedsArena() const { return !lite_ && !inlined_ && !options_.opensource_runtime; } @@ -682,10 +644,6 @@ StringOneofFieldGenerator::StringOneofFieldGenerator( variables_["field_name"] = UnderscoresToCamelCase(descriptor->name(), true); variables_["oneof_index"] = StrCat(descriptor->containing_oneof()->index()); - // has_$name$() for oneof fields is private if has_bit is not present. In that - // case, use _has_$name$() instead of _internal_has_$name$(). - variables_["internal"] = - HasFieldPresence(descriptor->file()) ? "_internal_" : ""; } StringOneofFieldGenerator::~StringOneofFieldGenerator() {} @@ -712,14 +670,14 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( if (SupportsArenas(descriptor_)) { format( "inline const std::string& $classname$::_internal_$name$() const {\n" - " if ($internal$has_$name$()) {\n" + " if (_internal_has_$name$()) {\n" " return $field_member$.Get();\n" " }\n" " return *$default_variable$;\n" "}\n" "inline void $classname$::_internal_set_$name$(const std::string& " "value) {\n" - " if (!$internal$has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -730,7 +688,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "inline void $classname$::set_$name$(std::string&& value) {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_set:$full_name$)\n" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -742,7 +700,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "inline void $classname$::set_$name$(const char* value) {\n" "$annotate_accessor$" " $null_check$" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -755,7 +713,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( format( "inline void $classname$::set_$name$(::StringPiece value) {\n" "$annotate_accessor$" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -770,7 +728,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "void $classname$::set_$name$(const $pointer_type$* value,\n" " size_t size) {\n" "$annotate_accessor$" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -782,7 +740,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" "}\n" "inline std::string* $classname$::_internal_mutable_$name$() {\n" - " if (!$internal$has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -793,7 +751,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "inline std::string* $classname$::$release_name$() {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_release:$full_name$)\n" - " if (has_$name$()) {\n" + " if (_internal_has_$name$()) {\n" " clear_has_$oneof_name$();\n" " return $field_member$.Release($default_variable$,\n" " GetArenaNoVirtual());\n" @@ -819,7 +777,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( " // " "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n" " $DCHK$(GetArenaNoVirtual() != nullptr);\n" - " if (has_$name$()) {\n" + " if (_internal_has_$name$()) {\n" " clear_has_$oneof_name$();\n" " return $field_member$.UnsafeArenaRelease(\n" " $default_variable$, GetArenaNoVirtual());\n" @@ -831,7 +789,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "std::string* $name$) {\n" "$annotate_accessor$" " $DCHK$(GetArenaNoVirtual() != nullptr);\n" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" " }\n" " clear_$oneof_name$();\n" @@ -848,14 +806,14 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( // No-arena case. format( "inline const std::string& $classname$::_internal_$name$() const {\n" - " if ($internal$has_$name$()) {\n" + " if (_internal_has_$name$()) {\n" " return $field_member$.GetNoArena();\n" " }\n" " return *$default_variable$;\n" "}\n" "inline void $classname$::_internal_set_$name$(const std::string& " "value) {\n" - " if (!$internal$has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -865,7 +823,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "inline void $classname$::set_$name$(std::string&& value) {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_set:$full_name$)\n" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -876,7 +834,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "inline void $classname$::set_$name$(const char* value) {\n" "$annotate_accessor$" " $null_check$" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -889,7 +847,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( format( "inline void $classname$::set_$name$(::StringPiece value) {\n" "$annotate_accessor$" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -903,7 +861,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "void $classname$::set_$name$(const $pointer_type$* value, size_t " "size) {\n" "$annotate_accessor$" - " if (!has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -913,7 +871,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" "}\n" "inline std::string* $classname$::_internal_mutable_$name$() {\n" - " if (!$internal$has_$name$()) {\n" + " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $field_member$.UnsafeSetDefault($default_variable$);\n" @@ -923,7 +881,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( "inline std::string* $classname$::$release_name$() {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_release:$full_name$)\n" - " if (has_$name$()) {\n" + " if (_internal_has_$name$()) {\n" " clear_has_$oneof_name$();\n" " return $field_member$.ReleaseNoArena($default_variable$);\n" " } else {\n" @@ -978,49 +936,11 @@ void StringOneofFieldGenerator::GenerateDestructorCode( io::Printer* printer) const { Formatter format(printer, variables_); format( - "if (has_$name$()) {\n" + "if (_internal_has_$name$()) {\n" " $field_member$.DestroyNoArena($default_variable$);\n" "}\n"); } -void StringOneofFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - // See above: ArenaString is not included in the open-source release. - if (!options_.opensource_runtime && SupportsArenas(descriptor_) && !lite_) { - // If has_$name$(), then the current string is either an ArenaString (no - // destructor necessary) or a materialized std::string (and is on the - // Arena's destructor list). No call to ArenaStringPtr::Destroy is needed. - format( - "if (arena != nullptr) {\n" - " clear_$oneof_name$();\n" - " if (!has_$name$()) {\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " set_has_$name$();\n" - " }\n" - " ::$proto_ns$::internal::TaggedPtr new_value =\n" - " ::$proto_ns$::internal::ReadArenaString(input, arena);\n" - " DO_(!new_value.IsNull());\n" - " $field_member$.UnsafeSetTaggedPointer(new_value);\n" - "} else {\n" - " DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n" - " input, this->_internal_mutable_$name$()));\n" - "}\n"); - } else { - format( - "DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n" - " input, this->_internal_mutable_$name$()));\n"); - } - - if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { - GenerateUtf8CheckCodeForString( - descriptor_, options_, true, - "this->_internal_$name$().data(), " - "static_cast(this->_internal_$name$().length()),\n", - format); - } -} - // =================================================================== RepeatedStringFieldGenerator::RepeatedStringFieldGenerator( @@ -1092,6 +1012,7 @@ void RepeatedStringFieldGenerator::GenerateAccessorDeclarations( "${1$mutable_$name$$}$()" ";\n" "private:\n" + "const std::string& ${1$_internal_$name$$}$(int index) const;\n" "std::string* _internal_add_$name$();\n" "public:\n", descriptor_); @@ -1114,21 +1035,24 @@ void RepeatedStringFieldGenerator::GenerateInlineAccessorDefinitions( "}\n"); if (options_.safe_boundary_check) { format( - "inline const std::string& $classname$::$name$(int index) const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" + "inline const std::string& $classname$::_internal_$name$(int index) " + "const {\n" " return $name$_.InternalCheckedGet(\n" " index, ::$proto_ns$::internal::GetEmptyStringAlreadyInited());\n" "}\n"); } else { format( - "inline const std::string& $classname$::$name$(int index) const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" + "inline const std::string& $classname$::_internal_$name$(int index) " + "const {\n" " return $name$_.Get(index);\n" "}\n"); } format( + "inline const std::string& $classname$::$name$(int index) const {\n" + "$annotate_accessor$" + " // @@protoc_insertion_point(field_get:$full_name$)\n" + " return _internal_$name$(index);\n" + "}\n" "inline std::string* $classname$::mutable_$name$(int index) {\n" "$annotate_accessor$" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" @@ -1247,28 +1171,12 @@ void RepeatedStringFieldGenerator::GenerateCopyConstructorCode( format("$name$_.CopyFrom(from.$name$_);"); } -void RepeatedStringFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n" - " input, this->_internal_add_$name$()));\n"); - if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { - GenerateUtf8CheckCodeForString( - descriptor_, options_, true, - "$name$_.Get($name$_.size() - 1).data(),\n" - "static_cast($name$_.Get($name$_.size() - 1).length()),\n", - format); - } -} - void RepeatedStringFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); format( - "for (auto it = $field_member$.pointer_begin(),\n" - " end = $field_member$.pointer_end(); it < end; ++it) {\n" - " const auto& s = **it;\n"); + "for (int i = 0, n = this->_internal_$name$_size(); i < n; i++) {\n" + " const auto& s = this->_internal_$name$(i);\n"); // format("for (const std::string& s : this->$name$()) {\n"); format.Indent(); if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.h b/src/google/protobuf/compiler/cpp/cpp_string_field.h index b01c9a04b2..f39a93abe2 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.h @@ -65,7 +65,6 @@ class StringFieldGenerator : public FieldGenerator { void GenerateDestructorCode(io::Printer* printer) const; bool GenerateArenaDestructorCode(io::Printer* printer) const; void GenerateDefaultInstanceAllocator(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; uint32 CalculateFieldTag() const; @@ -97,7 +96,6 @@ class StringOneofFieldGenerator : public StringFieldGenerator { void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateDestructorCode(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOneofFieldGenerator); @@ -118,7 +116,6 @@ class RepeatedStringFieldGenerator : public FieldGenerator { void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.inc b/src/google/protobuf/compiler/cpp/cpp_unittest.inc index 0b18662ed2..2efbd6d384 100644 --- a/src/google/protobuf/compiler/cpp/cpp_unittest.inc +++ b/src/google/protobuf/compiler/cpp/cpp_unittest.inc @@ -72,12 +72,13 @@ #include #include #include -#include #include #include #include +#include #include +// Must be included last. #include namespace google { diff --git a/src/google/protobuf/compiler/importer_unittest.cc b/src/google/protobuf/compiler/importer_unittest.cc index 82ffc0fc2d..111d66f8b2 100644 --- a/src/google/protobuf/compiler/importer_unittest.cc +++ b/src/google/protobuf/compiler/importer_unittest.cc @@ -44,9 +44,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc index 076f30a04a..a9180c9af4 100644 --- a/src/google/protobuf/compiler/java/java_file.cc +++ b/src/google/protobuf/compiler/java/java_file.cc @@ -237,7 +237,8 @@ bool FileGenerator::Validate(std::string* error) { } // Print a warning if optimize_for = LITE_RUNTIME is used. - if (file_->options().optimize_for() == FileOptions::LITE_RUNTIME) { + if (file_->options().optimize_for() == FileOptions::LITE_RUNTIME && + !options_.enforce_lite) { GOOGLE_LOG(WARNING) << "The optimize_for = LITE_RUNTIME option is no longer supported by " << "protobuf Java code generator and is ignored--protoc will always " diff --git a/src/google/protobuf/compiler/java/java_helpers.cc b/src/google/protobuf/compiler/java/java_helpers.cc index bdc43acae6..41cd52402e 100644 --- a/src/google/protobuf/compiler/java/java_helpers.cc +++ b/src/google/protobuf/compiler/java/java_helpers.cc @@ -32,13 +32,14 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + #include #include #include #include #include -#include #include #include #include diff --git a/src/google/protobuf/compiler/java/java_helpers.h b/src/google/protobuf/compiler/java/java_helpers.h index b06ab208f4..37d0cac7ef 100644 --- a/src/google/protobuf/compiler/java/java_helpers.h +++ b/src/google/protobuf/compiler/java/java_helpers.h @@ -369,7 +369,7 @@ inline bool SupportUnknownEnumValue(const FileDescriptor* descriptor) { return descriptor->syntax() == FileDescriptor::SYNTAX_PROTO3; } -// Check whether a mesasge has repeated fields. +// Check whether a message has repeated fields. bool HasRepeatedFields(const Descriptor* descriptor); inline bool IsMapEntry(const Descriptor* descriptor) { diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc index 941e8380d3..16d03e91de 100644 --- a/src/google/protobuf/compiler/java/java_message.cc +++ b/src/google/protobuf/compiler/java/java_message.cc @@ -415,9 +415,13 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { "private int $oneof_name$Case_ = 0;\n" "private java.lang.Object $oneof_name$_;\n"); // OneofCase enum - printer->Print(vars, - "public enum $oneof_capitalized_name$Case\n" - " implements com.google.protobuf.Internal.EnumLite {\n"); + printer->Print( + vars, + "public enum $oneof_capitalized_name$Case\n" + // TODO(dweis): Remove EnumLite when we want to break compatibility with + // 3.x users + " implements com.google.protobuf.Internal.EnumLite,\n" + " com.google.protobuf.AbstractMessage.InternalOneOfEnum {\n"); printer->Indent(); for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc index cb09997854..c2233110b5 100644 --- a/src/google/protobuf/compiler/java/java_message_lite.cc +++ b/src/google/protobuf/compiler/java/java_message_lite.cc @@ -235,9 +235,7 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { "private int $oneof_name$Case_ = 0;\n" "private java.lang.Object $oneof_name$_;\n"); // OneofCase enum - printer->Print(vars, - "public enum $oneof_capitalized_name$Case\n" - " implements com.google.protobuf.Internal.EnumLite {\n"); + printer->Print(vars, "public enum $oneof_capitalized_name$Case {\n"); printer->Indent(); for (int j = 0; j < oneof->field_count(); j++) { const FieldDescriptor* field = oneof->field(j); @@ -275,7 +273,8 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { " default: return null;\n" " }\n" "}\n" - "@java.lang.Override\n" + // TODO(b/135620659): Rename this to "getFieldNumber" or something to + // disambiguate it from actual proto enums. "public int getNumber() {\n" " return this.value;\n" "}\n", diff --git a/src/google/protobuf/compiler/java/java_string_field.cc b/src/google/protobuf/compiler/java/java_string_field.cc index c976885e02..4dec3940c8 100644 --- a/src/google/protobuf/compiler/java/java_string_field.cc +++ b/src/google/protobuf/compiler/java/java_string_field.cc @@ -838,7 +838,8 @@ void RepeatedImmutableStringFieldGenerator::GenerateBuilderMembers( " return $name$_.get(index);\n" "}\n"); printer->Annotate("{", "}", descriptor_); - WriteFieldStringBytesAccessorDocComment(printer, descriptor_, LIST_ADDER); + WriteFieldStringBytesAccessorDocComment(printer, descriptor_, + LIST_INDEXED_GETTER); printer->Print(variables_, "$deprecation$public com.google.protobuf.ByteString\n" " ${$get$capitalized_name$Bytes$}$(int index) {\n" diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc index 88c9a0fb37..d06fbcf5c1 100644 --- a/src/google/protobuf/compiler/js/js_generator.cc +++ b/src/google/protobuf/compiler/js/js_generator.cc @@ -3142,6 +3142,13 @@ void Generator::GenerateClassDeserializeBinaryField( printer->Print(", null"); } printer->Print(", $defaultKey$", "defaultKey", JSFieldDefault(key_field)); + if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { + printer->Print(", new $messageType$()", "messageType", + GetMessagePath(options, value_field->message_type())); + } else { + printer->Print(", $defaultValue$", "defaultValue", + JSFieldDefault(value_field)); + } printer->Print(");\n"); printer->Print(" });\n"); } else { diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc index 038e6f530f..bd75869845 100644 --- a/src/google/protobuf/compiler/mock_code_generator.cc +++ b/src/google/protobuf/compiler/mock_code_generator.cc @@ -33,11 +33,12 @@ #include #include + #include #include #include -#include +#include #include #include @@ -50,8 +51,8 @@ #include #include #include -#include #include +#include #ifdef major #undef major diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc index 0576b64a4c..8cbc95b52b 100644 --- a/src/google/protobuf/compiler/parser.cc +++ b/src/google/protobuf/compiler/parser.cc @@ -2206,7 +2206,8 @@ bool Parser::ParseMethodOptions(const LocationRecorder& parent_location, bool Parser::ParseLabel(FieldDescriptorProto::Label* label, const LocationRecorder& field_location, const FileDescriptorProto* containing_file) { - if (!LookingAt("optional") && !LookingAt("repeated") && !LookingAt("required")) { + if (!LookingAt("optional") && !LookingAt("repeated") && + !LookingAt("required")) { return false; } LocationRecorder location(field_location, diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc index 2070ab9052..49840a423e 100644 --- a/src/google/protobuf/compiler/parser_unittest.cc +++ b/src/google/protobuf/compiler/parser_unittest.cc @@ -32,13 +32,13 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + #include #include #include #include -#include - #include #include #include @@ -47,11 +47,10 @@ #include #include #include -#include -#include - #include #include +#include +#include namespace google { namespace protobuf { diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index b42254b7c5..f48ceb4e91 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -289,7 +289,6 @@ void Version::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -349,91 +348,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Version::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.compiler.Version) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional int32 major = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - _Internal::set_has_major(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &major_))); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 minor = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_minor(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &minor_))); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 patch = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { - _Internal::set_has_patch(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &patch_))); - } else { - goto handle_unusual; - } - break; - } - - // optional string suffix = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_suffix())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_suffix().data(), static_cast(this->_internal_suffix().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.compiler.Version.suffix"); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.compiler.Version) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.compiler.Version) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Version::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -445,19 +359,19 @@ failure: // optional int32 major = 1; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->major(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_major(), target); } // optional int32 minor = 2; if (cached_has_bits & 0x00000004u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->minor(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_minor(), target); } // optional int32 patch = 3; if (cached_has_bits & 0x00000008u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->patch(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_patch(), target); } // optional string suffix = 4; @@ -499,21 +413,21 @@ size_t Version::ByteSizeLong() const { if (cached_has_bits & 0x00000002u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->major()); + this->_internal_major()); } // optional int32 minor = 2; if (cached_has_bits & 0x00000004u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->minor()); + this->_internal_minor()); } // optional int32 patch = 3; if (cached_has_bits & 0x00000008u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->patch()); + this->_internal_patch()); } } @@ -642,7 +556,7 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) if (from._internal_has_parameter()) { parameter_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.parameter_); } - if (from.has_compiler_version()) { + if (from._internal_has_compiler_version()) { compiler_version_ = new PROTOBUF_NAMESPACE_ID::compiler::Version(*from.compiler_version_); } else { compiler_version_ = nullptr; @@ -697,7 +611,6 @@ void CodeGeneratorRequest::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -728,7 +641,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM // optional .google.protobuf.compiler.Version compiler_version = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { - ptr = ctx->ParseMessage(mutable_compiler_version(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_compiler_version(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -738,7 +651,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_proto_file(), ptr); + ptr = ctx->ParseMessage(_internal_add_proto_file(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr)); @@ -764,90 +677,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool CodeGeneratorRequest::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.compiler.CodeGeneratorRequest) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated string file_to_generate = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_add_file_to_generate())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - file_to_generate_.Get(file_to_generate_.size() - 1).data(), - static_cast(file_to_generate_.Get(file_to_generate_.size() - 1).length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); - } else { - goto handle_unusual; - } - break; - } - - // optional string parameter = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_parameter())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_parameter().data(), static_cast(this->_internal_parameter().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.compiler.CodeGeneratorRequest.parameter"); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.compiler.Version compiler_version = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_compiler_version())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - case 15: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (122 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_proto_file())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.compiler.CodeGeneratorRequest) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.compiler.CodeGeneratorRequest) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorRequest::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -856,9 +685,8 @@ failure: (void) cached_has_bits; // repeated string file_to_generate = 1; - for (auto it = file_to_generate_.pointer_begin(), - end = file_to_generate_.pointer_end(); it < end; ++it) { - const auto& s = **it; + for (int i = 0, n = this->_internal_file_to_generate_size(); i < n; i++) { + const auto& s = this->_internal_file_to_generate(i); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( s.data(), static_cast(s.length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, @@ -886,11 +714,11 @@ failure: } // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - for (auto it = this->proto_file_.pointer_begin(), - end = this->proto_file_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_proto_file_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(15, **it, target, stream); + InternalWriteMessageToArray(15, this->_internal_proto_file(i), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -918,7 +746,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const { } // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - total_size += 1UL * this->proto_file_size(); + total_size += 1UL * this->_internal_proto_file_size(); for (const auto& msg : this->proto_file_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -981,7 +809,7 @@ void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) { parameter_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.parameter_); } if (cached_has_bits & 0x00000002u) { - mutable_compiler_version()->PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom(from.compiler_version()); + _internal_mutable_compiler_version()->PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom(from._internal_compiler_version()); } } } @@ -1113,7 +941,6 @@ void CodeGeneratorResponse_File::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -1163,82 +990,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool CodeGeneratorResponse_File::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.compiler.CodeGeneratorResponse.File) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.compiler.CodeGeneratorResponse.File.name"); - } else { - goto handle_unusual; - } - break; - } - - // optional string insertion_point = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_insertion_point())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_insertion_point().data(), static_cast(this->_internal_insertion_point().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); - } else { - goto handle_unusual; - } - break; - } - - // optional string content = 15; - case 15: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (122 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_content())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_content().data(), static_cast(this->_internal_content().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.compiler.CodeGeneratorResponse.File.content"); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.compiler.CodeGeneratorResponse.File) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.compiler.CodeGeneratorResponse.File) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse_File::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1468,7 +1219,6 @@ void CodeGeneratorResponse::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -1490,7 +1240,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_file(), ptr); + ptr = ctx->ParseMessage(_internal_add_file(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr)); @@ -1516,63 +1266,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool CodeGeneratorResponse::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.compiler.CodeGeneratorResponse) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string error = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_error())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_error().data(), static_cast(this->_internal_error().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.compiler.CodeGeneratorResponse.error"); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - case 15: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (122 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_file())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.compiler.CodeGeneratorResponse) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.compiler.CodeGeneratorResponse) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1592,11 +1285,11 @@ failure: } // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - for (auto it = this->file_.pointer_begin(), - end = this->file_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_file_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(15, **it, target, stream); + InternalWriteMessageToArray(15, this->_internal_file(i), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1616,7 +1309,7 @@ size_t CodeGeneratorResponse::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - total_size += 1UL * this->file_size(); + total_size += 1UL * this->_internal_file_size(); for (const auto& msg : this->file_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -1662,7 +1355,7 @@ void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) { (void) cached_has_bits; file_.MergeFrom(from.file_); - if (from.has_error()) { + if (from._internal_has_error()) { _has_bits_[0] |= 0x00000001u; error_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.error_); } diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index e3e25eaac7..e35ce26542 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -164,12 +164,7 @@ class PROTOC_EXPORT Version : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -239,6 +234,10 @@ class PROTOC_EXPORT Version : void clear_major(); ::PROTOBUF_NAMESPACE_ID::int32 major() const; void set_major(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_major() const; + void _internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // optional int32 minor = 2; bool has_minor() const; @@ -248,6 +247,10 @@ class PROTOC_EXPORT Version : void clear_minor(); ::PROTOBUF_NAMESPACE_ID::int32 minor() const; void set_minor(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_minor() const; + void _internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // optional int32 patch = 3; bool has_patch() const; @@ -257,6 +260,10 @@ class PROTOC_EXPORT Version : void clear_patch(); ::PROTOBUF_NAMESPACE_ID::int32 patch() const; void set_patch(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_patch() const; + void _internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.compiler.Version) private: @@ -349,12 +356,7 @@ class PROTOC_EXPORT CodeGeneratorRequest : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -398,6 +400,9 @@ class PROTOC_EXPORT CodeGeneratorRequest : }; // repeated string file_to_generate = 1; int file_to_generate_size() const; + private: + int _internal_file_to_generate_size() const; + public: void clear_file_to_generate(); const std::string& file_to_generate(int index) const; std::string* mutable_file_to_generate(int index); @@ -413,15 +418,23 @@ class PROTOC_EXPORT CodeGeneratorRequest : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& file_to_generate() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_file_to_generate(); private: + const std::string& _internal_file_to_generate(int index) const; std::string* _internal_add_file_to_generate(); public: // repeated .google.protobuf.FileDescriptorProto proto_file = 15; int proto_file_size() const; + private: + int _internal_proto_file_size() const; + public: void clear_proto_file(); PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* mutable_proto_file(); + private: + const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const; + PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file(); + public: const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const; PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& @@ -457,6 +470,10 @@ class PROTOC_EXPORT CodeGeneratorRequest : PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version(); PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version(); void set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); + private: + const PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const; + PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version(); + public: // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest) private: @@ -549,12 +566,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -745,12 +757,7 @@ class PROTOC_EXPORT CodeGeneratorResponse : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -794,10 +801,17 @@ class PROTOC_EXPORT CodeGeneratorResponse : }; // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; int file_size() const; + private: + int _internal_file_size() const; + public: void clear_file(); PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* mutable_file(); + private: + const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const; + PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file(); + public: const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const; PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& @@ -847,7 +861,8 @@ class PROTOC_EXPORT CodeGeneratorResponse : // optional int32 major = 1; inline bool Version::_internal_has_major() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool Version::has_major() const { return _internal_has_major(); @@ -856,19 +871,26 @@ inline void Version::clear_major() { major_ = 0; _has_bits_[0] &= ~0x00000002u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_major() const { + return major_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 Version::major() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.major) - return major_; + return _internal_major(); } -inline void Version::set_major(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000002u; major_ = value; +} +inline void Version::set_major(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_major(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major) } // optional int32 minor = 2; inline bool Version::_internal_has_minor() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool Version::has_minor() const { return _internal_has_minor(); @@ -877,19 +899,26 @@ inline void Version::clear_minor() { minor_ = 0; _has_bits_[0] &= ~0x00000004u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_minor() const { + return minor_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 Version::minor() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.minor) - return minor_; + return _internal_minor(); } -inline void Version::set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000004u; minor_ = value; +} +inline void Version::set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_minor(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor) } // optional int32 patch = 3; inline bool Version::_internal_has_patch() const { - return (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; } inline bool Version::has_patch() const { return _internal_has_patch(); @@ -898,19 +927,26 @@ inline void Version::clear_patch() { patch_ = 0; _has_bits_[0] &= ~0x00000008u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_patch() const { + return patch_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 Version::patch() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.patch) - return patch_; + return _internal_patch(); } -inline void Version::set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000008u; patch_ = value; +} +inline void Version::set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_patch(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch) } // optional string suffix = 4; inline bool Version::_internal_has_suffix() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool Version::has_suffix() const { return _internal_has_suffix(); @@ -983,9 +1019,12 @@ inline void Version::set_allocated_suffix(std::string* suffix) { // CodeGeneratorRequest // repeated string file_to_generate = 1; -inline int CodeGeneratorRequest::file_to_generate_size() const { +inline int CodeGeneratorRequest::_internal_file_to_generate_size() const { return file_to_generate_.size(); } +inline int CodeGeneratorRequest::file_to_generate_size() const { + return _internal_file_to_generate_size(); +} inline void CodeGeneratorRequest::clear_file_to_generate() { file_to_generate_.Clear(); } @@ -993,9 +1032,12 @@ inline std::string* CodeGeneratorRequest::add_file_to_generate() { // @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return _internal_add_file_to_generate(); } +inline const std::string& CodeGeneratorRequest::_internal_file_to_generate(int index) const { + return file_to_generate_.Get(index); +} inline const std::string& CodeGeneratorRequest::file_to_generate(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return file_to_generate_.Get(index); + return _internal_file_to_generate(index); } inline std::string* CodeGeneratorRequest::mutable_file_to_generate(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) @@ -1052,7 +1094,8 @@ CodeGeneratorRequest::mutable_file_to_generate() { // optional string parameter = 2; inline bool CodeGeneratorRequest::_internal_has_parameter() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool CodeGeneratorRequest::has_parameter() const { return _internal_has_parameter(); @@ -1121,9 +1164,12 @@ inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter } // repeated .google.protobuf.FileDescriptorProto proto_file = 15; -inline int CodeGeneratorRequest::proto_file_size() const { +inline int CodeGeneratorRequest::_internal_proto_file_size() const { return proto_file_.size(); } +inline int CodeGeneratorRequest::proto_file_size() const { + return _internal_proto_file_size(); +} inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_.Mutable(index); @@ -1133,13 +1179,19 @@ CodeGeneratorRequest::mutable_proto_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return &proto_file_; } +inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::_internal_proto_file(int index) const { + return proto_file_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return proto_file_.Get(index); + return _internal_proto_file(index); +} +inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::_internal_add_proto_file() { + return proto_file_.Add(); } inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return proto_file_.Add(); + return _internal_add_proto_file(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& CodeGeneratorRequest::proto_file() const { @@ -1149,7 +1201,9 @@ CodeGeneratorRequest::proto_file() const { // optional .google.protobuf.compiler.Version compiler_version = 3; inline bool CodeGeneratorRequest::_internal_has_compiler_version() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || compiler_version_ != nullptr); + return value; } inline bool CodeGeneratorRequest::has_compiler_version() const { return _internal_has_compiler_version(); @@ -1158,12 +1212,15 @@ inline void CodeGeneratorRequest::clear_compiler_version() { if (compiler_version_ != nullptr) compiler_version_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::compiler_version() const { +inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { const PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_; - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::compiler_version() const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) + return _internal_compiler_version(); +} inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_compiler_version() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) _has_bits_[0] &= ~0x00000002u; @@ -1171,15 +1228,18 @@ inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_c compiler_version_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { +inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { _has_bits_[0] |= 0x00000002u; if (compiler_version_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); compiler_version_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return compiler_version_; } +inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) + return _internal_mutable_compiler_version(); +} inline void CodeGeneratorRequest::set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -1205,7 +1265,8 @@ inline void CodeGeneratorRequest::set_allocated_compiler_version(PROTOBUF_NAMESP // optional string name = 1; inline bool CodeGeneratorResponse_File::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool CodeGeneratorResponse_File::has_name() const { return _internal_has_name(); @@ -1275,7 +1336,8 @@ inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) { // optional string insertion_point = 2; inline bool CodeGeneratorResponse_File::_internal_has_insertion_point() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool CodeGeneratorResponse_File::has_insertion_point() const { return _internal_has_insertion_point(); @@ -1345,7 +1407,8 @@ inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::strin // optional string content = 15; inline bool CodeGeneratorResponse_File::_internal_has_content() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool CodeGeneratorResponse_File::has_content() const { return _internal_has_content(); @@ -1419,7 +1482,8 @@ inline void CodeGeneratorResponse_File::set_allocated_content(std::string* conte // optional string error = 1; inline bool CodeGeneratorResponse::_internal_has_error() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool CodeGeneratorResponse::has_error() const { return _internal_has_error(); @@ -1488,9 +1552,12 @@ inline void CodeGeneratorResponse::set_allocated_error(std::string* error) { } // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; -inline int CodeGeneratorResponse::file_size() const { +inline int CodeGeneratorResponse::_internal_file_size() const { return file_.size(); } +inline int CodeGeneratorResponse::file_size() const { + return _internal_file_size(); +} inline void CodeGeneratorResponse::clear_file() { file_.Clear(); } @@ -1503,13 +1570,19 @@ CodeGeneratorResponse::mutable_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file) return &file_; } +inline const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::_internal_file(int index) const { + return file_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file) - return file_.Get(index); + return _internal_file(index); +} +inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::_internal_add_file() { + return file_.Add(); } inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) - return file_.Add(); + return _internal_add_file(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& CodeGeneratorResponse::file() const { diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc index cddad3ea2c..c5c80eba95 100644 --- a/src/google/protobuf/compiler/python/python_generator.cc +++ b/src/google/protobuf/compiler/python/python_generator.cc @@ -44,6 +44,8 @@ // performance-minded Python code leverage the fast C++ implementation // directly. +#include + #include #include #include @@ -52,12 +54,10 @@ #include #include -#include -#include - #include #include #include +#include #include #include #include diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index df25ac9cd6..78ec0f07c7 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -59,8 +59,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -905,6 +905,14 @@ inline Symbol FileDescriptorTables::FindNestedSymbolOfType( Symbol DescriptorPool::Tables::FindByNameHelper(const DescriptorPool* pool, const std::string& name) { + if (pool->mutex_ != nullptr) { + // Fast path: the Symbol is already cached. This is just a hash lookup. + ReaderMutexLock lock(pool->mutex_); + if (known_bad_symbols_.empty() && known_bad_files_.empty()) { + Symbol result = FindSymbol(name); + if (!result.IsNull()) return result; + } + } MutexLockMaybe lock(pool->mutex_); if (pool->fallback_database_ != nullptr) { known_bad_symbols_.clear(); @@ -3681,7 +3689,14 @@ Symbol DescriptorBuilder::FindSymbolNotEnforcingDepsHelper( Symbol DescriptorBuilder::FindSymbolNotEnforcingDeps(const std::string& name, bool build_it) { - return FindSymbolNotEnforcingDepsHelper(pool_, name, build_it); + Symbol result = FindSymbolNotEnforcingDepsHelper(pool_, name, build_it); + // Only find symbols which were defined in this file or one of its + // dependencies. + const FileDescriptor* file = result.GetFile(); + if (file == file_ || dependencies_.count(file) > 0) { + unused_dependency_.erase(file); + } + return result; } Symbol DescriptorBuilder::FindSymbol(const std::string& name, bool build_it) { @@ -3698,7 +3713,6 @@ Symbol DescriptorBuilder::FindSymbol(const std::string& name, bool build_it) { // dependencies. const FileDescriptor* file = result.GetFile(); if (file == file_ || dependencies_.count(file) > 0) { - unused_dependency_.erase(file); return result; } @@ -7104,35 +7118,13 @@ void DescriptorBuilder::LogUnusedDependency(const FileDescriptorProto& proto, const FileDescriptor* result) { if (!unused_dependency_.empty()) { - std::set annotation_extensions; - annotation_extensions.insert("google.protobuf.MessageOptions"); - annotation_extensions.insert("google.protobuf.FileOptions"); - annotation_extensions.insert("google.protobuf.FieldOptions"); - annotation_extensions.insert("google.protobuf.EnumOptions"); - annotation_extensions.insert("google.protobuf.EnumValueOptions"); - annotation_extensions.insert("google.protobuf.EnumValueOptions"); - annotation_extensions.insert("google.protobuf.ServiceOptions"); - annotation_extensions.insert("google.protobuf.MethodOptions"); - annotation_extensions.insert("google.protobuf.StreamOptions"); for (std::set::const_iterator it = unused_dependency_.begin(); it != unused_dependency_.end(); ++it) { - // Do not log warnings for proto files which extend annotations. - int i; - for (i = 0; i < (*it)->extension_count(); ++i) { - if (annotation_extensions.find( - (*it)->extension(i)->containing_type()->full_name()) != - annotation_extensions.end()) { - break; - } - } // Log warnings for unused imported files. - if (i == (*it)->extension_count()) { - std::string error_message = - "Import " + (*it)->name() + " but not used."; - AddWarning((*it)->name(), proto, DescriptorPool::ErrorCollector::IMPORT, - error_message); - } + std::string error_message = "Import " + (*it)->name() + " but not used."; + AddWarning((*it)->name(), proto, DescriptorPool::ErrorCollector::IMPORT, + error_message); } } } diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 092be42854..d624c1c065 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1446,7 +1446,6 @@ void FileDescriptorSet::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* FileDescriptorSet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -1461,7 +1460,7 @@ const char* FileDescriptorSet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESP ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_file(), ptr); + ptr = ctx->ParseMessage(_internal_add_file(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); @@ -1486,48 +1485,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool FileDescriptorSet::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.FileDescriptorSet) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .google.protobuf.FileDescriptorProto file = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_file())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.FileDescriptorSet) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.FileDescriptorSet) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* FileDescriptorSet::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1536,11 +1493,11 @@ failure: (void) cached_has_bits; // repeated .google.protobuf.FileDescriptorProto file = 1; - for (auto it = this->file_.pointer_begin(), - end = this->file_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_file_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(1, **it, target, stream); + InternalWriteMessageToArray(1, this->_internal_file(i), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1560,7 +1517,7 @@ size_t FileDescriptorSet::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.FileDescriptorProto file = 1; - total_size += 1UL * this->file_size(); + total_size += 1UL * this->_internal_file_size(); for (const auto& msg : this->file_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -1741,12 +1698,12 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_syntax(), GetArenaNoVirtual()); } - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::FileOptions(*from.options_); } else { options_ = nullptr; } - if (from.has_source_code_info()) { + if (from._internal_has_source_code_info()) { source_code_info_ = new PROTOBUF_NAMESPACE_ID::SourceCodeInfo(*from.source_code_info_); } else { source_code_info_ = nullptr; @@ -1830,7 +1787,6 @@ void FileDescriptorProto::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -1872,7 +1828,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_message_type(), ptr); + ptr = ctx->ParseMessage(_internal_add_message_type(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); @@ -1884,7 +1840,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_enum_type(), ptr); + ptr = ctx->ParseMessage(_internal_add_enum_type(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr)); @@ -1896,7 +1852,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_service(), ptr); + ptr = ctx->ParseMessage(_internal_add_service(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); @@ -1908,7 +1864,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_extension(), ptr); + ptr = ctx->ParseMessage(_internal_add_extension(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<58>(ptr)); @@ -1917,14 +1873,14 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME // optional .google.protobuf.FileOptions options = 8; case 8: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional .google.protobuf.SourceCodeInfo source_code_info = 9; case 9: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) { - ptr = ctx->ParseMessage(mutable_source_code_info(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_source_code_info(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -1934,12 +1890,12 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - add_public_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); + _internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<80>(ptr)); } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82) { - ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(mutable_public_dependency(), ptr, ctx); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_public_dependency(), ptr, ctx); CHK_(ptr); } else goto handle_unusual; continue; @@ -1949,12 +1905,12 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - add_weak_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); + _internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<88>(ptr)); } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90) { - ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(mutable_weak_dependency(), ptr, ctx); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_weak_dependency(), ptr, ctx); CHK_(ptr); } else goto handle_unusual; continue; @@ -1985,196 +1941,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool FileDescriptorProto::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.FileDescriptorProto) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileDescriptorProto.name"); - } else { - goto handle_unusual; - } - break; - } - - // optional string package = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_package())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_package().data(), static_cast(this->_internal_package().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileDescriptorProto.package"); - } else { - goto handle_unusual; - } - break; - } - - // repeated string dependency = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_add_dependency())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - dependency_.Get(dependency_.size() - 1).data(), - static_cast(dependency_.Get(dependency_.size() - 1).length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileDescriptorProto.dependency"); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.DescriptorProto message_type = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_message_type())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_enum_type())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.ServiceDescriptorProto service = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_service())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.FieldDescriptorProto extension = 7; - case 7: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (58 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_extension())); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.FileOptions options = 8; - case 8: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (66 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.SourceCodeInfo source_code_info = 9; - case 9: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (74 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_source_code_info())); - } else { - goto handle_unusual; - } - break; - } - - // repeated int32 public_dependency = 10; - case 10: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (80 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadRepeatedPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - 1, 80u, input, this->mutable_public_dependency()))); - } else if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (82 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPackedPrimitiveNoInline< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_public_dependency()))); - } else { - goto handle_unusual; - } - break; - } - - // repeated int32 weak_dependency = 11; - case 11: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (88 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadRepeatedPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - 1, 88u, input, this->mutable_weak_dependency()))); - } else if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (90 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPackedPrimitiveNoInline< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_weak_dependency()))); - } else { - goto handle_unusual; - } - break; - } - - // optional string syntax = 12; - case 12: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (98 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_syntax())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_syntax().data(), static_cast(this->_internal_syntax().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileDescriptorProto.syntax"); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.FileDescriptorProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.FileDescriptorProto) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* FileDescriptorProto::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -2204,9 +1970,8 @@ failure: } // repeated string dependency = 3; - for (auto it = dependency_.pointer_begin(), - end = dependency_.pointer_end(); it < end; ++it) { - const auto& s = **it; + for (int i = 0, n = this->_internal_dependency_size(); i < n; i++) { + const auto& s = this->_internal_dependency(i); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( s.data(), static_cast(s.length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, @@ -2215,35 +1980,35 @@ failure: } // repeated .google.protobuf.DescriptorProto message_type = 4; - for (auto it = this->message_type_.pointer_begin(), - end = this->message_type_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_message_type_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(4, **it, target, stream); + InternalWriteMessageToArray(4, this->_internal_message_type(i), target, stream); } // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - for (auto it = this->enum_type_.pointer_begin(), - end = this->enum_type_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_enum_type_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(5, **it, target, stream); + InternalWriteMessageToArray(5, this->_internal_enum_type(i), target, stream); } // repeated .google.protobuf.ServiceDescriptorProto service = 6; - for (auto it = this->service_.pointer_begin(), - end = this->service_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_service_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(6, **it, target, stream); + InternalWriteMessageToArray(6, this->_internal_service(i), target, stream); } // repeated .google.protobuf.FieldDescriptorProto extension = 7; - for (auto it = this->extension_.pointer_begin(), - end = this->extension_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_extension_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(7, **it, target, stream); + InternalWriteMessageToArray(7, this->_internal_extension(i), target, stream); } // optional .google.protobuf.FileOptions options = 8; @@ -2263,15 +2028,15 @@ failure: } // repeated int32 public_dependency = 10; - for (const auto& x : this->public_dependency()) { + for (int i = 0, n = this->_internal_public_dependency_size(); i < n; i++) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(10, x, target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(10, this->_internal_public_dependency(i), target); } // repeated int32 weak_dependency = 11; - for (const auto& x : this->weak_dependency()) { + for (int i = 0, n = this->_internal_weak_dependency_size(); i < n; i++) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(11, x, target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(11, this->_internal_weak_dependency(i), target); } // optional string syntax = 12; @@ -2309,28 +2074,28 @@ size_t FileDescriptorProto::ByteSizeLong() const { } // repeated .google.protobuf.DescriptorProto message_type = 4; - total_size += 1UL * this->message_type_size(); + total_size += 1UL * this->_internal_message_type_size(); for (const auto& msg : this->message_type_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - total_size += 1UL * this->enum_type_size(); + total_size += 1UL * this->_internal_enum_type_size(); for (const auto& msg : this->enum_type_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.ServiceDescriptorProto service = 6; - total_size += 1UL * this->service_size(); + total_size += 1UL * this->_internal_service_size(); for (const auto& msg : this->service_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.FieldDescriptorProto extension = 7; - total_size += 1UL * this->extension_size(); + total_size += 1UL * this->_internal_extension_size(); for (const auto& msg : this->extension_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -2341,7 +2106,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: Int32Size(this->public_dependency_); total_size += 1 * - ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->public_dependency_size()); + ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_public_dependency_size()); total_size += data_size; } @@ -2350,7 +2115,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: Int32Size(this->weak_dependency_); total_size += 1 * - ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->weak_dependency_size()); + ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_weak_dependency_size()); total_size += data_size; } @@ -2442,10 +2207,10 @@ void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) { _internal_set_syntax(from._internal_syntax()); } if (cached_has_bits & 0x00000008u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::FileOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::FileOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000010u) { - mutable_source_code_info()->PROTOBUF_NAMESPACE_ID::SourceCodeInfo::MergeFrom(from.source_code_info()); + _internal_mutable_source_code_info()->PROTOBUF_NAMESPACE_ID::SourceCodeInfo::MergeFrom(from._internal_source_code_info()); } } } @@ -2556,7 +2321,7 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP _internal_metadata_(nullptr), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom(from._internal_metadata_); - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions(*from.options_); } else { options_ = nullptr; @@ -2619,7 +2384,6 @@ void DescriptorProto_ExtensionRange::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -2648,7 +2412,7 @@ const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PR // optional .google.protobuf.ExtensionRangeOptions options = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -2672,74 +2436,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto.ExtensionRange) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional int32 start = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - _Internal::set_has_start(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &start_))); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 end = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_end(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &end_))); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.ExtensionRangeOptions options = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.DescriptorProto.ExtensionRange) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.DescriptorProto.ExtensionRange) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto_ExtensionRange::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -2751,13 +2447,13 @@ failure: // optional int32 start = 1; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->start(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_start(), target); } // optional int32 end = 2; if (cached_has_bits & 0x00000004u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->end(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_end(), target); } // optional .google.protobuf.ExtensionRangeOptions options = 3; @@ -2797,14 +2493,14 @@ size_t DescriptorProto_ExtensionRange::ByteSizeLong() const { if (cached_has_bits & 0x00000002u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->start()); + this->_internal_start()); } // optional int32 end = 2; if (cached_has_bits & 0x00000004u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->end()); + this->_internal_end()); } } @@ -2842,7 +2538,7 @@ void DescriptorProto_ExtensionRange::MergeFrom(const DescriptorProto_ExtensionRa cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 0x00000007u) { if (cached_has_bits & 0x00000001u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000002u) { start_ = from.start_; @@ -2973,7 +2669,6 @@ void DescriptorProto_ReservedRange::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* DescriptorProto_ReservedRange::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -3019,63 +2714,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool DescriptorProto_ReservedRange::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto.ReservedRange) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional int32 start = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - _Internal::set_has_start(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &start_))); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 end = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_end(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &end_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.DescriptorProto.ReservedRange) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.DescriptorProto.ReservedRange) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto_ReservedRange::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -3087,13 +2725,13 @@ failure: // optional int32 start = 1; if (cached_has_bits & 0x00000001u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->start(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_start(), target); } // optional int32 end = 2; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->end(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_end(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -3118,14 +2756,14 @@ size_t DescriptorProto_ReservedRange::ByteSizeLong() const { if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->start()); + this->_internal_start()); } // optional int32 end = 2; if (cached_has_bits & 0x00000002u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->end()); + this->_internal_end()); } } @@ -3276,7 +2914,7 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from) name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), GetArenaNoVirtual()); } - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::MessageOptions(*from.options_); } else { options_ = nullptr; @@ -3344,7 +2982,6 @@ void DescriptorProto::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -3367,7 +3004,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_field(), ptr); + ptr = ctx->ParseMessage(_internal_add_field(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); @@ -3379,7 +3016,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_nested_type(), ptr); + ptr = ctx->ParseMessage(_internal_add_nested_type(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); @@ -3391,7 +3028,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_enum_type(), ptr); + ptr = ctx->ParseMessage(_internal_add_enum_type(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); @@ -3403,7 +3040,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_extension_range(), ptr); + ptr = ctx->ParseMessage(_internal_add_extension_range(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr)); @@ -3415,7 +3052,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_extension(), ptr); + ptr = ctx->ParseMessage(_internal_add_extension(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); @@ -3424,7 +3061,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC // optional .google.protobuf.MessageOptions options = 7; case 7: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -3434,7 +3071,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_oneof_decl(), ptr); + ptr = ctx->ParseMessage(_internal_add_oneof_decl(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<66>(ptr)); @@ -3446,7 +3083,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_reserved_range(), ptr); + ptr = ctx->ParseMessage(_internal_add_reserved_range(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<74>(ptr)); @@ -3484,156 +3121,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool DescriptorProto::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.DescriptorProto.name"); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.FieldDescriptorProto field = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_field())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.DescriptorProto nested_type = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_nested_type())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_enum_type())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_extension_range())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.FieldDescriptorProto extension = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_extension())); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.MessageOptions options = 7; - case 7: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (58 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; - case 8: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (66 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_oneof_decl())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - case 9: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (74 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_reserved_range())); - } else { - goto handle_unusual; - } - break; - } - - // repeated string reserved_name = 10; - case 10: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (82 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_add_reserved_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - reserved_name_.Get(reserved_name_.size() - 1).data(), - static_cast(reserved_name_.Get(reserved_name_.size() - 1).length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.DescriptorProto.reserved_name"); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.DescriptorProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.DescriptorProto) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -3653,43 +3140,43 @@ failure: } // repeated .google.protobuf.FieldDescriptorProto field = 2; - for (auto it = this->field_.pointer_begin(), - end = this->field_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_field_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(2, **it, target, stream); + InternalWriteMessageToArray(2, this->_internal_field(i), target, stream); } // repeated .google.protobuf.DescriptorProto nested_type = 3; - for (auto it = this->nested_type_.pointer_begin(), - end = this->nested_type_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_nested_type_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(3, **it, target, stream); + InternalWriteMessageToArray(3, this->_internal_nested_type(i), target, stream); } // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - for (auto it = this->enum_type_.pointer_begin(), - end = this->enum_type_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_enum_type_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(4, **it, target, stream); + InternalWriteMessageToArray(4, this->_internal_enum_type(i), target, stream); } // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - for (auto it = this->extension_range_.pointer_begin(), - end = this->extension_range_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_extension_range_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(5, **it, target, stream); + InternalWriteMessageToArray(5, this->_internal_extension_range(i), target, stream); } // repeated .google.protobuf.FieldDescriptorProto extension = 6; - for (auto it = this->extension_.pointer_begin(), - end = this->extension_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_extension_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(6, **it, target, stream); + InternalWriteMessageToArray(6, this->_internal_extension(i), target, stream); } // optional .google.protobuf.MessageOptions options = 7; @@ -3701,25 +3188,24 @@ failure: } // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; - for (auto it = this->oneof_decl_.pointer_begin(), - end = this->oneof_decl_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_oneof_decl_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(8, **it, target, stream); + InternalWriteMessageToArray(8, this->_internal_oneof_decl(i), target, stream); } // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - for (auto it = this->reserved_range_.pointer_begin(), - end = this->reserved_range_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_reserved_range_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(9, **it, target, stream); + InternalWriteMessageToArray(9, this->_internal_reserved_range(i), target, stream); } // repeated string reserved_name = 10; - for (auto it = reserved_name_.pointer_begin(), - end = reserved_name_.pointer_end(); it < end; ++it) { - const auto& s = **it; + for (int i = 0, n = this->_internal_reserved_name_size(); i < n; i++) { + const auto& s = this->_internal_reserved_name(i); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( s.data(), static_cast(s.length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, @@ -3744,49 +3230,49 @@ size_t DescriptorProto::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.FieldDescriptorProto field = 2; - total_size += 1UL * this->field_size(); + total_size += 1UL * this->_internal_field_size(); for (const auto& msg : this->field_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.DescriptorProto nested_type = 3; - total_size += 1UL * this->nested_type_size(); + total_size += 1UL * this->_internal_nested_type_size(); for (const auto& msg : this->nested_type_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - total_size += 1UL * this->enum_type_size(); + total_size += 1UL * this->_internal_enum_type_size(); for (const auto& msg : this->enum_type_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - total_size += 1UL * this->extension_range_size(); + total_size += 1UL * this->_internal_extension_range_size(); for (const auto& msg : this->extension_range_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.FieldDescriptorProto extension = 6; - total_size += 1UL * this->extension_size(); + total_size += 1UL * this->_internal_extension_size(); for (const auto& msg : this->extension_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; - total_size += 1UL * this->oneof_decl_size(); + total_size += 1UL * this->_internal_oneof_decl_size(); for (const auto& msg : this->oneof_decl_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - total_size += 1UL * this->reserved_range_size(); + total_size += 1UL * this->_internal_reserved_range_size(); for (const auto& msg : this->reserved_range_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -3862,7 +3348,7 @@ void DescriptorProto::MergeFrom(const DescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::MessageOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::MessageOptions::MergeFrom(from._internal_options()); } } } @@ -3989,7 +3475,6 @@ void ExtensionRangeOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* ExtensionRangeOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -4004,7 +3489,7 @@ const char* ExtensionRangeOptions::_InternalParse(const char* ptr, ::PROTOBUF_NA ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -4035,54 +3520,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool ExtensionRangeOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.ExtensionRangeOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.ExtensionRangeOptions) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.ExtensionRangeOptions) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* ExtensionRangeOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -4091,11 +3528,11 @@ failure: (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -4121,7 +3558,7 @@ size_t ExtensionRangeOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -4299,7 +3736,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_json_name(), GetArenaNoVirtual()); } - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::FieldOptions(*from.options_); } else { options_ = nullptr; @@ -4395,7 +3832,6 @@ void FieldDescriptorProto::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -4433,7 +3869,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(val))) { - set_label(static_cast(val)); + _internal_set_label(static_cast(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); } @@ -4445,7 +3881,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(val))) { - set_type(static_cast(val)); + _internal_set_type(static_cast(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(5, val, mutable_unknown_fields()); } @@ -4468,7 +3904,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM // optional .google.protobuf.FieldOptions options = 8; case 8: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -4507,187 +3943,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool FieldDescriptorProto::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.FieldDescriptorProto) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FieldDescriptorProto.name"); - } else { - goto handle_unusual; - } - break; - } - - // optional string extendee = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_extendee())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_extendee().data(), static_cast(this->_internal_extendee().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FieldDescriptorProto.extendee"); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 number = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { - _Internal::set_has_number(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &number_))); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.FieldDescriptorProto.Label label = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (32 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(value)) { - set_label(static_cast< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label >(value)); - } else { - mutable_unknown_fields()->AddVarint( - 4, static_cast<::PROTOBUF_NAMESPACE_ID::uint64>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.FieldDescriptorProto.Type type = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (40 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(value)) { - set_type(static_cast< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type >(value)); - } else { - mutable_unknown_fields()->AddVarint( - 5, static_cast<::PROTOBUF_NAMESPACE_ID::uint64>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // optional string type_name = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_type_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_type_name().data(), static_cast(this->_internal_type_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FieldDescriptorProto.type_name"); - } else { - goto handle_unusual; - } - break; - } - - // optional string default_value = 7; - case 7: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (58 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_default_value())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_default_value().data(), static_cast(this->_internal_default_value().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FieldDescriptorProto.default_value"); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.FieldOptions options = 8; - case 8: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (66 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 oneof_index = 9; - case 9: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (72 & 0xFF)) { - _Internal::set_has_oneof_index(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &oneof_index_))); - } else { - goto handle_unusual; - } - break; - } - - // optional string json_name = 10; - case 10: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (82 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_json_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_json_name().data(), static_cast(this->_internal_json_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FieldDescriptorProto.json_name"); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.FieldDescriptorProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.FieldDescriptorProto) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* FieldDescriptorProto::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -4719,21 +3974,21 @@ failure: // optional int32 number = 3; if (cached_has_bits & 0x00000040u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->number(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_number(), target); } // optional .google.protobuf.FieldDescriptorProto.Label label = 4; if (cached_has_bits & 0x00000100u) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 4, this->label(), target); + 4, this->_internal_label(), target); } // optional .google.protobuf.FieldDescriptorProto.Type type = 5; if (cached_has_bits & 0x00000200u) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 5, this->type(), target); + 5, this->_internal_type(), target); } // optional string type_name = 6; @@ -4767,7 +4022,7 @@ failure: // optional int32 oneof_index = 9; if (cached_has_bits & 0x00000080u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(9, this->oneof_index(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(9, this->_internal_oneof_index(), target); } // optional string json_name = 10; @@ -4844,14 +4099,14 @@ size_t FieldDescriptorProto::ByteSizeLong() const { if (cached_has_bits & 0x00000040u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->number()); + this->_internal_number()); } // optional int32 oneof_index = 9; if (cached_has_bits & 0x00000080u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->oneof_index()); + this->_internal_oneof_index()); } } @@ -4859,13 +4114,13 @@ size_t FieldDescriptorProto::ByteSizeLong() const { // optional .google.protobuf.FieldDescriptorProto.Label label = 4; if (cached_has_bits & 0x00000100u) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->label()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_label()); } // optional .google.protobuf.FieldDescriptorProto.Type type = 5; if (cached_has_bits & 0x00000200u) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->type()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_type()); } } @@ -4918,7 +4173,7 @@ void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) { _internal_set_json_name(from._internal_json_name()); } if (cached_has_bits & 0x00000020u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::FieldOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::FieldOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000040u) { number_ = from.number_; @@ -5043,7 +4298,7 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from) name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), GetArenaNoVirtual()); } - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::OneofOptions(*from.options_); } else { options_ = nullptr; @@ -5103,7 +4358,6 @@ void OneofDescriptorProto::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* OneofDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -5123,7 +4377,7 @@ const char* OneofDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM // optional .google.protobuf.OneofOptions options = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -5147,69 +4401,12 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool OneofDescriptorProto::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.OneofDescriptorProto) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.OneofDescriptorProto.name"); - } else { - goto handle_unusual; - } - break; - } - // optional .google.protobuf.OneofOptions options = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.OneofDescriptorProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.OneofDescriptorProto) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - -::PROTOBUF_NAMESPACE_ID::uint8* OneofDescriptorProto::InternalSerializeWithCachedSizesToArray( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; +::PROTOBUF_NAMESPACE_ID::uint8* OneofDescriptorProto::InternalSerializeWithCachedSizesToArray( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofDescriptorProto) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional string name = 1; @@ -5300,7 +4497,7 @@ void OneofDescriptorProto::MergeFrom(const OneofDescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::OneofOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::OneofOptions::MergeFrom(from._internal_options()); } } } @@ -5424,7 +4621,6 @@ void EnumDescriptorProto_EnumReservedRange::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* EnumDescriptorProto_EnumReservedRange::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -5470,63 +4666,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool EnumDescriptorProto_EnumReservedRange::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional int32 start = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - _Internal::set_has_start(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &start_))); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 end = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_end(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &end_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.EnumDescriptorProto.EnumReservedRange) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.EnumDescriptorProto.EnumReservedRange) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* EnumDescriptorProto_EnumReservedRange::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -5538,13 +4677,13 @@ failure: // optional int32 start = 1; if (cached_has_bits & 0x00000001u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->start(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_start(), target); } // optional int32 end = 2; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->end(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_end(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -5569,14 +4708,14 @@ size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong() const { if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->start()); + this->_internal_start()); } // optional int32 end = 2; if (cached_has_bits & 0x00000002u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->end()); + this->_internal_end()); } } @@ -5717,7 +4856,7 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from) name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), GetArenaNoVirtual()); } - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::EnumOptions(*from.options_); } else { options_ = nullptr; @@ -5780,7 +4919,6 @@ void EnumDescriptorProto::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -5803,7 +4941,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_value(), ptr); + ptr = ctx->ParseMessage(_internal_add_value(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); @@ -5812,7 +4950,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME // optional .google.protobuf.EnumOptions options = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -5822,7 +4960,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_reserved_range(), ptr); + ptr = ctx->ParseMessage(_internal_add_reserved_range(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); @@ -5860,101 +4998,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool EnumDescriptorProto::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.EnumDescriptorProto) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.EnumDescriptorProto.name"); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.EnumValueDescriptorProto value = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_value())); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.EnumOptions options = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_reserved_range())); - } else { - goto handle_unusual; - } - break; - } - - // repeated string reserved_name = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_add_reserved_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - reserved_name_.Get(reserved_name_.size() - 1).data(), - static_cast(reserved_name_.Get(reserved_name_.size() - 1).length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.EnumDescriptorProto.reserved_name"); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.EnumDescriptorProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.EnumDescriptorProto) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* EnumDescriptorProto::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -5974,11 +5017,11 @@ failure: } // repeated .google.protobuf.EnumValueDescriptorProto value = 2; - for (auto it = this->value_.pointer_begin(), - end = this->value_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_value_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(2, **it, target, stream); + InternalWriteMessageToArray(2, this->_internal_value(i), target, stream); } // optional .google.protobuf.EnumOptions options = 3; @@ -5990,17 +5033,16 @@ failure: } // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; - for (auto it = this->reserved_range_.pointer_begin(), - end = this->reserved_range_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_reserved_range_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(4, **it, target, stream); + InternalWriteMessageToArray(4, this->_internal_reserved_range(i), target, stream); } // repeated string reserved_name = 5; - for (auto it = reserved_name_.pointer_begin(), - end = reserved_name_.pointer_end(); it < end; ++it) { - const auto& s = **it; + for (int i = 0, n = this->_internal_reserved_name_size(); i < n; i++) { + const auto& s = this->_internal_reserved_name(i); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( s.data(), static_cast(s.length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, @@ -6025,14 +5067,14 @@ size_t EnumDescriptorProto::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.EnumValueDescriptorProto value = 2; - total_size += 1UL * this->value_size(); + total_size += 1UL * this->_internal_value_size(); for (const auto& msg : this->value_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; - total_size += 1UL * this->reserved_range_size(); + total_size += 1UL * this->_internal_reserved_range_size(); for (const auto& msg : this->reserved_range_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -6103,7 +5145,7 @@ void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::EnumOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::EnumOptions::MergeFrom(from._internal_options()); } } } @@ -6207,7 +5249,7 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), GetArenaNoVirtual()); } - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::EnumValueOptions(*from.options_); } else { options_ = nullptr; @@ -6271,7 +5313,6 @@ void EnumValueDescriptorProto::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -6299,7 +5340,7 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF // optional .google.protobuf.EnumValueOptions options = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -6323,76 +5364,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool EnumValueDescriptorProto::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.EnumValueDescriptorProto) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.EnumValueDescriptorProto.name"); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 number = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_number(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &number_))); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.EnumValueOptions options = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.EnumValueDescriptorProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.EnumValueDescriptorProto) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* EnumValueDescriptorProto::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -6414,7 +5385,7 @@ failure: // optional int32 number = 2; if (cached_has_bits & 0x00000004u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->number(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_number(), target); } // optional .google.protobuf.EnumValueOptions options = 3; @@ -6461,7 +5432,7 @@ size_t EnumValueDescriptorProto::ByteSizeLong() const { if (cached_has_bits & 0x00000004u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->number()); + this->_internal_number()); } } @@ -6502,7 +5473,7 @@ void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::EnumValueOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::EnumValueOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000004u) { number_ = from.number_; @@ -6606,7 +5577,7 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), GetArenaNoVirtual()); } - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::ServiceOptions(*from.options_); } else { options_ = nullptr; @@ -6667,7 +5638,6 @@ void ServiceDescriptorProto::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -6690,7 +5660,7 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_method(), ptr); + ptr = ctx->ParseMessage(_internal_add_method(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); @@ -6699,7 +5669,7 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N // optional .google.protobuf.ServiceOptions options = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -6723,74 +5693,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool ServiceDescriptorProto::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.ServiceDescriptorProto) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.ServiceDescriptorProto.name"); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.MethodDescriptorProto method = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_method())); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.ServiceOptions options = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.ServiceDescriptorProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.ServiceDescriptorProto) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* ServiceDescriptorProto::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -6810,11 +5712,11 @@ failure: } // repeated .google.protobuf.MethodDescriptorProto method = 2; - for (auto it = this->method_.pointer_begin(), - end = this->method_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_method_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(2, **it, target, stream); + InternalWriteMessageToArray(2, this->_internal_method(i), target, stream); } // optional .google.protobuf.ServiceOptions options = 3; @@ -6842,7 +5744,7 @@ size_t ServiceDescriptorProto::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.MethodDescriptorProto method = 2; - total_size += 1UL * this->method_size(); + total_size += 1UL * this->_internal_method_size(); for (const auto& msg : this->method_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -6903,7 +5805,7 @@ void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::ServiceOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::ServiceOptions::MergeFrom(from._internal_options()); } } } @@ -7024,7 +5926,7 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_output_type(), GetArenaNoVirtual()); } - if (from.has_options()) { + if (from._internal_has_options()) { options_ = new PROTOBUF_NAMESPACE_ID::MethodOptions(*from.options_); } else { options_ = nullptr; @@ -7102,7 +6004,6 @@ void MethodDescriptorProto::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -7136,7 +6037,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA // optional .google.protobuf.MethodOptions options = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { - ptr = ctx->ParseMessage(mutable_options(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -7176,119 +6077,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool MethodDescriptorProto::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.MethodDescriptorProto) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.MethodDescriptorProto.name"); - } else { - goto handle_unusual; - } - break; - } - - // optional string input_type = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_input_type())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_input_type().data(), static_cast(this->_internal_input_type().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.MethodDescriptorProto.input_type"); - } else { - goto handle_unusual; - } - break; - } - - // optional string output_type = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_output_type())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_output_type().data(), static_cast(this->_internal_output_type().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.MethodDescriptorProto.output_type"); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.MethodOptions options = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_options())); - } else { - goto handle_unusual; - } - break; - } - - // optional bool client_streaming = 5 [default = false]; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (40 & 0xFF)) { - _Internal::set_has_client_streaming(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &client_streaming_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool server_streaming = 6 [default = false]; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (48 & 0xFF)) { - _Internal::set_has_server_streaming(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &server_streaming_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.MethodDescriptorProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.MethodDescriptorProto) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* MethodDescriptorProto::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -7338,13 +6126,13 @@ failure: // optional bool client_streaming = 5 [default = false]; if (cached_has_bits & 0x00000010u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->client_streaming(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_client_streaming(), target); } // optional bool server_streaming = 6 [default = false]; if (cached_has_bits & 0x00000020u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(6, this->server_streaming(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(6, this->_internal_server_streaming(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -7447,7 +6235,7 @@ void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) { _internal_set_output_type(from._internal_output_type()); } if (cached_has_bits & 0x00000008u) { - mutable_options()->PROTOBUF_NAMESPACE_ID::MethodOptions::MergeFrom(from.options()); + _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::MethodOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000010u) { client_streaming_ = from.client_streaming_; @@ -7756,7 +6544,6 @@ void FileOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -7786,7 +6573,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(val))) { - set_optimize_for(static_cast(val)); + _internal_set_optimize_for(static_cast(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(9, val, mutable_unknown_fields()); } @@ -7926,7 +6713,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -7958,340 +6745,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool FileOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.FileOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string java_package = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_java_package())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_java_package().data(), static_cast(this->_internal_java_package().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.java_package"); - } else { - goto handle_unusual; - } - break; - } - - // optional string java_outer_classname = 8; - case 8: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (66 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_java_outer_classname())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_java_outer_classname().data(), static_cast(this->_internal_java_outer_classname().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.java_outer_classname"); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; - case 9: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (72 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(value)) { - set_optimize_for(static_cast< PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode >(value)); - } else { - mutable_unknown_fields()->AddVarint( - 9, static_cast<::PROTOBUF_NAMESPACE_ID::uint64>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // optional bool java_multiple_files = 10 [default = false]; - case 10: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (80 & 0xFF)) { - _Internal::set_has_java_multiple_files(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &java_multiple_files_))); - } else { - goto handle_unusual; - } - break; - } - - // optional string go_package = 11; - case 11: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (90 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_go_package())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_go_package().data(), static_cast(this->_internal_go_package().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.go_package"); - } else { - goto handle_unusual; - } - break; - } - - // optional bool cc_generic_services = 16 [default = false]; - case 16: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (128 & 0xFF)) { - _Internal::set_has_cc_generic_services(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &cc_generic_services_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool java_generic_services = 17 [default = false]; - case 17: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (136 & 0xFF)) { - _Internal::set_has_java_generic_services(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &java_generic_services_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool py_generic_services = 18 [default = false]; - case 18: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (144 & 0xFF)) { - _Internal::set_has_py_generic_services(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &py_generic_services_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - case 20: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (160 & 0xFF)) { - _Internal::set_has_java_generate_equals_and_hash(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &java_generate_equals_and_hash_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool deprecated = 23 [default = false]; - case 23: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (184 & 0xFF)) { - _Internal::set_has_deprecated(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &deprecated_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool java_string_check_utf8 = 27 [default = false]; - case 27: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (216 & 0xFF)) { - _Internal::set_has_java_string_check_utf8(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &java_string_check_utf8_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool cc_enable_arenas = 31 [default = false]; - case 31: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (248 & 0xFF)) { - _Internal::set_has_cc_enable_arenas(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &cc_enable_arenas_))); - } else { - goto handle_unusual; - } - break; - } - - // optional string objc_class_prefix = 36; - case 36: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (290 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_objc_class_prefix())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_objc_class_prefix().data(), static_cast(this->_internal_objc_class_prefix().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.objc_class_prefix"); - } else { - goto handle_unusual; - } - break; - } - - // optional string csharp_namespace = 37; - case 37: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (298 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_csharp_namespace())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_csharp_namespace().data(), static_cast(this->_internal_csharp_namespace().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.csharp_namespace"); - } else { - goto handle_unusual; - } - break; - } - - // optional string swift_prefix = 39; - case 39: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (314 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_swift_prefix())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_swift_prefix().data(), static_cast(this->_internal_swift_prefix().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.swift_prefix"); - } else { - goto handle_unusual; - } - break; - } - - // optional string php_class_prefix = 40; - case 40: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (322 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_php_class_prefix())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_php_class_prefix().data(), static_cast(this->_internal_php_class_prefix().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.php_class_prefix"); - } else { - goto handle_unusual; - } - break; - } - - // optional string php_namespace = 41; - case 41: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (330 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_php_namespace())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_php_namespace().data(), static_cast(this->_internal_php_namespace().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.php_namespace"); - } else { - goto handle_unusual; - } - break; - } - - // optional bool php_generic_services = 42 [default = false]; - case 42: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (336 & 0xFF)) { - _Internal::set_has_php_generic_services(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &php_generic_services_))); - } else { - goto handle_unusual; - } - break; - } - - // optional string php_metadata_namespace = 44; - case 44: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (354 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_php_metadata_namespace())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_php_metadata_namespace().data(), static_cast(this->_internal_php_metadata_namespace().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.php_metadata_namespace"); - } else { - goto handle_unusual; - } - break; - } - - // optional string ruby_package = 45; - case 45: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (362 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_ruby_package())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_ruby_package().data(), static_cast(this->_internal_ruby_package().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.FileOptions.ruby_package"); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.FileOptions) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.FileOptions) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* FileOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -8324,13 +6777,13 @@ failure: if (cached_has_bits & 0x00080000u) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 9, this->optimize_for(), target); + 9, this->_internal_optimize_for(), target); } // optional bool java_multiple_files = 10 [default = false]; if (cached_has_bits & 0x00000400u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(10, this->java_multiple_files(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(10, this->_internal_java_multiple_files(), target); } // optional string go_package = 11; @@ -8346,43 +6799,43 @@ failure: // optional bool cc_generic_services = 16 [default = false]; if (cached_has_bits & 0x00002000u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(16, this->cc_generic_services(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(16, this->_internal_cc_generic_services(), target); } // optional bool java_generic_services = 17 [default = false]; if (cached_has_bits & 0x00004000u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(17, this->java_generic_services(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(17, this->_internal_java_generic_services(), target); } // optional bool py_generic_services = 18 [default = false]; if (cached_has_bits & 0x00008000u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(18, this->py_generic_services(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(18, this->_internal_py_generic_services(), target); } // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; if (cached_has_bits & 0x00000800u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(20, this->java_generate_equals_and_hash(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(20, this->_internal_java_generate_equals_and_hash(), target); } // optional bool deprecated = 23 [default = false]; if (cached_has_bits & 0x00020000u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(23, this->deprecated(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(23, this->_internal_deprecated(), target); } // optional bool java_string_check_utf8 = 27 [default = false]; if (cached_has_bits & 0x00001000u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(27, this->java_string_check_utf8(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(27, this->_internal_java_string_check_utf8(), target); } // optional bool cc_enable_arenas = 31 [default = false]; if (cached_has_bits & 0x00040000u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(31, this->cc_enable_arenas(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(31, this->_internal_cc_enable_arenas(), target); } // optional string objc_class_prefix = 36; @@ -8438,7 +6891,7 @@ failure: // optional bool php_generic_services = 42 [default = false]; if (cached_has_bits & 0x00010000u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(42, this->php_generic_services(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(42, this->_internal_php_generic_services(), target); } // optional string php_metadata_namespace = 44; @@ -8462,11 +6915,11 @@ failure: } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -8492,7 +6945,7 @@ size_t FileOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -8622,7 +7075,7 @@ size_t FileOptions::ByteSizeLong() const { // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; if (cached_has_bits & 0x00080000u) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->optimize_for()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_optimize_for()); } } @@ -8890,7 +7343,6 @@ void MessageOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -8938,7 +7390,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -8970,106 +7422,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool MessageOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.MessageOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional bool message_set_wire_format = 1 [default = false]; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - _Internal::set_has_message_set_wire_format(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &message_set_wire_format_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool no_standard_descriptor_accessor = 2 [default = false]; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_no_standard_descriptor_accessor(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &no_standard_descriptor_accessor_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool deprecated = 3 [default = false]; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { - _Internal::set_has_deprecated(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &deprecated_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool map_entry = 7; - case 7: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (56 & 0xFF)) { - _Internal::set_has_map_entry(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &map_entry_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.MessageOptions) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.MessageOptions) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* MessageOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -9081,33 +7433,33 @@ failure: // optional bool message_set_wire_format = 1 [default = false]; if (cached_has_bits & 0x00000001u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->message_set_wire_format(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_message_set_wire_format(), target); } // optional bool no_standard_descriptor_accessor = 2 [default = false]; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->no_standard_descriptor_accessor(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_no_standard_descriptor_accessor(), target); } // optional bool deprecated = 3 [default = false]; if (cached_has_bits & 0x00000004u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->deprecated(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_deprecated(), target); } // optional bool map_entry = 7; if (cached_has_bits & 0x00000008u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(7, this->map_entry(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(7, this->_internal_map_entry(), target); } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -9133,7 +7485,7 @@ size_t MessageOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -9356,7 +7708,6 @@ void FieldOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -9372,7 +7723,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(val))) { - set_ctype(static_cast(val)); + _internal_set_ctype(static_cast(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); } @@ -9408,7 +7759,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(val))) { - set_jstype(static_cast(val)); + _internal_set_jstype(static_cast(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(6, val, mutable_unknown_fields()); } @@ -9428,7 +7779,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -9454,150 +7805,12 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I } // while success: _has_bits_.Or(has_bits); - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool FieldOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.FieldOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(value)) { - set_ctype(static_cast< PROTOBUF_NAMESPACE_ID::FieldOptions_CType >(value)); - } else { - mutable_unknown_fields()->AddVarint( - 1, static_cast<::PROTOBUF_NAMESPACE_ID::uint64>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // optional bool packed = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_packed(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &packed_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool deprecated = 3 [default = false]; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { - _Internal::set_has_deprecated(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &deprecated_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool lazy = 5 [default = false]; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (40 & 0xFF)) { - _Internal::set_has_lazy(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &lazy_))); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (48 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(value)) { - set_jstype(static_cast< PROTOBUF_NAMESPACE_ID::FieldOptions_JSType >(value)); - } else { - mutable_unknown_fields()->AddVarint( - 6, static_cast<::PROTOBUF_NAMESPACE_ID::uint64>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // optional bool weak = 10 [default = false]; - case 10: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (80 & 0xFF)) { - _Internal::set_has_weak(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &weak_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.FieldOptions) - return true; + return ptr; failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.FieldOptions) - return false; -#undef DO_ + ptr = nullptr; + goto success; +#undef CHK_ } -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* FieldOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -9610,46 +7823,46 @@ failure: if (cached_has_bits & 0x00000001u) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 1, this->ctype(), target); + 1, this->_internal_ctype(), target); } // optional bool packed = 2; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->packed(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_packed(), target); } // optional bool deprecated = 3 [default = false]; if (cached_has_bits & 0x00000008u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->deprecated(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_deprecated(), target); } // optional bool lazy = 5 [default = false]; if (cached_has_bits & 0x00000004u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->lazy(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_lazy(), target); } // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; if (cached_has_bits & 0x00000020u) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 6, this->jstype(), target); + 6, this->_internal_jstype(), target); } // optional bool weak = 10 [default = false]; if (cached_has_bits & 0x00000010u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(10, this->weak(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(10, this->_internal_weak(), target); } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -9675,7 +7888,7 @@ size_t FieldOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -9686,7 +7899,7 @@ size_t FieldOptions::ByteSizeLong() const { // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; if (cached_has_bits & 0x00000001u) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->ctype()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_ctype()); } // optional bool packed = 2; @@ -9712,7 +7925,7 @@ size_t FieldOptions::ByteSizeLong() const { // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; if (cached_has_bits & 0x00000020u) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->jstype()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_jstype()); } } @@ -9888,7 +8101,6 @@ void OneofOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* OneofOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -9903,7 +8115,7 @@ const char* OneofOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -9934,54 +8146,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool OneofOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.OneofOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.OneofOptions) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.OneofOptions) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* OneofOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -9990,11 +8154,11 @@ failure: (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -10020,7 +8184,7 @@ size_t OneofOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -10185,7 +8349,6 @@ void EnumOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -10217,7 +8380,7 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -10249,80 +8412,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool EnumOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.EnumOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional bool allow_alias = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_allow_alias(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &allow_alias_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool deprecated = 3 [default = false]; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { - _Internal::set_has_deprecated(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &deprecated_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.EnumOptions) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.EnumOptions) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* EnumOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -10334,21 +8423,21 @@ failure: // optional bool allow_alias = 2; if (cached_has_bits & 0x00000001u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->allow_alias(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_allow_alias(), target); } // optional bool deprecated = 3 [default = false]; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->deprecated(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_deprecated(), target); } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -10374,7 +8463,7 @@ size_t EnumOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -10555,7 +8644,6 @@ void EnumValueOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -10579,7 +8667,7 @@ const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -10611,67 +8699,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool EnumValueOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.EnumValueOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional bool deprecated = 1 [default = false]; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - _Internal::set_has_deprecated(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &deprecated_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.EnumValueOptions) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.EnumValueOptions) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* EnumValueOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -10683,15 +8710,15 @@ failure: // optional bool deprecated = 1 [default = false]; if (cached_has_bits & 0x00000001u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->deprecated(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_deprecated(), target); } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -10717,7 +8744,7 @@ size_t EnumValueOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -10762,8 +8789,8 @@ void EnumValueOptions::MergeFrom(const EnumValueOptions& from) { (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); - if (from.has_deprecated()) { - set_deprecated(from.deprecated()); + if (from._internal_has_deprecated()) { + _internal_set_deprecated(from._internal_deprecated()); } } @@ -10883,7 +8910,6 @@ void ServiceOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -10907,7 +8933,7 @@ const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -10939,67 +8965,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool ServiceOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.ServiceOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional bool deprecated = 33 [default = false]; - case 33: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (264 & 0xFF)) { - _Internal::set_has_deprecated(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &deprecated_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.ServiceOptions) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.ServiceOptions) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* ServiceOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -11011,15 +8976,15 @@ failure: // optional bool deprecated = 33 [default = false]; if (cached_has_bits & 0x00000001u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(33, this->deprecated(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(33, this->_internal_deprecated(), target); } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -11045,7 +9010,7 @@ size_t ServiceOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -11090,8 +9055,8 @@ void ServiceOptions::MergeFrom(const ServiceOptions& from) { (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); - if (from.has_deprecated()) { - set_deprecated(from.deprecated()); + if (from._internal_has_deprecated()) { + _internal_set_deprecated(from._internal_deprecated()); } } @@ -11223,7 +9188,6 @@ void MethodOptions::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -11247,7 +9211,7 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(val))) { - set_idempotency_level(static_cast(val)); + _internal_set_idempotency_level(static_cast(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(34, val, mutable_unknown_fields()); } @@ -11259,7 +9223,7 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ ptr -= 2; do { ptr += 2; - ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr); + ptr = ctx->ParseMessage(_internal_add_uninterpreted_option(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); @@ -11291,86 +9255,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool MethodOptions::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.MethodOptions) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional bool deprecated = 33 [default = false]; - case 33: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (264 & 0xFF)) { - _Internal::set_has_deprecated(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &deprecated_))); - } else { - goto handle_unusual; - } - break; - } - - // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; - case 34: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (272 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(value)) { - set_idempotency_level(static_cast< PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel >(value)); - } else { - mutable_unknown_fields()->AddVarint( - 34, static_cast<::PROTOBUF_NAMESPACE_ID::uint64>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - case 999: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (7994 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_uninterpreted_option())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - if ((8000u <= tag)) { - DO_(_extensions_.ParseField(tag, input, - internal_default_instance(), - _internal_metadata_.mutable_unknown_fields())); - continue; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.MethodOptions) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.MethodOptions) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* MethodOptions::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -11382,22 +9266,22 @@ failure: // optional bool deprecated = 33 [default = false]; if (cached_has_bits & 0x00000001u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(33, this->deprecated(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(33, this->_internal_deprecated(), target); } // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 34, this->idempotency_level(), target); + 34, this->_internal_idempotency_level(), target); } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (auto it = this->uninterpreted_option_.pointer_begin(), - end = this->uninterpreted_option_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(999, **it, target, stream); + InternalWriteMessageToArray(999, this->_internal_uninterpreted_option(i), target, stream); } // Extension range [1000, 536870912) @@ -11423,7 +9307,7 @@ size_t MethodOptions::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - total_size += 2UL * this->uninterpreted_option_size(); + total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->uninterpreted_option_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -11439,7 +9323,7 @@ size_t MethodOptions::ByteSizeLong() const { // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; if (cached_has_bits & 0x00000002u) { total_size += 2 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->idempotency_level()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_idempotency_level()); } } @@ -11613,7 +9497,6 @@ void UninterpretedOption_NamePart::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* UninterpretedOption_NamePart::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -11658,65 +9541,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool UninterpretedOption_NamePart::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.UninterpretedOption.NamePart) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string name_part = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name_part())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name_part().data(), static_cast(this->_internal_name_part().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.UninterpretedOption.NamePart.name_part"); - } else { - goto handle_unusual; - } - break; - } - - // required bool is_extension = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - _Internal::set_has_is_extension(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &is_extension_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.UninterpretedOption.NamePart) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.UninterpretedOption.NamePart) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* UninterpretedOption_NamePart::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -11738,7 +9562,7 @@ failure: // required bool is_extension = 2; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->is_extension(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_is_extension(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -11995,7 +9819,6 @@ void UninterpretedOption::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -12011,7 +9834,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_name(), ptr); + ptr = ctx->ParseMessage(_internal_add_name(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); @@ -12082,128 +9905,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool UninterpretedOption::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.UninterpretedOption) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_name())); - } else { - goto handle_unusual; - } - break; - } - - // optional string identifier_value = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_identifier_value())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_identifier_value().data(), static_cast(this->_internal_identifier_value().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.UninterpretedOption.identifier_value"); - } else { - goto handle_unusual; - } - break; - } - - // optional uint64 positive_int_value = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (32 & 0xFF)) { - _Internal::set_has_positive_int_value(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::uint64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_UINT64>( - input, &positive_int_value_))); - } else { - goto handle_unusual; - } - break; - } - - // optional int64 negative_int_value = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (40 & 0xFF)) { - _Internal::set_has_negative_int_value(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( - input, &negative_int_value_))); - } else { - goto handle_unusual; - } - break; - } - - // optional double double_value = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (49 & 0xFF)) { - _Internal::set_has_double_value(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - double, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_DOUBLE>( - input, &double_value_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bytes string_value = 7; - case 7: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (58 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadBytes( - input, this->_internal_mutable_string_value())); - } else { - goto handle_unusual; - } - break; - } - - // optional string aggregate_value = 8; - case 8: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (66 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_aggregate_value())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_aggregate_value().data(), static_cast(this->_internal_aggregate_value().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.UninterpretedOption.aggregate_value"); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.UninterpretedOption) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.UninterpretedOption) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* UninterpretedOption::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -12212,11 +9913,11 @@ failure: (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - for (auto it = this->name_.pointer_begin(), - end = this->name_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_name_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(2, **it, target, stream); + InternalWriteMessageToArray(2, this->_internal_name(i), target, stream); } cached_has_bits = _has_bits_[0]; @@ -12233,19 +9934,19 @@ failure: // optional uint64 positive_int_value = 4; if (cached_has_bits & 0x00000008u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(4, this->positive_int_value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(4, this->_internal_positive_int_value(), target); } // optional int64 negative_int_value = 5; if (cached_has_bits & 0x00000010u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->negative_int_value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->_internal_negative_int_value(), target); } // optional double double_value = 6; if (cached_has_bits & 0x00000020u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(6, this->double_value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(6, this->_internal_double_value(), target); } // optional bytes string_value = 7; @@ -12281,7 +9982,7 @@ size_t UninterpretedOption::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - total_size += 1UL * this->name_size(); + total_size += 1UL * this->_internal_name_size(); for (const auto& msg : this->name_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -12314,14 +10015,14 @@ size_t UninterpretedOption::ByteSizeLong() const { if (cached_has_bits & 0x00000008u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( - this->positive_int_value()); + this->_internal_positive_int_value()); } // optional int64 negative_int_value = 5; if (cached_has_bits & 0x00000010u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->negative_int_value()); + this->_internal_negative_int_value()); } // optional double double_value = 6; @@ -12531,7 +10232,6 @@ void SourceCodeInfo_Location::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -12544,20 +10244,20 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ // repeated int32 path = 1 [packed = true]; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(mutable_path(), ptr, ctx); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_path(), ptr, ctx); CHK_(ptr); } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) { - add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); + _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); CHK_(ptr); } else goto handle_unusual; continue; // repeated int32 span = 2 [packed = true]; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { - ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(mutable_span(), ptr, ctx); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_span(), ptr, ctx); CHK_(ptr); } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) { - add_span(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); + _internal_add_span(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); CHK_(ptr); } else goto handle_unusual; continue; @@ -12607,115 +10307,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool SourceCodeInfo_Location::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.SourceCodeInfo.Location) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated int32 path = 1 [packed = true]; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPackedPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_path()))); - } else if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - 1, 10u, input, this->mutable_path()))); - } else { - goto handle_unusual; - } - break; - } - - // repeated int32 span = 2 [packed = true]; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPackedPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_span()))); - } else if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - 1, 18u, input, this->mutable_span()))); - } else { - goto handle_unusual; - } - break; - } - - // optional string leading_comments = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_leading_comments())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_leading_comments().data(), static_cast(this->_internal_leading_comments().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.SourceCodeInfo.Location.leading_comments"); - } else { - goto handle_unusual; - } - break; - } - - // optional string trailing_comments = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_trailing_comments())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_trailing_comments().data(), static_cast(this->_internal_trailing_comments().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.SourceCodeInfo.Location.trailing_comments"); - } else { - goto handle_unusual; - } - break; - } - - // repeated string leading_detached_comments = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_add_leading_detached_comments())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - leading_detached_comments_.Get(leading_detached_comments_.size() - 1).data(), - static_cast(leading_detached_comments_.Get(leading_detached_comments_.size() - 1).length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.SourceCodeInfo.Location) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.SourceCodeInfo.Location) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* SourceCodeInfo_Location::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -12728,7 +10319,7 @@ failure: int byte_size = _path_cached_byte_size_.load(std::memory_order_relaxed); if (byte_size > 0) { target = stream->WriteInt32Packed( - 1, path_, byte_size, target); + 1, _internal_path(), byte_size, target); } } @@ -12737,7 +10328,7 @@ failure: int byte_size = _span_cached_byte_size_.load(std::memory_order_relaxed); if (byte_size > 0) { target = stream->WriteInt32Packed( - 2, span_, byte_size, target); + 2, _internal_span(), byte_size, target); } } @@ -12763,9 +10354,8 @@ failure: } // repeated string leading_detached_comments = 6; - for (auto it = leading_detached_comments_.pointer_begin(), - end = leading_detached_comments_.pointer_end(); it < end; ++it) { - const auto& s = **it; + for (int i = 0, n = this->_internal_leading_detached_comments_size(); i < n; i++) { + const auto& s = this->_internal_leading_detached_comments(i); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( s.data(), static_cast(s.length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, @@ -12995,7 +10585,6 @@ void SourceCodeInfo::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* SourceCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -13010,7 +10599,7 @@ const char* SourceCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_location(), ptr); + ptr = ctx->ParseMessage(_internal_add_location(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); @@ -13035,48 +10624,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool SourceCodeInfo::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.SourceCodeInfo) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .google.protobuf.SourceCodeInfo.Location location = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_location())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.SourceCodeInfo) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.SourceCodeInfo) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* SourceCodeInfo::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -13085,11 +10632,11 @@ failure: (void) cached_has_bits; // repeated .google.protobuf.SourceCodeInfo.Location location = 1; - for (auto it = this->location_.pointer_begin(), - end = this->location_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_location_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(1, **it, target, stream); + InternalWriteMessageToArray(1, this->_internal_location(i), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -13109,7 +10656,7 @@ size_t SourceCodeInfo::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.SourceCodeInfo.Location location = 1; - total_size += 1UL * this->location_size(); + total_size += 1UL * this->_internal_location_size(); for (const auto& msg : this->location_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -13280,7 +10827,6 @@ void GeneratedCodeInfo_Annotation::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* GeneratedCodeInfo_Annotation::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; @@ -13293,10 +10839,10 @@ const char* GeneratedCodeInfo_Annotation::_InternalParse(const char* ptr, ::PROT // repeated int32 path = 1 [packed = true]; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(mutable_path(), ptr, ctx); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_path(), ptr, ctx); CHK_(ptr); } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) { - add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); + _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); CHK_(ptr); } else goto handle_unusual; continue; @@ -13343,94 +10889,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo.Annotation) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated int32 path = 1 [packed = true]; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPackedPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_path()))); - } else if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - 1, 10u, input, this->mutable_path()))); - } else { - goto handle_unusual; - } - break; - } - - // optional string source_file = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_source_file())); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_source_file().data(), static_cast(this->_internal_source_file().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, - "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 begin = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { - _Internal::set_has_begin(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &begin_))); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 end = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (32 & 0xFF)) { - _Internal::set_has_end(&_has_bits_); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &end_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.GeneratedCodeInfo.Annotation) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.GeneratedCodeInfo.Annotation) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* GeneratedCodeInfo_Annotation::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -13443,7 +10901,7 @@ failure: int byte_size = _path_cached_byte_size_.load(std::memory_order_relaxed); if (byte_size > 0) { target = stream->WriteInt32Packed( - 1, path_, byte_size, target); + 1, _internal_path(), byte_size, target); } } @@ -13461,13 +10919,13 @@ failure: // optional int32 begin = 3; if (cached_has_bits & 0x00000002u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->begin(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_begin(), target); } // optional int32 end = 4; if (cached_has_bits & 0x00000004u) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->end(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_end(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -13514,14 +10972,14 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { if (cached_has_bits & 0x00000002u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->begin()); + this->_internal_begin()); } // optional int32 end = 4; if (cached_has_bits & 0x00000004u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->end()); + this->_internal_end()); } } @@ -13676,7 +11134,6 @@ void GeneratedCodeInfo::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* GeneratedCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -13691,7 +11148,7 @@ const char* GeneratedCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESP ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_annotation(), ptr); + ptr = ctx->ParseMessage(_internal_add_annotation(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); @@ -13716,48 +11173,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool GeneratedCodeInfo::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_annotation())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.GeneratedCodeInfo) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.GeneratedCodeInfo) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* GeneratedCodeInfo::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -13766,11 +11181,11 @@ failure: (void) cached_has_bits; // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - for (auto it = this->annotation_.pointer_begin(), - end = this->annotation_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_annotation_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(1, **it, target, stream); + InternalWriteMessageToArray(1, this->_internal_annotation(i), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -13790,7 +11205,7 @@ size_t GeneratedCodeInfo::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - total_size += 1UL * this->annotation_size(); + total_size += 1UL * this->_internal_annotation_size(); for (const auto& msg : this->annotation_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 8fc6861f31..8776c68e9a 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -421,12 +421,7 @@ class PROTOBUF_EXPORT FileDescriptorSet : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -472,10 +467,17 @@ class PROTOBUF_EXPORT FileDescriptorSet : }; // repeated .google.protobuf.FileDescriptorProto file = 1; int file_size() const; + private: + int _internal_file_size() const; + public: void clear_file(); PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_file(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* mutable_file(); + private: + const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_file(int index) const; + PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_file(); + public: const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& file(int index) const; PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_file(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& @@ -587,12 +589,7 @@ class PROTOBUF_EXPORT FileDescriptorProto : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -649,6 +646,9 @@ class PROTOBUF_EXPORT FileDescriptorProto : }; // repeated string dependency = 3; int dependency_size() const; + private: + int _internal_dependency_size() const; + public: void clear_dependency(); const std::string& dependency(int index) const; std::string* mutable_dependency(int index); @@ -664,15 +664,23 @@ class PROTOBUF_EXPORT FileDescriptorProto : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& dependency() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_dependency(); private: + const std::string& _internal_dependency(int index) const; std::string* _internal_add_dependency(); public: // repeated .google.protobuf.DescriptorProto message_type = 4; int message_type_size() const; + private: + int _internal_message_type_size() const; + public: void clear_message_type(); PROTOBUF_NAMESPACE_ID::DescriptorProto* mutable_message_type(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >* mutable_message_type(); + private: + const PROTOBUF_NAMESPACE_ID::DescriptorProto& _internal_message_type(int index) const; + PROTOBUF_NAMESPACE_ID::DescriptorProto* _internal_add_message_type(); + public: const PROTOBUF_NAMESPACE_ID::DescriptorProto& message_type(int index) const; PROTOBUF_NAMESPACE_ID::DescriptorProto* add_message_type(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >& @@ -680,10 +688,17 @@ class PROTOBUF_EXPORT FileDescriptorProto : // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; int enum_type_size() const; + private: + int _internal_enum_type_size() const; + public: void clear_enum_type(); PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* mutable_enum_type(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* mutable_enum_type(); + private: + const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& _internal_enum_type(int index) const; + PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _internal_add_enum_type(); + public: const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& enum_type(int index) const; PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* add_enum_type(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& @@ -691,10 +706,17 @@ class PROTOBUF_EXPORT FileDescriptorProto : // repeated .google.protobuf.ServiceDescriptorProto service = 6; int service_size() const; + private: + int _internal_service_size() const; + public: void clear_service(); PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* mutable_service(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >* mutable_service(); + private: + const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& _internal_service(int index) const; + PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* _internal_add_service(); + public: const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& service(int index) const; PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* add_service(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >& @@ -702,10 +724,17 @@ class PROTOBUF_EXPORT FileDescriptorProto : // repeated .google.protobuf.FieldDescriptorProto extension = 7; int extension_size() const; + private: + int _internal_extension_size() const; + public: void clear_extension(); PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_extension(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* mutable_extension(); + private: + const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_extension(int index) const; + PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_extension(); + public: const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& extension(int index) const; PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_extension(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& @@ -713,7 +742,18 @@ class PROTOBUF_EXPORT FileDescriptorProto : // repeated int32 public_dependency = 10; int public_dependency_size() const; + private: + int _internal_public_dependency_size() const; + public: void clear_public_dependency(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_public_dependency(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_public_dependency() const; + void _internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_public_dependency(); + public: ::PROTOBUF_NAMESPACE_ID::int32 public_dependency(int index) const; void set_public_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); void add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value); @@ -724,7 +764,18 @@ class PROTOBUF_EXPORT FileDescriptorProto : // repeated int32 weak_dependency = 11; int weak_dependency_size() const; + private: + int _internal_weak_dependency_size() const; + public: void clear_weak_dependency(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_weak_dependency(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_weak_dependency() const; + void _internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_weak_dependency(); + public: ::PROTOBUF_NAMESPACE_ID::int32 weak_dependency(int index) const; void set_weak_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); void add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value); @@ -830,6 +881,10 @@ class PROTOBUF_EXPORT FileDescriptorProto : PROTOBUF_NAMESPACE_ID::FileOptions* release_options(); PROTOBUF_NAMESPACE_ID::FileOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::FileOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::FileOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::FileOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::FileOptions* options); PROTOBUF_NAMESPACE_ID::FileOptions* unsafe_arena_release_options(); @@ -844,6 +899,10 @@ class PROTOBUF_EXPORT FileDescriptorProto : PROTOBUF_NAMESPACE_ID::SourceCodeInfo* release_source_code_info(); PROTOBUF_NAMESPACE_ID::SourceCodeInfo* mutable_source_code_info(); void set_allocated_source_code_info(PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info); + private: + const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& _internal_source_code_info() const; + PROTOBUF_NAMESPACE_ID::SourceCodeInfo* _internal_mutable_source_code_info(); + public: void unsafe_arena_set_allocated_source_code_info( PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info); PROTOBUF_NAMESPACE_ID::SourceCodeInfo* unsafe_arena_release_source_code_info(); @@ -965,12 +1024,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1026,6 +1080,10 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange : PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options(); PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options); PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* unsafe_arena_release_options(); @@ -1038,6 +1096,10 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange : void clear_start(); ::PROTOBUF_NAMESPACE_ID::int32 start() const; void set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const; + void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // optional int32 end = 2; bool has_end() const; @@ -1047,6 +1109,10 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange : void clear_end(); ::PROTOBUF_NAMESPACE_ID::int32 end() const; void set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const; + void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ExtensionRange) private: @@ -1156,12 +1222,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1214,6 +1275,10 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange : void clear_start(); ::PROTOBUF_NAMESPACE_ID::int32 start() const; void set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const; + void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // optional int32 end = 2; bool has_end() const; @@ -1223,6 +1288,10 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange : void clear_end(); ::PROTOBUF_NAMESPACE_ID::int32 end() const; void set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const; + void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ReservedRange) private: @@ -1331,12 +1400,7 @@ class PROTOBUF_EXPORT DescriptorProto : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1394,10 +1458,17 @@ class PROTOBUF_EXPORT DescriptorProto : }; // repeated .google.protobuf.FieldDescriptorProto field = 2; int field_size() const; + private: + int _internal_field_size() const; + public: void clear_field(); PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_field(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* mutable_field(); + private: + const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_field(int index) const; + PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_field(); + public: const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& field(int index) const; PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_field(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& @@ -1405,10 +1476,17 @@ class PROTOBUF_EXPORT DescriptorProto : // repeated .google.protobuf.DescriptorProto nested_type = 3; int nested_type_size() const; + private: + int _internal_nested_type_size() const; + public: void clear_nested_type(); PROTOBUF_NAMESPACE_ID::DescriptorProto* mutable_nested_type(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >* mutable_nested_type(); + private: + const PROTOBUF_NAMESPACE_ID::DescriptorProto& _internal_nested_type(int index) const; + PROTOBUF_NAMESPACE_ID::DescriptorProto* _internal_add_nested_type(); + public: const PROTOBUF_NAMESPACE_ID::DescriptorProto& nested_type(int index) const; PROTOBUF_NAMESPACE_ID::DescriptorProto* add_nested_type(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >& @@ -1416,10 +1494,17 @@ class PROTOBUF_EXPORT DescriptorProto : // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; int enum_type_size() const; + private: + int _internal_enum_type_size() const; + public: void clear_enum_type(); PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* mutable_enum_type(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* mutable_enum_type(); + private: + const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& _internal_enum_type(int index) const; + PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _internal_add_enum_type(); + public: const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& enum_type(int index) const; PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* add_enum_type(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& @@ -1427,10 +1512,17 @@ class PROTOBUF_EXPORT DescriptorProto : // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; int extension_range_size() const; + private: + int _internal_extension_range_size() const; + public: void clear_extension_range(); PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* mutable_extension_range(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >* mutable_extension_range(); + private: + const PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& _internal_extension_range(int index) const; + PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* _internal_add_extension_range(); + public: const PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& extension_range(int index) const; PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* add_extension_range(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >& @@ -1438,10 +1530,17 @@ class PROTOBUF_EXPORT DescriptorProto : // repeated .google.protobuf.FieldDescriptorProto extension = 6; int extension_size() const; + private: + int _internal_extension_size() const; + public: void clear_extension(); PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_extension(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* mutable_extension(); + private: + const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_extension(int index) const; + PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_extension(); + public: const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& extension(int index) const; PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_extension(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& @@ -1449,10 +1548,17 @@ class PROTOBUF_EXPORT DescriptorProto : // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; int oneof_decl_size() const; + private: + int _internal_oneof_decl_size() const; + public: void clear_oneof_decl(); PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* mutable_oneof_decl(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >* mutable_oneof_decl(); + private: + const PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& _internal_oneof_decl(int index) const; + PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* _internal_add_oneof_decl(); + public: const PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& oneof_decl(int index) const; PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* add_oneof_decl(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >& @@ -1460,10 +1566,17 @@ class PROTOBUF_EXPORT DescriptorProto : // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; int reserved_range_size() const; + private: + int _internal_reserved_range_size() const; + public: void clear_reserved_range(); PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* mutable_reserved_range(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >* mutable_reserved_range(); + private: + const PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& _internal_reserved_range(int index) const; + PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* _internal_add_reserved_range(); + public: const PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& reserved_range(int index) const; PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* add_reserved_range(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >& @@ -1471,6 +1584,9 @@ class PROTOBUF_EXPORT DescriptorProto : // repeated string reserved_name = 10; int reserved_name_size() const; + private: + int _internal_reserved_name_size() const; + public: void clear_reserved_name(); const std::string& reserved_name(int index) const; std::string* mutable_reserved_name(int index); @@ -1486,6 +1602,7 @@ class PROTOBUF_EXPORT DescriptorProto : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& reserved_name() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_reserved_name(); private: + const std::string& _internal_reserved_name(int index) const; std::string* _internal_add_reserved_name(); public: @@ -1528,6 +1645,10 @@ class PROTOBUF_EXPORT DescriptorProto : PROTOBUF_NAMESPACE_ID::MessageOptions* release_options(); PROTOBUF_NAMESPACE_ID::MessageOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::MessageOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::MessageOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::MessageOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::MessageOptions* options); PROTOBUF_NAMESPACE_ID::MessageOptions* unsafe_arena_release_options(); @@ -1647,12 +1768,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1698,10 +1814,17 @@ class PROTOBUF_EXPORT ExtensionRangeOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -1816,12 +1939,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -2123,6 +2241,10 @@ class PROTOBUF_EXPORT FieldDescriptorProto : PROTOBUF_NAMESPACE_ID::FieldOptions* release_options(); PROTOBUF_NAMESPACE_ID::FieldOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::FieldOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::FieldOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::FieldOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::FieldOptions* options); PROTOBUF_NAMESPACE_ID::FieldOptions* unsafe_arena_release_options(); @@ -2135,6 +2257,10 @@ class PROTOBUF_EXPORT FieldDescriptorProto : void clear_number(); ::PROTOBUF_NAMESPACE_ID::int32 number() const; void set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const; + void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // optional int32 oneof_index = 9; bool has_oneof_index() const; @@ -2144,6 +2270,10 @@ class PROTOBUF_EXPORT FieldDescriptorProto : void clear_oneof_index(); ::PROTOBUF_NAMESPACE_ID::int32 oneof_index() const; void set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_oneof_index() const; + void _internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // optional .google.protobuf.FieldDescriptorProto.Label label = 4; bool has_label() const; @@ -2153,6 +2283,10 @@ class PROTOBUF_EXPORT FieldDescriptorProto : void clear_label(); PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label label() const; void set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value); + private: + PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label _internal_label() const; + void _internal_set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value); + public: // optional .google.protobuf.FieldDescriptorProto.Type type = 5; bool has_type() const; @@ -2162,6 +2296,10 @@ class PROTOBUF_EXPORT FieldDescriptorProto : void clear_type(); PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type type() const; void set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value); + private: + PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type _internal_type() const; + void _internal_set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.FieldDescriptorProto) private: @@ -2278,12 +2416,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -2367,6 +2500,10 @@ class PROTOBUF_EXPORT OneofDescriptorProto : PROTOBUF_NAMESPACE_ID::OneofOptions* release_options(); PROTOBUF_NAMESPACE_ID::OneofOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::OneofOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::OneofOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::OneofOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::OneofOptions* options); PROTOBUF_NAMESPACE_ID::OneofOptions* unsafe_arena_release_options(); @@ -2478,12 +2615,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -2536,6 +2668,10 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange : void clear_start(); ::PROTOBUF_NAMESPACE_ID::int32 start() const; void set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const; + void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // optional int32 end = 2; bool has_end() const; @@ -2545,6 +2681,10 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange : void clear_end(); ::PROTOBUF_NAMESPACE_ID::int32 end() const; void set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const; + void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto.EnumReservedRange) private: @@ -2653,12 +2793,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -2710,10 +2845,17 @@ class PROTOBUF_EXPORT EnumDescriptorProto : }; // repeated .google.protobuf.EnumValueDescriptorProto value = 2; int value_size() const; + private: + int _internal_value_size() const; + public: void clear_value(); PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* mutable_value(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >* mutable_value(); + private: + const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& _internal_value(int index) const; + PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* _internal_add_value(); + public: const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& value(int index) const; PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* add_value(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >& @@ -2721,10 +2863,17 @@ class PROTOBUF_EXPORT EnumDescriptorProto : // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; int reserved_range_size() const; + private: + int _internal_reserved_range_size() const; + public: void clear_reserved_range(); PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* mutable_reserved_range(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >* mutable_reserved_range(); + private: + const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& _internal_reserved_range(int index) const; + PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* _internal_add_reserved_range(); + public: const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& reserved_range(int index) const; PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* add_reserved_range(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >& @@ -2732,6 +2881,9 @@ class PROTOBUF_EXPORT EnumDescriptorProto : // repeated string reserved_name = 5; int reserved_name_size() const; + private: + int _internal_reserved_name_size() const; + public: void clear_reserved_name(); const std::string& reserved_name(int index) const; std::string* mutable_reserved_name(int index); @@ -2747,6 +2899,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& reserved_name() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_reserved_name(); private: + const std::string& _internal_reserved_name(int index) const; std::string* _internal_add_reserved_name(); public: @@ -2789,6 +2942,10 @@ class PROTOBUF_EXPORT EnumDescriptorProto : PROTOBUF_NAMESPACE_ID::EnumOptions* release_options(); PROTOBUF_NAMESPACE_ID::EnumOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::EnumOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::EnumOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::EnumOptions* options); PROTOBUF_NAMESPACE_ID::EnumOptions* unsafe_arena_release_options(); @@ -2903,12 +3060,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -2993,6 +3145,10 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto : PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options(); PROTOBUF_NAMESPACE_ID::EnumValueOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumValueOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::EnumValueOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::EnumValueOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::EnumValueOptions* options); PROTOBUF_NAMESPACE_ID::EnumValueOptions* unsafe_arena_release_options(); @@ -3005,6 +3161,10 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto : void clear_number(); ::PROTOBUF_NAMESPACE_ID::int32 number() const; void set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const; + void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.EnumValueDescriptorProto) private: @@ -3114,12 +3274,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -3167,10 +3322,17 @@ class PROTOBUF_EXPORT ServiceDescriptorProto : }; // repeated .google.protobuf.MethodDescriptorProto method = 2; int method_size() const; + private: + int _internal_method_size() const; + public: void clear_method(); PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* mutable_method(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >* mutable_method(); + private: + const PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& _internal_method(int index) const; + PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* _internal_add_method(); + public: const PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& method(int index) const; PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* add_method(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >& @@ -3215,6 +3377,10 @@ class PROTOBUF_EXPORT ServiceDescriptorProto : PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options(); PROTOBUF_NAMESPACE_ID::ServiceOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::ServiceOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::ServiceOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::ServiceOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::ServiceOptions* options); PROTOBUF_NAMESPACE_ID::ServiceOptions* unsafe_arena_release_options(); @@ -3327,12 +3493,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -3478,6 +3639,10 @@ class PROTOBUF_EXPORT MethodDescriptorProto : PROTOBUF_NAMESPACE_ID::MethodOptions* release_options(); PROTOBUF_NAMESPACE_ID::MethodOptions* mutable_options(); void set_allocated_options(PROTOBUF_NAMESPACE_ID::MethodOptions* options); + private: + const PROTOBUF_NAMESPACE_ID::MethodOptions& _internal_options() const; + PROTOBUF_NAMESPACE_ID::MethodOptions* _internal_mutable_options(); + public: void unsafe_arena_set_allocated_options( PROTOBUF_NAMESPACE_ID::MethodOptions* options); PROTOBUF_NAMESPACE_ID::MethodOptions* unsafe_arena_release_options(); @@ -3490,6 +3655,10 @@ class PROTOBUF_EXPORT MethodDescriptorProto : void clear_client_streaming(); bool client_streaming() const; void set_client_streaming(bool value); + private: + bool _internal_client_streaming() const; + void _internal_set_client_streaming(bool value); + public: // optional bool server_streaming = 6 [default = false]; bool has_server_streaming() const; @@ -3499,6 +3668,10 @@ class PROTOBUF_EXPORT MethodDescriptorProto : void clear_server_streaming(); bool server_streaming() const; void set_server_streaming(bool value); + private: + bool _internal_server_streaming() const; + void _internal_set_server_streaming(bool value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.MethodDescriptorProto) private: @@ -3611,12 +3784,7 @@ class PROTOBUF_EXPORT FileOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -3714,10 +3882,17 @@ class PROTOBUF_EXPORT FileOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -4021,6 +4196,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_java_multiple_files(); bool java_multiple_files() const; void set_java_multiple_files(bool value); + private: + bool _internal_java_multiple_files() const; + void _internal_set_java_multiple_files(bool value); + public: // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; PROTOBUF_DEPRECATED bool has_java_generate_equals_and_hash() const; @@ -4030,6 +4209,10 @@ class PROTOBUF_EXPORT FileOptions : PROTOBUF_DEPRECATED void clear_java_generate_equals_and_hash(); PROTOBUF_DEPRECATED bool java_generate_equals_and_hash() const; PROTOBUF_DEPRECATED void set_java_generate_equals_and_hash(bool value); + private: + bool _internal_java_generate_equals_and_hash() const; + void _internal_set_java_generate_equals_and_hash(bool value); + public: // optional bool java_string_check_utf8 = 27 [default = false]; bool has_java_string_check_utf8() const; @@ -4039,6 +4222,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_java_string_check_utf8(); bool java_string_check_utf8() const; void set_java_string_check_utf8(bool value); + private: + bool _internal_java_string_check_utf8() const; + void _internal_set_java_string_check_utf8(bool value); + public: // optional bool cc_generic_services = 16 [default = false]; bool has_cc_generic_services() const; @@ -4048,6 +4235,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_cc_generic_services(); bool cc_generic_services() const; void set_cc_generic_services(bool value); + private: + bool _internal_cc_generic_services() const; + void _internal_set_cc_generic_services(bool value); + public: // optional bool java_generic_services = 17 [default = false]; bool has_java_generic_services() const; @@ -4057,6 +4248,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_java_generic_services(); bool java_generic_services() const; void set_java_generic_services(bool value); + private: + bool _internal_java_generic_services() const; + void _internal_set_java_generic_services(bool value); + public: // optional bool py_generic_services = 18 [default = false]; bool has_py_generic_services() const; @@ -4066,6 +4261,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_py_generic_services(); bool py_generic_services() const; void set_py_generic_services(bool value); + private: + bool _internal_py_generic_services() const; + void _internal_set_py_generic_services(bool value); + public: // optional bool php_generic_services = 42 [default = false]; bool has_php_generic_services() const; @@ -4075,6 +4274,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_php_generic_services(); bool php_generic_services() const; void set_php_generic_services(bool value); + private: + bool _internal_php_generic_services() const; + void _internal_set_php_generic_services(bool value); + public: // optional bool deprecated = 23 [default = false]; bool has_deprecated() const; @@ -4084,6 +4287,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_deprecated(); bool deprecated() const; void set_deprecated(bool value); + private: + bool _internal_deprecated() const; + void _internal_set_deprecated(bool value); + public: // optional bool cc_enable_arenas = 31 [default = false]; bool has_cc_enable_arenas() const; @@ -4093,6 +4300,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_cc_enable_arenas(); bool cc_enable_arenas() const; void set_cc_enable_arenas(bool value); + private: + bool _internal_cc_enable_arenas() const; + void _internal_set_cc_enable_arenas(bool value); + public: // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; bool has_optimize_for() const; @@ -4102,6 +4313,10 @@ class PROTOBUF_EXPORT FileOptions : void clear_optimize_for(); PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode optimize_for() const; void set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value); + private: + PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode _internal_optimize_for() const; + void _internal_set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value); + public: GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(FileOptions) // @@protoc_insertion_point(class_scope:google.protobuf.FileOptions) @@ -4232,12 +4447,7 @@ class PROTOBUF_EXPORT MessageOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -4287,10 +4497,17 @@ class PROTOBUF_EXPORT MessageOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -4304,6 +4521,10 @@ class PROTOBUF_EXPORT MessageOptions : void clear_message_set_wire_format(); bool message_set_wire_format() const; void set_message_set_wire_format(bool value); + private: + bool _internal_message_set_wire_format() const; + void _internal_set_message_set_wire_format(bool value); + public: // optional bool no_standard_descriptor_accessor = 2 [default = false]; bool has_no_standard_descriptor_accessor() const; @@ -4313,6 +4534,10 @@ class PROTOBUF_EXPORT MessageOptions : void clear_no_standard_descriptor_accessor(); bool no_standard_descriptor_accessor() const; void set_no_standard_descriptor_accessor(bool value); + private: + bool _internal_no_standard_descriptor_accessor() const; + void _internal_set_no_standard_descriptor_accessor(bool value); + public: // optional bool deprecated = 3 [default = false]; bool has_deprecated() const; @@ -4322,6 +4547,10 @@ class PROTOBUF_EXPORT MessageOptions : void clear_deprecated(); bool deprecated() const; void set_deprecated(bool value); + private: + bool _internal_deprecated() const; + void _internal_set_deprecated(bool value); + public: // optional bool map_entry = 7; bool has_map_entry() const; @@ -4331,6 +4560,10 @@ class PROTOBUF_EXPORT MessageOptions : void clear_map_entry(); bool map_entry() const; void set_map_entry(bool value); + private: + bool _internal_map_entry() const; + void _internal_set_map_entry(bool value); + public: GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MessageOptions) // @@protoc_insertion_point(class_scope:google.protobuf.MessageOptions) @@ -4445,12 +4678,7 @@ class PROTOBUF_EXPORT FieldOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -4566,10 +4794,17 @@ class PROTOBUF_EXPORT FieldOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -4583,6 +4818,10 @@ class PROTOBUF_EXPORT FieldOptions : void clear_ctype(); PROTOBUF_NAMESPACE_ID::FieldOptions_CType ctype() const; void set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value); + private: + PROTOBUF_NAMESPACE_ID::FieldOptions_CType _internal_ctype() const; + void _internal_set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value); + public: // optional bool packed = 2; bool has_packed() const; @@ -4592,6 +4831,10 @@ class PROTOBUF_EXPORT FieldOptions : void clear_packed(); bool packed() const; void set_packed(bool value); + private: + bool _internal_packed() const; + void _internal_set_packed(bool value); + public: // optional bool lazy = 5 [default = false]; bool has_lazy() const; @@ -4601,6 +4844,10 @@ class PROTOBUF_EXPORT FieldOptions : void clear_lazy(); bool lazy() const; void set_lazy(bool value); + private: + bool _internal_lazy() const; + void _internal_set_lazy(bool value); + public: // optional bool deprecated = 3 [default = false]; bool has_deprecated() const; @@ -4610,6 +4857,10 @@ class PROTOBUF_EXPORT FieldOptions : void clear_deprecated(); bool deprecated() const; void set_deprecated(bool value); + private: + bool _internal_deprecated() const; + void _internal_set_deprecated(bool value); + public: // optional bool weak = 10 [default = false]; bool has_weak() const; @@ -4619,6 +4870,10 @@ class PROTOBUF_EXPORT FieldOptions : void clear_weak(); bool weak() const; void set_weak(bool value); + private: + bool _internal_weak() const; + void _internal_set_weak(bool value); + public: // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; bool has_jstype() const; @@ -4628,6 +4883,10 @@ class PROTOBUF_EXPORT FieldOptions : void clear_jstype(); PROTOBUF_NAMESPACE_ID::FieldOptions_JSType jstype() const; void set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value); + private: + PROTOBUF_NAMESPACE_ID::FieldOptions_JSType _internal_jstype() const; + void _internal_set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value); + public: GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(FieldOptions) // @@protoc_insertion_point(class_scope:google.protobuf.FieldOptions) @@ -4744,12 +5003,7 @@ class PROTOBUF_EXPORT OneofOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -4795,10 +5049,17 @@ class PROTOBUF_EXPORT OneofOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -4913,12 +5174,7 @@ class PROTOBUF_EXPORT EnumOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -4966,10 +5222,17 @@ class PROTOBUF_EXPORT EnumOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -4983,6 +5246,10 @@ class PROTOBUF_EXPORT EnumOptions : void clear_allow_alias(); bool allow_alias() const; void set_allow_alias(bool value); + private: + bool _internal_allow_alias() const; + void _internal_set_allow_alias(bool value); + public: // optional bool deprecated = 3 [default = false]; bool has_deprecated() const; @@ -4992,6 +5259,10 @@ class PROTOBUF_EXPORT EnumOptions : void clear_deprecated(); bool deprecated() const; void set_deprecated(bool value); + private: + bool _internal_deprecated() const; + void _internal_set_deprecated(bool value); + public: GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumOptions) // @@protoc_insertion_point(class_scope:google.protobuf.EnumOptions) @@ -5104,12 +5375,7 @@ class PROTOBUF_EXPORT EnumValueOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -5156,10 +5422,17 @@ class PROTOBUF_EXPORT EnumValueOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -5173,6 +5446,10 @@ class PROTOBUF_EXPORT EnumValueOptions : void clear_deprecated(); bool deprecated() const; void set_deprecated(bool value); + private: + bool _internal_deprecated() const; + void _internal_set_deprecated(bool value); + public: GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumValueOptions) // @@protoc_insertion_point(class_scope:google.protobuf.EnumValueOptions) @@ -5284,12 +5561,7 @@ class PROTOBUF_EXPORT ServiceOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -5336,10 +5608,17 @@ class PROTOBUF_EXPORT ServiceOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -5353,6 +5632,10 @@ class PROTOBUF_EXPORT ServiceOptions : void clear_deprecated(); bool deprecated() const; void set_deprecated(bool value); + private: + bool _internal_deprecated() const; + void _internal_set_deprecated(bool value); + public: GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(ServiceOptions) // @@protoc_insertion_point(class_scope:google.protobuf.ServiceOptions) @@ -5464,12 +5747,7 @@ class PROTOBUF_EXPORT MethodOptions : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -5549,10 +5827,17 @@ class PROTOBUF_EXPORT MethodOptions : }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; + private: + int _internal_uninterpreted_option_size() const; + public: void clear_uninterpreted_option(); PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& @@ -5566,6 +5851,10 @@ class PROTOBUF_EXPORT MethodOptions : void clear_deprecated(); bool deprecated() const; void set_deprecated(bool value); + private: + bool _internal_deprecated() const; + void _internal_set_deprecated(bool value); + public: // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; bool has_idempotency_level() const; @@ -5575,6 +5864,10 @@ class PROTOBUF_EXPORT MethodOptions : void clear_idempotency_level(); PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel idempotency_level() const; void set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value); + private: + PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel _internal_idempotency_level() const; + void _internal_set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value); + public: GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MethodOptions) // @@protoc_insertion_point(class_scope:google.protobuf.MethodOptions) @@ -5687,12 +5980,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -5774,6 +6062,10 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart : void clear_is_extension(); bool is_extension() const; void set_is_extension(bool value); + private: + bool _internal_is_extension() const; + void _internal_set_is_extension(bool value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.UninterpretedOption.NamePart) private: @@ -5885,12 +6177,7 @@ class PROTOBUF_EXPORT UninterpretedOption : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -5944,10 +6231,17 @@ class PROTOBUF_EXPORT UninterpretedOption : }; // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; int name_size() const; + private: + int _internal_name_size() const; + public: void clear_name(); PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* mutable_name(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >* mutable_name(); + private: + const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& _internal_name(int index) const; + PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* _internal_add_name(); + public: const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& name(int index) const; PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* add_name(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >& @@ -6048,6 +6342,10 @@ class PROTOBUF_EXPORT UninterpretedOption : void clear_positive_int_value(); ::PROTOBUF_NAMESPACE_ID::uint64 positive_int_value() const; void set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint64 _internal_positive_int_value() const; + void _internal_set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value); + public: // optional int64 negative_int_value = 5; bool has_negative_int_value() const; @@ -6057,6 +6355,10 @@ class PROTOBUF_EXPORT UninterpretedOption : void clear_negative_int_value(); ::PROTOBUF_NAMESPACE_ID::int64 negative_int_value() const; void set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_negative_int_value() const; + void _internal_set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value); + public: // optional double double_value = 6; bool has_double_value() const; @@ -6066,6 +6368,10 @@ class PROTOBUF_EXPORT UninterpretedOption : void clear_double_value(); double double_value() const; void set_double_value(double value); + private: + double _internal_double_value() const; + void _internal_set_double_value(double value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.UninterpretedOption) private: @@ -6179,12 +6485,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -6234,7 +6535,18 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location : }; // repeated int32 path = 1 [packed = true]; int path_size() const; + private: + int _internal_path_size() const; + public: void clear_path(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_path(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_path() const; + void _internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_path(); + public: ::PROTOBUF_NAMESPACE_ID::int32 path(int index) const; void set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); void add_path(::PROTOBUF_NAMESPACE_ID::int32 value); @@ -6245,7 +6557,18 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location : // repeated int32 span = 2 [packed = true]; int span_size() const; + private: + int _internal_span_size() const; + public: void clear_span(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_span(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_span() const; + void _internal_add_span(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_span(); + public: ::PROTOBUF_NAMESPACE_ID::int32 span(int index) const; void set_span(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); void add_span(::PROTOBUF_NAMESPACE_ID::int32 value); @@ -6256,6 +6579,9 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location : // repeated string leading_detached_comments = 6; int leading_detached_comments_size() const; + private: + int _internal_leading_detached_comments_size() const; + public: void clear_leading_detached_comments(); const std::string& leading_detached_comments(int index) const; std::string* mutable_leading_detached_comments(int index); @@ -6271,6 +6597,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& leading_detached_comments() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_leading_detached_comments(); private: + const std::string& _internal_leading_detached_comments(int index) const; std::string* _internal_add_leading_detached_comments(); public: @@ -6444,12 +6771,7 @@ class PROTOBUF_EXPORT SourceCodeInfo : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -6497,10 +6819,17 @@ class PROTOBUF_EXPORT SourceCodeInfo : }; // repeated .google.protobuf.SourceCodeInfo.Location location = 1; int location_size() const; + private: + int _internal_location_size() const; + public: void clear_location(); PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* mutable_location(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >* mutable_location(); + private: + const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& _internal_location(int index) const; + PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* _internal_add_location(); + public: const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& location(int index) const; PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* add_location(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >& @@ -6612,12 +6941,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -6666,7 +6990,18 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation : }; // repeated int32 path = 1 [packed = true]; int path_size() const; + private: + int _internal_path_size() const; + public: void clear_path(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_path(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_path() const; + void _internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_path(); + public: ::PROTOBUF_NAMESPACE_ID::int32 path(int index) const; void set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); void add_path(::PROTOBUF_NAMESPACE_ID::int32 value); @@ -6712,6 +7047,10 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation : void clear_begin(); ::PROTOBUF_NAMESPACE_ID::int32 begin() const; void set_begin(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_begin() const; + void _internal_set_begin(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // optional int32 end = 4; bool has_end() const; @@ -6721,6 +7060,10 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation : void clear_end(); ::PROTOBUF_NAMESPACE_ID::int32 end() const; void set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const; + void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo.Annotation) private: @@ -6832,12 +7175,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -6885,10 +7223,17 @@ class PROTOBUF_EXPORT GeneratedCodeInfo : }; // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; int annotation_size() const; + private: + int _internal_annotation_size() const; + public: void clear_annotation(); PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* mutable_annotation(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >* mutable_annotation(); + private: + const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& _internal_annotation(int index) const; + PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* _internal_add_annotation(); + public: const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& annotation(int index) const; PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* add_annotation(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >& @@ -6919,9 +7264,12 @@ class PROTOBUF_EXPORT GeneratedCodeInfo : // FileDescriptorSet // repeated .google.protobuf.FileDescriptorProto file = 1; -inline int FileDescriptorSet::file_size() const { +inline int FileDescriptorSet::_internal_file_size() const { return file_.size(); } +inline int FileDescriptorSet::file_size() const { + return _internal_file_size(); +} inline void FileDescriptorSet::clear_file() { file_.Clear(); } @@ -6934,13 +7282,19 @@ FileDescriptorSet::mutable_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorSet.file) return &file_; } +inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& FileDescriptorSet::_internal_file(int index) const { + return file_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& FileDescriptorSet::file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file) - return file_.Get(index); + return _internal_file(index); +} +inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* FileDescriptorSet::_internal_add_file() { + return file_.Add(); } inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* FileDescriptorSet::add_file() { // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file) - return file_.Add(); + return _internal_add_file(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& FileDescriptorSet::file() const { @@ -6954,7 +7308,8 @@ FileDescriptorSet::file() const { // optional string name = 1; inline bool FileDescriptorProto::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool FileDescriptorProto::has_name() const { return _internal_has_name(); @@ -7046,7 +7401,8 @@ inline void FileDescriptorProto::unsafe_arena_set_allocated_name( // optional string package = 2; inline bool FileDescriptorProto::_internal_has_package() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool FileDescriptorProto::has_package() const { return _internal_has_package(); @@ -7137,9 +7493,12 @@ inline void FileDescriptorProto::unsafe_arena_set_allocated_package( } // repeated string dependency = 3; -inline int FileDescriptorProto::dependency_size() const { +inline int FileDescriptorProto::_internal_dependency_size() const { return dependency_.size(); } +inline int FileDescriptorProto::dependency_size() const { + return _internal_dependency_size(); +} inline void FileDescriptorProto::clear_dependency() { dependency_.Clear(); } @@ -7147,9 +7506,12 @@ inline std::string* FileDescriptorProto::add_dependency() { // @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.dependency) return _internal_add_dependency(); } +inline const std::string& FileDescriptorProto::_internal_dependency(int index) const { + return dependency_.Get(index); +} inline const std::string& FileDescriptorProto::dependency(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.dependency) - return dependency_.Get(index); + return _internal_dependency(index); } inline std::string* FileDescriptorProto::mutable_dependency(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.dependency) @@ -7205,69 +7567,106 @@ FileDescriptorProto::mutable_dependency() { } // repeated int32 public_dependency = 10; -inline int FileDescriptorProto::public_dependency_size() const { +inline int FileDescriptorProto::_internal_public_dependency_size() const { return public_dependency_.size(); } +inline int FileDescriptorProto::public_dependency_size() const { + return _internal_public_dependency_size(); +} inline void FileDescriptorProto::clear_public_dependency() { public_dependency_.Clear(); } +inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::_internal_public_dependency(int index) const { + return public_dependency_.Get(index); +} inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::public_dependency(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.public_dependency) - return public_dependency_.Get(index); + return _internal_public_dependency(index); } inline void FileDescriptorProto::set_public_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { public_dependency_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.public_dependency) } -inline void FileDescriptorProto::add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FileDescriptorProto::_internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { public_dependency_.Add(value); +} +inline void FileDescriptorProto::add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_public_dependency(value); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.public_dependency) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +FileDescriptorProto::_internal_public_dependency() const { + return public_dependency_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& FileDescriptorProto::public_dependency() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.public_dependency) - return public_dependency_; + return _internal_public_dependency(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +FileDescriptorProto::_internal_mutable_public_dependency() { + return &public_dependency_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* FileDescriptorProto::mutable_public_dependency() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.public_dependency) - return &public_dependency_; + return _internal_mutable_public_dependency(); } // repeated int32 weak_dependency = 11; -inline int FileDescriptorProto::weak_dependency_size() const { +inline int FileDescriptorProto::_internal_weak_dependency_size() const { return weak_dependency_.size(); } +inline int FileDescriptorProto::weak_dependency_size() const { + return _internal_weak_dependency_size(); +} inline void FileDescriptorProto::clear_weak_dependency() { weak_dependency_.Clear(); } +inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::_internal_weak_dependency(int index) const { + return weak_dependency_.Get(index); +} inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::weak_dependency(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.weak_dependency) - return weak_dependency_.Get(index); + return _internal_weak_dependency(index); } inline void FileDescriptorProto::set_weak_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { weak_dependency_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.weak_dependency) } -inline void FileDescriptorProto::add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FileDescriptorProto::_internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { weak_dependency_.Add(value); +} +inline void FileDescriptorProto::add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_weak_dependency(value); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.weak_dependency) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +FileDescriptorProto::_internal_weak_dependency() const { + return weak_dependency_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& FileDescriptorProto::weak_dependency() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.weak_dependency) - return weak_dependency_; + return _internal_weak_dependency(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +FileDescriptorProto::_internal_mutable_weak_dependency() { + return &weak_dependency_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* FileDescriptorProto::mutable_weak_dependency() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.weak_dependency) - return &weak_dependency_; + return _internal_mutable_weak_dependency(); } // repeated .google.protobuf.DescriptorProto message_type = 4; -inline int FileDescriptorProto::message_type_size() const { +inline int FileDescriptorProto::_internal_message_type_size() const { return message_type_.size(); } +inline int FileDescriptorProto::message_type_size() const { + return _internal_message_type_size(); +} inline void FileDescriptorProto::clear_message_type() { message_type_.Clear(); } @@ -7280,13 +7679,19 @@ FileDescriptorProto::mutable_message_type() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.message_type) return &message_type_; } +inline const PROTOBUF_NAMESPACE_ID::DescriptorProto& FileDescriptorProto::_internal_message_type(int index) const { + return message_type_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::DescriptorProto& FileDescriptorProto::message_type(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.message_type) - return message_type_.Get(index); + return _internal_message_type(index); +} +inline PROTOBUF_NAMESPACE_ID::DescriptorProto* FileDescriptorProto::_internal_add_message_type() { + return message_type_.Add(); } inline PROTOBUF_NAMESPACE_ID::DescriptorProto* FileDescriptorProto::add_message_type() { // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type) - return message_type_.Add(); + return _internal_add_message_type(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >& FileDescriptorProto::message_type() const { @@ -7295,9 +7700,12 @@ FileDescriptorProto::message_type() const { } // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; -inline int FileDescriptorProto::enum_type_size() const { +inline int FileDescriptorProto::_internal_enum_type_size() const { return enum_type_.size(); } +inline int FileDescriptorProto::enum_type_size() const { + return _internal_enum_type_size(); +} inline void FileDescriptorProto::clear_enum_type() { enum_type_.Clear(); } @@ -7310,13 +7718,19 @@ FileDescriptorProto::mutable_enum_type() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.enum_type) return &enum_type_; } +inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& FileDescriptorProto::_internal_enum_type(int index) const { + return enum_type_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.enum_type) - return enum_type_.Get(index); + return _internal_enum_type(index); +} +inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* FileDescriptorProto::_internal_add_enum_type() { + return enum_type_.Add(); } inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* FileDescriptorProto::add_enum_type() { // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type) - return enum_type_.Add(); + return _internal_add_enum_type(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& FileDescriptorProto::enum_type() const { @@ -7325,9 +7739,12 @@ FileDescriptorProto::enum_type() const { } // repeated .google.protobuf.ServiceDescriptorProto service = 6; -inline int FileDescriptorProto::service_size() const { +inline int FileDescriptorProto::_internal_service_size() const { return service_.size(); } +inline int FileDescriptorProto::service_size() const { + return _internal_service_size(); +} inline void FileDescriptorProto::clear_service() { service_.Clear(); } @@ -7340,13 +7757,19 @@ FileDescriptorProto::mutable_service() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.service) return &service_; } +inline const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& FileDescriptorProto::_internal_service(int index) const { + return service_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& FileDescriptorProto::service(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service) - return service_.Get(index); + return _internal_service(index); +} +inline PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* FileDescriptorProto::_internal_add_service() { + return service_.Add(); } inline PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* FileDescriptorProto::add_service() { // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service) - return service_.Add(); + return _internal_add_service(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >& FileDescriptorProto::service() const { @@ -7355,9 +7778,12 @@ FileDescriptorProto::service() const { } // repeated .google.protobuf.FieldDescriptorProto extension = 7; -inline int FileDescriptorProto::extension_size() const { +inline int FileDescriptorProto::_internal_extension_size() const { return extension_.size(); } +inline int FileDescriptorProto::extension_size() const { + return _internal_extension_size(); +} inline void FileDescriptorProto::clear_extension() { extension_.Clear(); } @@ -7370,13 +7796,19 @@ FileDescriptorProto::mutable_extension() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.extension) return &extension_; } +inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& FileDescriptorProto::_internal_extension(int index) const { + return extension_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& FileDescriptorProto::extension(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension) - return extension_.Get(index); + return _internal_extension(index); +} +inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* FileDescriptorProto::_internal_add_extension() { + return extension_.Add(); } inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* FileDescriptorProto::add_extension() { // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension) - return extension_.Add(); + return _internal_add_extension(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& FileDescriptorProto::extension() const { @@ -7386,7 +7818,9 @@ FileDescriptorProto::extension() const { // optional .google.protobuf.FileOptions options = 8; inline bool FileDescriptorProto::_internal_has_options() const { - return (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool FileDescriptorProto::has_options() const { return _internal_has_options(); @@ -7395,12 +7829,15 @@ inline void FileDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000008u; } -inline const PROTOBUF_NAMESPACE_ID::FileOptions& FileDescriptorProto::options() const { +inline const PROTOBUF_NAMESPACE_ID::FileOptions& FileDescriptorProto::_internal_options() const { const PROTOBUF_NAMESPACE_ID::FileOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_FileOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::FileOptions& FileDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -7415,15 +7852,18 @@ inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::unsafe_arena_rel options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000008u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options) + return _internal_mutable_options(); +} inline void FileDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::FileOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -7446,7 +7886,9 @@ inline void FileDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::Fi // optional .google.protobuf.SourceCodeInfo source_code_info = 9; inline bool FileDescriptorProto::_internal_has_source_code_info() const { - return (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; + PROTOBUF_ASSUME(!value || source_code_info_ != nullptr); + return value; } inline bool FileDescriptorProto::has_source_code_info() const { return _internal_has_source_code_info(); @@ -7455,12 +7897,15 @@ inline void FileDescriptorProto::clear_source_code_info() { if (source_code_info_ != nullptr) source_code_info_->Clear(); _has_bits_[0] &= ~0x00000010u; } -inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& FileDescriptorProto::source_code_info() const { +inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& FileDescriptorProto::_internal_source_code_info() const { const PROTOBUF_NAMESPACE_ID::SourceCodeInfo* p = source_code_info_; - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_SourceCodeInfo_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& FileDescriptorProto::source_code_info() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info) + return _internal_source_code_info(); +} inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::release_source_code_info() { auto temp = unsafe_arena_release_source_code_info(); if (GetArenaNoVirtual() != nullptr) { @@ -7475,15 +7920,18 @@ inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::unsafe_arena_ source_code_info_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { +inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::_internal_mutable_source_code_info() { _has_bits_[0] |= 0x00000010u; if (source_code_info_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); source_code_info_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info) return source_code_info_; } +inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info) + return _internal_mutable_source_code_info(); +} inline void FileDescriptorProto::set_allocated_source_code_info(PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -7506,7 +7954,8 @@ inline void FileDescriptorProto::set_allocated_source_code_info(PROTOBUF_NAMESPA // optional string syntax = 12; inline bool FileDescriptorProto::_internal_has_syntax() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool FileDescriptorProto::has_syntax() const { return _internal_has_syntax(); @@ -7602,7 +8051,8 @@ inline void FileDescriptorProto::unsafe_arena_set_allocated_syntax( // optional int32 start = 1; inline bool DescriptorProto_ExtensionRange::_internal_has_start() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool DescriptorProto_ExtensionRange::has_start() const { return _internal_has_start(); @@ -7611,19 +8061,26 @@ inline void DescriptorProto_ExtensionRange::clear_start() { start_ = 0; _has_bits_[0] &= ~0x00000002u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::_internal_start() const { + return start_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::start() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.start) - return start_; + return _internal_start(); } -inline void DescriptorProto_ExtensionRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ExtensionRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000002u; start_ = value; +} +inline void DescriptorProto_ExtensionRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_start(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.start) } // optional int32 end = 2; inline bool DescriptorProto_ExtensionRange::_internal_has_end() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool DescriptorProto_ExtensionRange::has_end() const { return _internal_has_end(); @@ -7632,19 +8089,27 @@ inline void DescriptorProto_ExtensionRange::clear_end() { end_ = 0; _has_bits_[0] &= ~0x00000004u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::_internal_end() const { + return end_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::end() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.end) - return end_; + return _internal_end(); } -inline void DescriptorProto_ExtensionRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ExtensionRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000004u; end_ = value; +} +inline void DescriptorProto_ExtensionRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_end(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.end) } // optional .google.protobuf.ExtensionRangeOptions options = 3; inline bool DescriptorProto_ExtensionRange::_internal_has_options() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool DescriptorProto_ExtensionRange::has_options() const { return _internal_has_options(); @@ -7653,12 +8118,15 @@ inline void DescriptorProto_ExtensionRange::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000001u; } -inline const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& DescriptorProto_ExtensionRange::options() const { +inline const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& DescriptorProto_ExtensionRange::_internal_options() const { const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_ExtensionRangeOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& DescriptorProto_ExtensionRange::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -7673,15 +8141,18 @@ inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRa options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::_internal_mutable_options() { _has_bits_[0] |= 0x00000001u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options) + return _internal_mutable_options(); +} inline void DescriptorProto_ExtensionRange::set_allocated_options(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -7708,7 +8179,8 @@ inline void DescriptorProto_ExtensionRange::set_allocated_options(PROTOBUF_NAMES // optional int32 start = 1; inline bool DescriptorProto_ReservedRange::_internal_has_start() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool DescriptorProto_ReservedRange::has_start() const { return _internal_has_start(); @@ -7717,19 +8189,26 @@ inline void DescriptorProto_ReservedRange::clear_start() { start_ = 0; _has_bits_[0] &= ~0x00000001u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::_internal_start() const { + return start_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::start() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.start) - return start_; + return _internal_start(); } -inline void DescriptorProto_ReservedRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ReservedRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000001u; start_ = value; +} +inline void DescriptorProto_ReservedRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_start(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.start) } // optional int32 end = 2; inline bool DescriptorProto_ReservedRange::_internal_has_end() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool DescriptorProto_ReservedRange::has_end() const { return _internal_has_end(); @@ -7738,13 +8217,19 @@ inline void DescriptorProto_ReservedRange::clear_end() { end_ = 0; _has_bits_[0] &= ~0x00000002u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::_internal_end() const { + return end_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::end() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.end) - return end_; + return _internal_end(); } -inline void DescriptorProto_ReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ReservedRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000002u; end_ = value; +} +inline void DescriptorProto_ReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_end(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.end) } @@ -7754,7 +8239,8 @@ inline void DescriptorProto_ReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int3 // optional string name = 1; inline bool DescriptorProto::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool DescriptorProto::has_name() const { return _internal_has_name(); @@ -7845,9 +8331,12 @@ inline void DescriptorProto::unsafe_arena_set_allocated_name( } // repeated .google.protobuf.FieldDescriptorProto field = 2; -inline int DescriptorProto::field_size() const { +inline int DescriptorProto::_internal_field_size() const { return field_.size(); } +inline int DescriptorProto::field_size() const { + return _internal_field_size(); +} inline void DescriptorProto::clear_field() { field_.Clear(); } @@ -7860,13 +8349,19 @@ DescriptorProto::mutable_field() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.field) return &field_; } +inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::_internal_field(int index) const { + return field_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::field(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field) - return field_.Get(index); + return _internal_field(index); +} +inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::_internal_add_field() { + return field_.Add(); } inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::add_field() { // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field) - return field_.Add(); + return _internal_add_field(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& DescriptorProto::field() const { @@ -7875,9 +8370,12 @@ DescriptorProto::field() const { } // repeated .google.protobuf.FieldDescriptorProto extension = 6; -inline int DescriptorProto::extension_size() const { +inline int DescriptorProto::_internal_extension_size() const { return extension_.size(); } +inline int DescriptorProto::extension_size() const { + return _internal_extension_size(); +} inline void DescriptorProto::clear_extension() { extension_.Clear(); } @@ -7890,13 +8388,19 @@ DescriptorProto::mutable_extension() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension) return &extension_; } +inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::_internal_extension(int index) const { + return extension_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::extension(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension) - return extension_.Get(index); + return _internal_extension(index); +} +inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::_internal_add_extension() { + return extension_.Add(); } inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::add_extension() { // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension) - return extension_.Add(); + return _internal_add_extension(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& DescriptorProto::extension() const { @@ -7905,9 +8409,12 @@ DescriptorProto::extension() const { } // repeated .google.protobuf.DescriptorProto nested_type = 3; -inline int DescriptorProto::nested_type_size() const { +inline int DescriptorProto::_internal_nested_type_size() const { return nested_type_.size(); } +inline int DescriptorProto::nested_type_size() const { + return _internal_nested_type_size(); +} inline void DescriptorProto::clear_nested_type() { nested_type_.Clear(); } @@ -7920,13 +8427,19 @@ DescriptorProto::mutable_nested_type() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.nested_type) return &nested_type_; } +inline const PROTOBUF_NAMESPACE_ID::DescriptorProto& DescriptorProto::_internal_nested_type(int index) const { + return nested_type_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::DescriptorProto& DescriptorProto::nested_type(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.nested_type) - return nested_type_.Get(index); + return _internal_nested_type(index); +} +inline PROTOBUF_NAMESPACE_ID::DescriptorProto* DescriptorProto::_internal_add_nested_type() { + return nested_type_.Add(); } inline PROTOBUF_NAMESPACE_ID::DescriptorProto* DescriptorProto::add_nested_type() { // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type) - return nested_type_.Add(); + return _internal_add_nested_type(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >& DescriptorProto::nested_type() const { @@ -7935,9 +8448,12 @@ DescriptorProto::nested_type() const { } // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; -inline int DescriptorProto::enum_type_size() const { +inline int DescriptorProto::_internal_enum_type_size() const { return enum_type_.size(); } +inline int DescriptorProto::enum_type_size() const { + return _internal_enum_type_size(); +} inline void DescriptorProto::clear_enum_type() { enum_type_.Clear(); } @@ -7950,13 +8466,19 @@ DescriptorProto::mutable_enum_type() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.enum_type) return &enum_type_; } +inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& DescriptorProto::_internal_enum_type(int index) const { + return enum_type_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& DescriptorProto::enum_type(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.enum_type) - return enum_type_.Get(index); + return _internal_enum_type(index); +} +inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* DescriptorProto::_internal_add_enum_type() { + return enum_type_.Add(); } inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* DescriptorProto::add_enum_type() { // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type) - return enum_type_.Add(); + return _internal_add_enum_type(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& DescriptorProto::enum_type() const { @@ -7965,9 +8487,12 @@ DescriptorProto::enum_type() const { } // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; -inline int DescriptorProto::extension_range_size() const { +inline int DescriptorProto::_internal_extension_range_size() const { return extension_range_.size(); } +inline int DescriptorProto::extension_range_size() const { + return _internal_extension_range_size(); +} inline void DescriptorProto::clear_extension_range() { extension_range_.Clear(); } @@ -7980,13 +8505,19 @@ DescriptorProto::mutable_extension_range() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension_range) return &extension_range_; } +inline const PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& DescriptorProto::_internal_extension_range(int index) const { + return extension_range_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension_range) - return extension_range_.Get(index); + return _internal_extension_range(index); +} +inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* DescriptorProto::_internal_add_extension_range() { + return extension_range_.Add(); } inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() { // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range) - return extension_range_.Add(); + return _internal_add_extension_range(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >& DescriptorProto::extension_range() const { @@ -7995,9 +8526,12 @@ DescriptorProto::extension_range() const { } // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; -inline int DescriptorProto::oneof_decl_size() const { +inline int DescriptorProto::_internal_oneof_decl_size() const { return oneof_decl_.size(); } +inline int DescriptorProto::oneof_decl_size() const { + return _internal_oneof_decl_size(); +} inline void DescriptorProto::clear_oneof_decl() { oneof_decl_.Clear(); } @@ -8010,13 +8544,19 @@ DescriptorProto::mutable_oneof_decl() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.oneof_decl) return &oneof_decl_; } +inline const PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& DescriptorProto::_internal_oneof_decl(int index) const { + return oneof_decl_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& DescriptorProto::oneof_decl(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.oneof_decl) - return oneof_decl_.Get(index); + return _internal_oneof_decl(index); +} +inline PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* DescriptorProto::_internal_add_oneof_decl() { + return oneof_decl_.Add(); } inline PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* DescriptorProto::add_oneof_decl() { // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl) - return oneof_decl_.Add(); + return _internal_add_oneof_decl(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >& DescriptorProto::oneof_decl() const { @@ -8026,7 +8566,9 @@ DescriptorProto::oneof_decl() const { // optional .google.protobuf.MessageOptions options = 7; inline bool DescriptorProto::_internal_has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool DescriptorProto::has_options() const { return _internal_has_options(); @@ -8035,12 +8577,15 @@ inline void DescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::MessageOptions& DescriptorProto::options() const { +inline const PROTOBUF_NAMESPACE_ID::MessageOptions& DescriptorProto::_internal_options() const { const PROTOBUF_NAMESPACE_ID::MessageOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_MessageOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::MessageOptions& DescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -8055,15 +8600,18 @@ inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::unsafe_arena_rele options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options) + return _internal_mutable_options(); +} inline void DescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::MessageOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -8085,9 +8633,12 @@ inline void DescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::Messag } // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; -inline int DescriptorProto::reserved_range_size() const { +inline int DescriptorProto::_internal_reserved_range_size() const { return reserved_range_.size(); } +inline int DescriptorProto::reserved_range_size() const { + return _internal_reserved_range_size(); +} inline void DescriptorProto::clear_reserved_range() { reserved_range_.Clear(); } @@ -8100,13 +8651,19 @@ DescriptorProto::mutable_reserved_range() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_range) return &reserved_range_; } +inline const PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& DescriptorProto::_internal_reserved_range(int index) const { + return reserved_range_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& DescriptorProto::reserved_range(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_range) - return reserved_range_.Get(index); + return _internal_reserved_range(index); +} +inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* DescriptorProto::_internal_add_reserved_range() { + return reserved_range_.Add(); } inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() { // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range) - return reserved_range_.Add(); + return _internal_add_reserved_range(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >& DescriptorProto::reserved_range() const { @@ -8115,9 +8672,12 @@ DescriptorProto::reserved_range() const { } // repeated string reserved_name = 10; -inline int DescriptorProto::reserved_name_size() const { +inline int DescriptorProto::_internal_reserved_name_size() const { return reserved_name_.size(); } +inline int DescriptorProto::reserved_name_size() const { + return _internal_reserved_name_size(); +} inline void DescriptorProto::clear_reserved_name() { reserved_name_.Clear(); } @@ -8125,9 +8685,12 @@ inline std::string* DescriptorProto::add_reserved_name() { // @@protoc_insertion_point(field_add_mutable:google.protobuf.DescriptorProto.reserved_name) return _internal_add_reserved_name(); } +inline const std::string& DescriptorProto::_internal_reserved_name(int index) const { + return reserved_name_.Get(index); +} inline const std::string& DescriptorProto::reserved_name(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_name) - return reserved_name_.Get(index); + return _internal_reserved_name(index); } inline std::string* DescriptorProto::mutable_reserved_name(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_name) @@ -8187,9 +8750,12 @@ DescriptorProto::mutable_reserved_name() { // ExtensionRangeOptions // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int ExtensionRangeOptions::uninterpreted_option_size() const { +inline int ExtensionRangeOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int ExtensionRangeOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void ExtensionRangeOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -8202,13 +8768,19 @@ ExtensionRangeOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& ExtensionRangeOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& ExtensionRangeOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.ExtensionRangeOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ExtensionRangeOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ExtensionRangeOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& ExtensionRangeOptions::uninterpreted_option() const { @@ -8222,7 +8794,8 @@ ExtensionRangeOptions::uninterpreted_option() const { // optional string name = 1; inline bool FieldDescriptorProto::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool FieldDescriptorProto::has_name() const { return _internal_has_name(); @@ -8314,7 +8887,8 @@ inline void FieldDescriptorProto::unsafe_arena_set_allocated_name( // optional int32 number = 3; inline bool FieldDescriptorProto::_internal_has_number() const { - return (_has_bits_[0] & 0x00000040u) != 0; + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; } inline bool FieldDescriptorProto::has_number() const { return _internal_has_number(); @@ -8323,19 +8897,26 @@ inline void FieldDescriptorProto::clear_number() { number_ = 0; _has_bits_[0] &= ~0x00000040u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::_internal_number() const { + return number_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::number() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.number) - return number_; + return _internal_number(); } -inline void FieldDescriptorProto::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FieldDescriptorProto::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000040u; number_ = value; +} +inline void FieldDescriptorProto::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_number(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.number) } // optional .google.protobuf.FieldDescriptorProto.Label label = 4; inline bool FieldDescriptorProto::_internal_has_label() const { - return (_has_bits_[0] & 0x00000100u) != 0; + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; } inline bool FieldDescriptorProto::has_label() const { return _internal_has_label(); @@ -8344,20 +8925,27 @@ inline void FieldDescriptorProto::clear_label() { label_ = 1; _has_bits_[0] &= ~0x00000100u; } +inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label FieldDescriptorProto::_internal_label() const { + return static_cast< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label >(label_); +} inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label FieldDescriptorProto::label() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.label) - return static_cast< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label >(label_); + return _internal_label(); } -inline void FieldDescriptorProto::set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value) { +inline void FieldDescriptorProto::_internal_set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value) { assert(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(value)); _has_bits_[0] |= 0x00000100u; label_ = value; +} +inline void FieldDescriptorProto::set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value) { + _internal_set_label(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.label) } // optional .google.protobuf.FieldDescriptorProto.Type type = 5; inline bool FieldDescriptorProto::_internal_has_type() const { - return (_has_bits_[0] & 0x00000200u) != 0; + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; } inline bool FieldDescriptorProto::has_type() const { return _internal_has_type(); @@ -8366,20 +8954,27 @@ inline void FieldDescriptorProto::clear_type() { type_ = 1; _has_bits_[0] &= ~0x00000200u; } +inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type FieldDescriptorProto::_internal_type() const { + return static_cast< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type >(type_); +} inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type FieldDescriptorProto::type() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type) - return static_cast< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type >(type_); + return _internal_type(); } -inline void FieldDescriptorProto::set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value) { +inline void FieldDescriptorProto::_internal_set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value) { assert(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(value)); _has_bits_[0] |= 0x00000200u; type_ = value; +} +inline void FieldDescriptorProto::set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value) { + _internal_set_type(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type) } // optional string type_name = 6; inline bool FieldDescriptorProto::_internal_has_type_name() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool FieldDescriptorProto::has_type_name() const { return _internal_has_type_name(); @@ -8471,7 +9066,8 @@ inline void FieldDescriptorProto::unsafe_arena_set_allocated_type_name( // optional string extendee = 2; inline bool FieldDescriptorProto::_internal_has_extendee() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool FieldDescriptorProto::has_extendee() const { return _internal_has_extendee(); @@ -8563,7 +9159,8 @@ inline void FieldDescriptorProto::unsafe_arena_set_allocated_extendee( // optional string default_value = 7; inline bool FieldDescriptorProto::_internal_has_default_value() const { - return (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; } inline bool FieldDescriptorProto::has_default_value() const { return _internal_has_default_value(); @@ -8655,7 +9252,8 @@ inline void FieldDescriptorProto::unsafe_arena_set_allocated_default_value( // optional int32 oneof_index = 9; inline bool FieldDescriptorProto::_internal_has_oneof_index() const { - return (_has_bits_[0] & 0x00000080u) != 0; + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; } inline bool FieldDescriptorProto::has_oneof_index() const { return _internal_has_oneof_index(); @@ -8664,19 +9262,26 @@ inline void FieldDescriptorProto::clear_oneof_index() { oneof_index_ = 0; _has_bits_[0] &= ~0x00000080u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::_internal_oneof_index() const { + return oneof_index_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::oneof_index() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.oneof_index) - return oneof_index_; + return _internal_oneof_index(); } -inline void FieldDescriptorProto::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FieldDescriptorProto::_internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000080u; oneof_index_ = value; +} +inline void FieldDescriptorProto::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_oneof_index(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index) } // optional string json_name = 10; inline bool FieldDescriptorProto::_internal_has_json_name() const { - return (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; } inline bool FieldDescriptorProto::has_json_name() const { return _internal_has_json_name(); @@ -8768,7 +9373,9 @@ inline void FieldDescriptorProto::unsafe_arena_set_allocated_json_name( // optional .google.protobuf.FieldOptions options = 8; inline bool FieldDescriptorProto::_internal_has_options() const { - return (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool FieldDescriptorProto::has_options() const { return _internal_has_options(); @@ -8777,12 +9384,15 @@ inline void FieldDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000020u; } -inline const PROTOBUF_NAMESPACE_ID::FieldOptions& FieldDescriptorProto::options() const { +inline const PROTOBUF_NAMESPACE_ID::FieldOptions& FieldDescriptorProto::_internal_options() const { const PROTOBUF_NAMESPACE_ID::FieldOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_FieldOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::FieldOptions& FieldDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -8797,15 +9407,18 @@ inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::unsafe_arena_r options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000020u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options) + return _internal_mutable_options(); +} inline void FieldDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::FieldOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -8832,7 +9445,8 @@ inline void FieldDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::F // optional string name = 1; inline bool OneofDescriptorProto::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool OneofDescriptorProto::has_name() const { return _internal_has_name(); @@ -8924,7 +9538,9 @@ inline void OneofDescriptorProto::unsafe_arena_set_allocated_name( // optional .google.protobuf.OneofOptions options = 2; inline bool OneofDescriptorProto::_internal_has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool OneofDescriptorProto::has_options() const { return _internal_has_options(); @@ -8933,12 +9549,15 @@ inline void OneofDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::OneofOptions& OneofDescriptorProto::options() const { +inline const PROTOBUF_NAMESPACE_ID::OneofOptions& OneofDescriptorProto::_internal_options() const { const PROTOBUF_NAMESPACE_ID::OneofOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_OneofOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::OneofOptions& OneofDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -8953,15 +9572,18 @@ inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::unsafe_arena_r options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options) + return _internal_mutable_options(); +} inline void OneofDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::OneofOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -8988,7 +9610,8 @@ inline void OneofDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::O // optional int32 start = 1; inline bool EnumDescriptorProto_EnumReservedRange::_internal_has_start() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool EnumDescriptorProto_EnumReservedRange::has_start() const { return _internal_has_start(); @@ -8997,19 +9620,26 @@ inline void EnumDescriptorProto_EnumReservedRange::clear_start() { start_ = 0; _has_bits_[0] &= ~0x00000001u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::_internal_start() const { + return start_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::start() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.start) - return start_; + return _internal_start(); } -inline void EnumDescriptorProto_EnumReservedRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumDescriptorProto_EnumReservedRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000001u; start_ = value; +} +inline void EnumDescriptorProto_EnumReservedRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_start(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.start) } // optional int32 end = 2; inline bool EnumDescriptorProto_EnumReservedRange::_internal_has_end() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool EnumDescriptorProto_EnumReservedRange::has_end() const { return _internal_has_end(); @@ -9018,13 +9648,19 @@ inline void EnumDescriptorProto_EnumReservedRange::clear_end() { end_ = 0; _has_bits_[0] &= ~0x00000002u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::_internal_end() const { + return end_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::end() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.end) - return end_; + return _internal_end(); } -inline void EnumDescriptorProto_EnumReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumDescriptorProto_EnumReservedRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000002u; end_ = value; +} +inline void EnumDescriptorProto_EnumReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_end(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.end) } @@ -9034,7 +9670,8 @@ inline void EnumDescriptorProto_EnumReservedRange::set_end(::PROTOBUF_NAMESPACE_ // optional string name = 1; inline bool EnumDescriptorProto::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool EnumDescriptorProto::has_name() const { return _internal_has_name(); @@ -9125,9 +9762,12 @@ inline void EnumDescriptorProto::unsafe_arena_set_allocated_name( } // repeated .google.protobuf.EnumValueDescriptorProto value = 2; -inline int EnumDescriptorProto::value_size() const { +inline int EnumDescriptorProto::_internal_value_size() const { return value_.size(); } +inline int EnumDescriptorProto::value_size() const { + return _internal_value_size(); +} inline void EnumDescriptorProto::clear_value() { value_.Clear(); } @@ -9140,13 +9780,19 @@ EnumDescriptorProto::mutable_value() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.value) return &value_; } +inline const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& EnumDescriptorProto::_internal_value(int index) const { + return value_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value) - return value_.Get(index); + return _internal_value(index); +} +inline PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* EnumDescriptorProto::_internal_add_value() { + return value_.Add(); } inline PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* EnumDescriptorProto::add_value() { // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value) - return value_.Add(); + return _internal_add_value(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >& EnumDescriptorProto::value() const { @@ -9156,7 +9802,9 @@ EnumDescriptorProto::value() const { // optional .google.protobuf.EnumOptions options = 3; inline bool EnumDescriptorProto::_internal_has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool EnumDescriptorProto::has_options() const { return _internal_has_options(); @@ -9165,12 +9813,15 @@ inline void EnumDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::EnumOptions& EnumDescriptorProto::options() const { +inline const PROTOBUF_NAMESPACE_ID::EnumOptions& EnumDescriptorProto::_internal_options() const { const PROTOBUF_NAMESPACE_ID::EnumOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_EnumOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::EnumOptions& EnumDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -9185,15 +9836,18 @@ inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::unsafe_arena_rel options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options) + return _internal_mutable_options(); +} inline void EnumDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -9215,9 +9869,12 @@ inline void EnumDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::En } // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; -inline int EnumDescriptorProto::reserved_range_size() const { +inline int EnumDescriptorProto::_internal_reserved_range_size() const { return reserved_range_.size(); } +inline int EnumDescriptorProto::reserved_range_size() const { + return _internal_reserved_range_size(); +} inline void EnumDescriptorProto::clear_reserved_range() { reserved_range_.Clear(); } @@ -9230,13 +9887,19 @@ EnumDescriptorProto::mutable_reserved_range() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.reserved_range) return &reserved_range_; } +inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::_internal_reserved_range(int index) const { + return reserved_range_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::reserved_range(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_range) - return reserved_range_.Get(index); + return _internal_reserved_range(index); +} +inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::_internal_add_reserved_range() { + return reserved_range_.Add(); } inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::add_reserved_range() { // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_range) - return reserved_range_.Add(); + return _internal_add_reserved_range(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >& EnumDescriptorProto::reserved_range() const { @@ -9245,9 +9908,12 @@ EnumDescriptorProto::reserved_range() const { } // repeated string reserved_name = 5; -inline int EnumDescriptorProto::reserved_name_size() const { +inline int EnumDescriptorProto::_internal_reserved_name_size() const { return reserved_name_.size(); } +inline int EnumDescriptorProto::reserved_name_size() const { + return _internal_reserved_name_size(); +} inline void EnumDescriptorProto::clear_reserved_name() { reserved_name_.Clear(); } @@ -9255,9 +9921,12 @@ inline std::string* EnumDescriptorProto::add_reserved_name() { // @@protoc_insertion_point(field_add_mutable:google.protobuf.EnumDescriptorProto.reserved_name) return _internal_add_reserved_name(); } +inline const std::string& EnumDescriptorProto::_internal_reserved_name(int index) const { + return reserved_name_.Get(index); +} inline const std::string& EnumDescriptorProto::reserved_name(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_name) - return reserved_name_.Get(index); + return _internal_reserved_name(index); } inline std::string* EnumDescriptorProto::mutable_reserved_name(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.reserved_name) @@ -9318,7 +9987,8 @@ EnumDescriptorProto::mutable_reserved_name() { // optional string name = 1; inline bool EnumValueDescriptorProto::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool EnumValueDescriptorProto::has_name() const { return _internal_has_name(); @@ -9410,7 +10080,8 @@ inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_name( // optional int32 number = 2; inline bool EnumValueDescriptorProto::_internal_has_number() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool EnumValueDescriptorProto::has_number() const { return _internal_has_number(); @@ -9419,19 +10090,27 @@ inline void EnumValueDescriptorProto::clear_number() { number_ = 0; _has_bits_[0] &= ~0x00000004u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValueDescriptorProto::_internal_number() const { + return number_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValueDescriptorProto::number() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.number) - return number_; + return _internal_number(); } -inline void EnumValueDescriptorProto::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumValueDescriptorProto::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000004u; number_ = value; +} +inline void EnumValueDescriptorProto::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_number(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.number) } // optional .google.protobuf.EnumValueOptions options = 3; inline bool EnumValueDescriptorProto::_internal_has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool EnumValueDescriptorProto::has_options() const { return _internal_has_options(); @@ -9440,12 +10119,15 @@ inline void EnumValueDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::EnumValueOptions& EnumValueDescriptorProto::options() const { +inline const PROTOBUF_NAMESPACE_ID::EnumValueOptions& EnumValueDescriptorProto::_internal_options() const { const PROTOBUF_NAMESPACE_ID::EnumValueOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_EnumValueOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::EnumValueOptions& EnumValueDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -9460,15 +10142,18 @@ inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::unsafe options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options) + return _internal_mutable_options(); +} inline void EnumValueDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumValueOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -9495,7 +10180,8 @@ inline void EnumValueDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_I // optional string name = 1; inline bool ServiceDescriptorProto::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool ServiceDescriptorProto::has_name() const { return _internal_has_name(); @@ -9586,9 +10272,12 @@ inline void ServiceDescriptorProto::unsafe_arena_set_allocated_name( } // repeated .google.protobuf.MethodDescriptorProto method = 2; -inline int ServiceDescriptorProto::method_size() const { +inline int ServiceDescriptorProto::_internal_method_size() const { return method_.size(); } +inline int ServiceDescriptorProto::method_size() const { + return _internal_method_size(); +} inline void ServiceDescriptorProto::clear_method() { method_.Clear(); } @@ -9601,13 +10290,19 @@ ServiceDescriptorProto::mutable_method() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceDescriptorProto.method) return &method_; } +inline const PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& ServiceDescriptorProto::_internal_method(int index) const { + return method_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method) - return method_.Get(index); + return _internal_method(index); +} +inline PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* ServiceDescriptorProto::_internal_add_method() { + return method_.Add(); } inline PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* ServiceDescriptorProto::add_method() { // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method) - return method_.Add(); + return _internal_add_method(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >& ServiceDescriptorProto::method() const { @@ -9617,7 +10312,9 @@ ServiceDescriptorProto::method() const { // optional .google.protobuf.ServiceOptions options = 3; inline bool ServiceDescriptorProto::_internal_has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool ServiceDescriptorProto::has_options() const { return _internal_has_options(); @@ -9626,12 +10323,15 @@ inline void ServiceDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::ServiceOptions& ServiceDescriptorProto::options() const { +inline const PROTOBUF_NAMESPACE_ID::ServiceOptions& ServiceDescriptorProto::_internal_options() const { const PROTOBUF_NAMESPACE_ID::ServiceOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_ServiceOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::ServiceOptions& ServiceDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -9646,15 +10346,18 @@ inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::unsafe_are options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options) + return _internal_mutable_options(); +} inline void ServiceDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::ServiceOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -9681,7 +10384,8 @@ inline void ServiceDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID: // optional string name = 1; inline bool MethodDescriptorProto::_internal_has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool MethodDescriptorProto::has_name() const { return _internal_has_name(); @@ -9773,7 +10477,8 @@ inline void MethodDescriptorProto::unsafe_arena_set_allocated_name( // optional string input_type = 2; inline bool MethodDescriptorProto::_internal_has_input_type() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool MethodDescriptorProto::has_input_type() const { return _internal_has_input_type(); @@ -9865,7 +10570,8 @@ inline void MethodDescriptorProto::unsafe_arena_set_allocated_input_type( // optional string output_type = 3; inline bool MethodDescriptorProto::_internal_has_output_type() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool MethodDescriptorProto::has_output_type() const { return _internal_has_output_type(); @@ -9957,7 +10663,9 @@ inline void MethodDescriptorProto::unsafe_arena_set_allocated_output_type( // optional .google.protobuf.MethodOptions options = 4; inline bool MethodDescriptorProto::_internal_has_options() const { - return (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || options_ != nullptr); + return value; } inline bool MethodDescriptorProto::has_options() const { return _internal_has_options(); @@ -9966,12 +10674,15 @@ inline void MethodDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000008u; } -inline const PROTOBUF_NAMESPACE_ID::MethodOptions& MethodDescriptorProto::options() const { +inline const PROTOBUF_NAMESPACE_ID::MethodOptions& MethodDescriptorProto::_internal_options() const { const PROTOBUF_NAMESPACE_ID::MethodOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_MethodOptions_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::MethodOptions& MethodDescriptorProto::options() const { + // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options) + return _internal_options(); +} inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::release_options() { auto temp = unsafe_arena_release_options(); if (GetArenaNoVirtual() != nullptr) { @@ -9986,15 +10697,18 @@ inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::unsafe_arena options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::mutable_options() { +inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000008u; if (options_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); options_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options) return options_; } +inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::mutable_options() { + // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options) + return _internal_mutable_options(); +} inline void MethodDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::MethodOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -10017,7 +10731,8 @@ inline void MethodDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID:: // optional bool client_streaming = 5 [default = false]; inline bool MethodDescriptorProto::_internal_has_client_streaming() const { - return (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; } inline bool MethodDescriptorProto::has_client_streaming() const { return _internal_has_client_streaming(); @@ -10026,19 +10741,26 @@ inline void MethodDescriptorProto::clear_client_streaming() { client_streaming_ = false; _has_bits_[0] &= ~0x00000010u; } +inline bool MethodDescriptorProto::_internal_client_streaming() const { + return client_streaming_; +} inline bool MethodDescriptorProto::client_streaming() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.client_streaming) - return client_streaming_; + return _internal_client_streaming(); } -inline void MethodDescriptorProto::set_client_streaming(bool value) { +inline void MethodDescriptorProto::_internal_set_client_streaming(bool value) { _has_bits_[0] |= 0x00000010u; client_streaming_ = value; +} +inline void MethodDescriptorProto::set_client_streaming(bool value) { + _internal_set_client_streaming(value); // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.client_streaming) } // optional bool server_streaming = 6 [default = false]; inline bool MethodDescriptorProto::_internal_has_server_streaming() const { - return (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; } inline bool MethodDescriptorProto::has_server_streaming() const { return _internal_has_server_streaming(); @@ -10047,13 +10769,19 @@ inline void MethodDescriptorProto::clear_server_streaming() { server_streaming_ = false; _has_bits_[0] &= ~0x00000020u; } +inline bool MethodDescriptorProto::_internal_server_streaming() const { + return server_streaming_; +} inline bool MethodDescriptorProto::server_streaming() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.server_streaming) - return server_streaming_; + return _internal_server_streaming(); } -inline void MethodDescriptorProto::set_server_streaming(bool value) { +inline void MethodDescriptorProto::_internal_set_server_streaming(bool value) { _has_bits_[0] |= 0x00000020u; server_streaming_ = value; +} +inline void MethodDescriptorProto::set_server_streaming(bool value) { + _internal_set_server_streaming(value); // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.server_streaming) } @@ -10063,7 +10791,8 @@ inline void MethodDescriptorProto::set_server_streaming(bool value) { // optional string java_package = 1; inline bool FileOptions::_internal_has_java_package() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool FileOptions::has_java_package() const { return _internal_has_java_package(); @@ -10155,7 +10884,8 @@ inline void FileOptions::unsafe_arena_set_allocated_java_package( // optional string java_outer_classname = 8; inline bool FileOptions::_internal_has_java_outer_classname() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool FileOptions::has_java_outer_classname() const { return _internal_has_java_outer_classname(); @@ -10247,7 +10977,8 @@ inline void FileOptions::unsafe_arena_set_allocated_java_outer_classname( // optional bool java_multiple_files = 10 [default = false]; inline bool FileOptions::_internal_has_java_multiple_files() const { - return (_has_bits_[0] & 0x00000400u) != 0; + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; } inline bool FileOptions::has_java_multiple_files() const { return _internal_has_java_multiple_files(); @@ -10256,19 +10987,26 @@ inline void FileOptions::clear_java_multiple_files() { java_multiple_files_ = false; _has_bits_[0] &= ~0x00000400u; } +inline bool FileOptions::_internal_java_multiple_files() const { + return java_multiple_files_; +} inline bool FileOptions::java_multiple_files() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_multiple_files) - return java_multiple_files_; + return _internal_java_multiple_files(); } -inline void FileOptions::set_java_multiple_files(bool value) { +inline void FileOptions::_internal_set_java_multiple_files(bool value) { _has_bits_[0] |= 0x00000400u; java_multiple_files_ = value; +} +inline void FileOptions::set_java_multiple_files(bool value) { + _internal_set_java_multiple_files(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_multiple_files) } // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; inline bool FileOptions::_internal_has_java_generate_equals_and_hash() const { - return (_has_bits_[0] & 0x00000800u) != 0; + bool value = (_has_bits_[0] & 0x00000800u) != 0; + return value; } inline bool FileOptions::has_java_generate_equals_and_hash() const { return _internal_has_java_generate_equals_and_hash(); @@ -10277,19 +11015,26 @@ inline void FileOptions::clear_java_generate_equals_and_hash() { java_generate_equals_and_hash_ = false; _has_bits_[0] &= ~0x00000800u; } +inline bool FileOptions::_internal_java_generate_equals_and_hash() const { + return java_generate_equals_and_hash_; +} inline bool FileOptions::java_generate_equals_and_hash() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generate_equals_and_hash) - return java_generate_equals_and_hash_; + return _internal_java_generate_equals_and_hash(); } -inline void FileOptions::set_java_generate_equals_and_hash(bool value) { +inline void FileOptions::_internal_set_java_generate_equals_and_hash(bool value) { _has_bits_[0] |= 0x00000800u; java_generate_equals_and_hash_ = value; +} +inline void FileOptions::set_java_generate_equals_and_hash(bool value) { + _internal_set_java_generate_equals_and_hash(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generate_equals_and_hash) } // optional bool java_string_check_utf8 = 27 [default = false]; inline bool FileOptions::_internal_has_java_string_check_utf8() const { - return (_has_bits_[0] & 0x00001000u) != 0; + bool value = (_has_bits_[0] & 0x00001000u) != 0; + return value; } inline bool FileOptions::has_java_string_check_utf8() const { return _internal_has_java_string_check_utf8(); @@ -10298,19 +11043,26 @@ inline void FileOptions::clear_java_string_check_utf8() { java_string_check_utf8_ = false; _has_bits_[0] &= ~0x00001000u; } +inline bool FileOptions::_internal_java_string_check_utf8() const { + return java_string_check_utf8_; +} inline bool FileOptions::java_string_check_utf8() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_string_check_utf8) - return java_string_check_utf8_; + return _internal_java_string_check_utf8(); } -inline void FileOptions::set_java_string_check_utf8(bool value) { +inline void FileOptions::_internal_set_java_string_check_utf8(bool value) { _has_bits_[0] |= 0x00001000u; java_string_check_utf8_ = value; +} +inline void FileOptions::set_java_string_check_utf8(bool value) { + _internal_set_java_string_check_utf8(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_string_check_utf8) } // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; inline bool FileOptions::_internal_has_optimize_for() const { - return (_has_bits_[0] & 0x00080000u) != 0; + bool value = (_has_bits_[0] & 0x00080000u) != 0; + return value; } inline bool FileOptions::has_optimize_for() const { return _internal_has_optimize_for(); @@ -10319,20 +11071,27 @@ inline void FileOptions::clear_optimize_for() { optimize_for_ = 1; _has_bits_[0] &= ~0x00080000u; } +inline PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode FileOptions::_internal_optimize_for() const { + return static_cast< PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode >(optimize_for_); +} inline PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode FileOptions::optimize_for() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.optimize_for) - return static_cast< PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode >(optimize_for_); + return _internal_optimize_for(); } -inline void FileOptions::set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value) { +inline void FileOptions::_internal_set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value) { assert(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(value)); _has_bits_[0] |= 0x00080000u; optimize_for_ = value; +} +inline void FileOptions::set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value) { + _internal_set_optimize_for(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.optimize_for) } // optional string go_package = 11; inline bool FileOptions::_internal_has_go_package() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool FileOptions::has_go_package() const { return _internal_has_go_package(); @@ -10424,7 +11183,8 @@ inline void FileOptions::unsafe_arena_set_allocated_go_package( // optional bool cc_generic_services = 16 [default = false]; inline bool FileOptions::_internal_has_cc_generic_services() const { - return (_has_bits_[0] & 0x00002000u) != 0; + bool value = (_has_bits_[0] & 0x00002000u) != 0; + return value; } inline bool FileOptions::has_cc_generic_services() const { return _internal_has_cc_generic_services(); @@ -10433,19 +11193,26 @@ inline void FileOptions::clear_cc_generic_services() { cc_generic_services_ = false; _has_bits_[0] &= ~0x00002000u; } +inline bool FileOptions::_internal_cc_generic_services() const { + return cc_generic_services_; +} inline bool FileOptions::cc_generic_services() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_generic_services) - return cc_generic_services_; + return _internal_cc_generic_services(); } -inline void FileOptions::set_cc_generic_services(bool value) { +inline void FileOptions::_internal_set_cc_generic_services(bool value) { _has_bits_[0] |= 0x00002000u; cc_generic_services_ = value; +} +inline void FileOptions::set_cc_generic_services(bool value) { + _internal_set_cc_generic_services(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_generic_services) } // optional bool java_generic_services = 17 [default = false]; inline bool FileOptions::_internal_has_java_generic_services() const { - return (_has_bits_[0] & 0x00004000u) != 0; + bool value = (_has_bits_[0] & 0x00004000u) != 0; + return value; } inline bool FileOptions::has_java_generic_services() const { return _internal_has_java_generic_services(); @@ -10454,19 +11221,26 @@ inline void FileOptions::clear_java_generic_services() { java_generic_services_ = false; _has_bits_[0] &= ~0x00004000u; } +inline bool FileOptions::_internal_java_generic_services() const { + return java_generic_services_; +} inline bool FileOptions::java_generic_services() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generic_services) - return java_generic_services_; + return _internal_java_generic_services(); } -inline void FileOptions::set_java_generic_services(bool value) { +inline void FileOptions::_internal_set_java_generic_services(bool value) { _has_bits_[0] |= 0x00004000u; java_generic_services_ = value; +} +inline void FileOptions::set_java_generic_services(bool value) { + _internal_set_java_generic_services(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generic_services) } // optional bool py_generic_services = 18 [default = false]; inline bool FileOptions::_internal_has_py_generic_services() const { - return (_has_bits_[0] & 0x00008000u) != 0; + bool value = (_has_bits_[0] & 0x00008000u) != 0; + return value; } inline bool FileOptions::has_py_generic_services() const { return _internal_has_py_generic_services(); @@ -10475,19 +11249,26 @@ inline void FileOptions::clear_py_generic_services() { py_generic_services_ = false; _has_bits_[0] &= ~0x00008000u; } +inline bool FileOptions::_internal_py_generic_services() const { + return py_generic_services_; +} inline bool FileOptions::py_generic_services() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.py_generic_services) - return py_generic_services_; + return _internal_py_generic_services(); } -inline void FileOptions::set_py_generic_services(bool value) { +inline void FileOptions::_internal_set_py_generic_services(bool value) { _has_bits_[0] |= 0x00008000u; py_generic_services_ = value; +} +inline void FileOptions::set_py_generic_services(bool value) { + _internal_set_py_generic_services(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services) } // optional bool php_generic_services = 42 [default = false]; inline bool FileOptions::_internal_has_php_generic_services() const { - return (_has_bits_[0] & 0x00010000u) != 0; + bool value = (_has_bits_[0] & 0x00010000u) != 0; + return value; } inline bool FileOptions::has_php_generic_services() const { return _internal_has_php_generic_services(); @@ -10496,19 +11277,26 @@ inline void FileOptions::clear_php_generic_services() { php_generic_services_ = false; _has_bits_[0] &= ~0x00010000u; } +inline bool FileOptions::_internal_php_generic_services() const { + return php_generic_services_; +} inline bool FileOptions::php_generic_services() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_generic_services) - return php_generic_services_; + return _internal_php_generic_services(); } -inline void FileOptions::set_php_generic_services(bool value) { +inline void FileOptions::_internal_set_php_generic_services(bool value) { _has_bits_[0] |= 0x00010000u; php_generic_services_ = value; +} +inline void FileOptions::set_php_generic_services(bool value) { + _internal_set_php_generic_services(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_generic_services) } // optional bool deprecated = 23 [default = false]; inline bool FileOptions::_internal_has_deprecated() const { - return (_has_bits_[0] & 0x00020000u) != 0; + bool value = (_has_bits_[0] & 0x00020000u) != 0; + return value; } inline bool FileOptions::has_deprecated() const { return _internal_has_deprecated(); @@ -10517,19 +11305,26 @@ inline void FileOptions::clear_deprecated() { deprecated_ = false; _has_bits_[0] &= ~0x00020000u; } +inline bool FileOptions::_internal_deprecated() const { + return deprecated_; +} inline bool FileOptions::deprecated() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.deprecated) - return deprecated_; + return _internal_deprecated(); } -inline void FileOptions::set_deprecated(bool value) { +inline void FileOptions::_internal_set_deprecated(bool value) { _has_bits_[0] |= 0x00020000u; deprecated_ = value; +} +inline void FileOptions::set_deprecated(bool value) { + _internal_set_deprecated(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.deprecated) } // optional bool cc_enable_arenas = 31 [default = false]; inline bool FileOptions::_internal_has_cc_enable_arenas() const { - return (_has_bits_[0] & 0x00040000u) != 0; + bool value = (_has_bits_[0] & 0x00040000u) != 0; + return value; } inline bool FileOptions::has_cc_enable_arenas() const { return _internal_has_cc_enable_arenas(); @@ -10538,19 +11333,26 @@ inline void FileOptions::clear_cc_enable_arenas() { cc_enable_arenas_ = false; _has_bits_[0] &= ~0x00040000u; } +inline bool FileOptions::_internal_cc_enable_arenas() const { + return cc_enable_arenas_; +} inline bool FileOptions::cc_enable_arenas() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_enable_arenas) - return cc_enable_arenas_; + return _internal_cc_enable_arenas(); } -inline void FileOptions::set_cc_enable_arenas(bool value) { +inline void FileOptions::_internal_set_cc_enable_arenas(bool value) { _has_bits_[0] |= 0x00040000u; cc_enable_arenas_ = value; +} +inline void FileOptions::set_cc_enable_arenas(bool value) { + _internal_set_cc_enable_arenas(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_enable_arenas) } // optional string objc_class_prefix = 36; inline bool FileOptions::_internal_has_objc_class_prefix() const { - return (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; } inline bool FileOptions::has_objc_class_prefix() const { return _internal_has_objc_class_prefix(); @@ -10642,7 +11444,8 @@ inline void FileOptions::unsafe_arena_set_allocated_objc_class_prefix( // optional string csharp_namespace = 37; inline bool FileOptions::_internal_has_csharp_namespace() const { - return (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; } inline bool FileOptions::has_csharp_namespace() const { return _internal_has_csharp_namespace(); @@ -10734,7 +11537,8 @@ inline void FileOptions::unsafe_arena_set_allocated_csharp_namespace( // optional string swift_prefix = 39; inline bool FileOptions::_internal_has_swift_prefix() const { - return (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; } inline bool FileOptions::has_swift_prefix() const { return _internal_has_swift_prefix(); @@ -10826,7 +11630,8 @@ inline void FileOptions::unsafe_arena_set_allocated_swift_prefix( // optional string php_class_prefix = 40; inline bool FileOptions::_internal_has_php_class_prefix() const { - return (_has_bits_[0] & 0x00000040u) != 0; + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; } inline bool FileOptions::has_php_class_prefix() const { return _internal_has_php_class_prefix(); @@ -10918,7 +11723,8 @@ inline void FileOptions::unsafe_arena_set_allocated_php_class_prefix( // optional string php_namespace = 41; inline bool FileOptions::_internal_has_php_namespace() const { - return (_has_bits_[0] & 0x00000080u) != 0; + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; } inline bool FileOptions::has_php_namespace() const { return _internal_has_php_namespace(); @@ -11010,7 +11816,8 @@ inline void FileOptions::unsafe_arena_set_allocated_php_namespace( // optional string php_metadata_namespace = 44; inline bool FileOptions::_internal_has_php_metadata_namespace() const { - return (_has_bits_[0] & 0x00000100u) != 0; + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; } inline bool FileOptions::has_php_metadata_namespace() const { return _internal_has_php_metadata_namespace(); @@ -11102,7 +11909,8 @@ inline void FileOptions::unsafe_arena_set_allocated_php_metadata_namespace( // optional string ruby_package = 45; inline bool FileOptions::_internal_has_ruby_package() const { - return (_has_bits_[0] & 0x00000200u) != 0; + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; } inline bool FileOptions::has_ruby_package() const { return _internal_has_ruby_package(); @@ -11193,9 +12001,12 @@ inline void FileOptions::unsafe_arena_set_allocated_ruby_package( } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int FileOptions::uninterpreted_option_size() const { +inline int FileOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int FileOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void FileOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -11208,13 +12019,19 @@ FileOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& FileOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& FileOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FileOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FileOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& FileOptions::uninterpreted_option() const { @@ -11228,7 +12045,8 @@ FileOptions::uninterpreted_option() const { // optional bool message_set_wire_format = 1 [default = false]; inline bool MessageOptions::_internal_has_message_set_wire_format() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool MessageOptions::has_message_set_wire_format() const { return _internal_has_message_set_wire_format(); @@ -11237,19 +12055,26 @@ inline void MessageOptions::clear_message_set_wire_format() { message_set_wire_format_ = false; _has_bits_[0] &= ~0x00000001u; } +inline bool MessageOptions::_internal_message_set_wire_format() const { + return message_set_wire_format_; +} inline bool MessageOptions::message_set_wire_format() const { // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.message_set_wire_format) - return message_set_wire_format_; + return _internal_message_set_wire_format(); } -inline void MessageOptions::set_message_set_wire_format(bool value) { +inline void MessageOptions::_internal_set_message_set_wire_format(bool value) { _has_bits_[0] |= 0x00000001u; message_set_wire_format_ = value; +} +inline void MessageOptions::set_message_set_wire_format(bool value) { + _internal_set_message_set_wire_format(value); // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.message_set_wire_format) } // optional bool no_standard_descriptor_accessor = 2 [default = false]; inline bool MessageOptions::_internal_has_no_standard_descriptor_accessor() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool MessageOptions::has_no_standard_descriptor_accessor() const { return _internal_has_no_standard_descriptor_accessor(); @@ -11258,19 +12083,26 @@ inline void MessageOptions::clear_no_standard_descriptor_accessor() { no_standard_descriptor_accessor_ = false; _has_bits_[0] &= ~0x00000002u; } +inline bool MessageOptions::_internal_no_standard_descriptor_accessor() const { + return no_standard_descriptor_accessor_; +} inline bool MessageOptions::no_standard_descriptor_accessor() const { // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.no_standard_descriptor_accessor) - return no_standard_descriptor_accessor_; + return _internal_no_standard_descriptor_accessor(); } -inline void MessageOptions::set_no_standard_descriptor_accessor(bool value) { +inline void MessageOptions::_internal_set_no_standard_descriptor_accessor(bool value) { _has_bits_[0] |= 0x00000002u; no_standard_descriptor_accessor_ = value; +} +inline void MessageOptions::set_no_standard_descriptor_accessor(bool value) { + _internal_set_no_standard_descriptor_accessor(value); // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.no_standard_descriptor_accessor) } // optional bool deprecated = 3 [default = false]; inline bool MessageOptions::_internal_has_deprecated() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool MessageOptions::has_deprecated() const { return _internal_has_deprecated(); @@ -11279,19 +12111,26 @@ inline void MessageOptions::clear_deprecated() { deprecated_ = false; _has_bits_[0] &= ~0x00000004u; } +inline bool MessageOptions::_internal_deprecated() const { + return deprecated_; +} inline bool MessageOptions::deprecated() const { // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.deprecated) - return deprecated_; + return _internal_deprecated(); } -inline void MessageOptions::set_deprecated(bool value) { +inline void MessageOptions::_internal_set_deprecated(bool value) { _has_bits_[0] |= 0x00000004u; deprecated_ = value; +} +inline void MessageOptions::set_deprecated(bool value) { + _internal_set_deprecated(value); // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.deprecated) } // optional bool map_entry = 7; inline bool MessageOptions::_internal_has_map_entry() const { - return (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; } inline bool MessageOptions::has_map_entry() const { return _internal_has_map_entry(); @@ -11300,20 +12139,29 @@ inline void MessageOptions::clear_map_entry() { map_entry_ = false; _has_bits_[0] &= ~0x00000008u; } +inline bool MessageOptions::_internal_map_entry() const { + return map_entry_; +} inline bool MessageOptions::map_entry() const { // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.map_entry) - return map_entry_; + return _internal_map_entry(); } -inline void MessageOptions::set_map_entry(bool value) { +inline void MessageOptions::_internal_set_map_entry(bool value) { _has_bits_[0] |= 0x00000008u; map_entry_ = value; +} +inline void MessageOptions::set_map_entry(bool value) { + _internal_set_map_entry(value); // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.map_entry) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int MessageOptions::uninterpreted_option_size() const { +inline int MessageOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int MessageOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void MessageOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -11326,13 +12174,19 @@ MessageOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.MessageOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& MessageOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MessageOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MessageOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& MessageOptions::uninterpreted_option() const { @@ -11346,7 +12200,8 @@ MessageOptions::uninterpreted_option() const { // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; inline bool FieldOptions::_internal_has_ctype() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool FieldOptions::has_ctype() const { return _internal_has_ctype(); @@ -11355,20 +12210,27 @@ inline void FieldOptions::clear_ctype() { ctype_ = 0; _has_bits_[0] &= ~0x00000001u; } +inline PROTOBUF_NAMESPACE_ID::FieldOptions_CType FieldOptions::_internal_ctype() const { + return static_cast< PROTOBUF_NAMESPACE_ID::FieldOptions_CType >(ctype_); +} inline PROTOBUF_NAMESPACE_ID::FieldOptions_CType FieldOptions::ctype() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.ctype) - return static_cast< PROTOBUF_NAMESPACE_ID::FieldOptions_CType >(ctype_); + return _internal_ctype(); } -inline void FieldOptions::set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value) { +inline void FieldOptions::_internal_set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value) { assert(PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(value)); _has_bits_[0] |= 0x00000001u; ctype_ = value; +} +inline void FieldOptions::set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value) { + _internal_set_ctype(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.ctype) } // optional bool packed = 2; inline bool FieldOptions::_internal_has_packed() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool FieldOptions::has_packed() const { return _internal_has_packed(); @@ -11377,19 +12239,26 @@ inline void FieldOptions::clear_packed() { packed_ = false; _has_bits_[0] &= ~0x00000002u; } +inline bool FieldOptions::_internal_packed() const { + return packed_; +} inline bool FieldOptions::packed() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.packed) - return packed_; + return _internal_packed(); } -inline void FieldOptions::set_packed(bool value) { +inline void FieldOptions::_internal_set_packed(bool value) { _has_bits_[0] |= 0x00000002u; packed_ = value; +} +inline void FieldOptions::set_packed(bool value) { + _internal_set_packed(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.packed) } // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; inline bool FieldOptions::_internal_has_jstype() const { - return (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; } inline bool FieldOptions::has_jstype() const { return _internal_has_jstype(); @@ -11398,20 +12267,27 @@ inline void FieldOptions::clear_jstype() { jstype_ = 0; _has_bits_[0] &= ~0x00000020u; } +inline PROTOBUF_NAMESPACE_ID::FieldOptions_JSType FieldOptions::_internal_jstype() const { + return static_cast< PROTOBUF_NAMESPACE_ID::FieldOptions_JSType >(jstype_); +} inline PROTOBUF_NAMESPACE_ID::FieldOptions_JSType FieldOptions::jstype() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.jstype) - return static_cast< PROTOBUF_NAMESPACE_ID::FieldOptions_JSType >(jstype_); + return _internal_jstype(); } -inline void FieldOptions::set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value) { +inline void FieldOptions::_internal_set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value) { assert(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(value)); _has_bits_[0] |= 0x00000020u; jstype_ = value; +} +inline void FieldOptions::set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value) { + _internal_set_jstype(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.jstype) } // optional bool lazy = 5 [default = false]; inline bool FieldOptions::_internal_has_lazy() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool FieldOptions::has_lazy() const { return _internal_has_lazy(); @@ -11420,19 +12296,26 @@ inline void FieldOptions::clear_lazy() { lazy_ = false; _has_bits_[0] &= ~0x00000004u; } +inline bool FieldOptions::_internal_lazy() const { + return lazy_; +} inline bool FieldOptions::lazy() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.lazy) - return lazy_; + return _internal_lazy(); } -inline void FieldOptions::set_lazy(bool value) { +inline void FieldOptions::_internal_set_lazy(bool value) { _has_bits_[0] |= 0x00000004u; lazy_ = value; +} +inline void FieldOptions::set_lazy(bool value) { + _internal_set_lazy(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.lazy) } // optional bool deprecated = 3 [default = false]; inline bool FieldOptions::_internal_has_deprecated() const { - return (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; } inline bool FieldOptions::has_deprecated() const { return _internal_has_deprecated(); @@ -11441,19 +12324,26 @@ inline void FieldOptions::clear_deprecated() { deprecated_ = false; _has_bits_[0] &= ~0x00000008u; } +inline bool FieldOptions::_internal_deprecated() const { + return deprecated_; +} inline bool FieldOptions::deprecated() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.deprecated) - return deprecated_; + return _internal_deprecated(); } -inline void FieldOptions::set_deprecated(bool value) { +inline void FieldOptions::_internal_set_deprecated(bool value) { _has_bits_[0] |= 0x00000008u; deprecated_ = value; +} +inline void FieldOptions::set_deprecated(bool value) { + _internal_set_deprecated(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.deprecated) } // optional bool weak = 10 [default = false]; inline bool FieldOptions::_internal_has_weak() const { - return (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; } inline bool FieldOptions::has_weak() const { return _internal_has_weak(); @@ -11462,20 +12352,29 @@ inline void FieldOptions::clear_weak() { weak_ = false; _has_bits_[0] &= ~0x00000010u; } +inline bool FieldOptions::_internal_weak() const { + return weak_; +} inline bool FieldOptions::weak() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.weak) - return weak_; + return _internal_weak(); } -inline void FieldOptions::set_weak(bool value) { +inline void FieldOptions::_internal_set_weak(bool value) { _has_bits_[0] |= 0x00000010u; weak_ = value; +} +inline void FieldOptions::set_weak(bool value) { + _internal_set_weak(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.weak) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int FieldOptions::uninterpreted_option_size() const { +inline int FieldOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int FieldOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void FieldOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -11488,13 +12387,19 @@ FieldOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& FieldOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FieldOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FieldOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& FieldOptions::uninterpreted_option() const { @@ -11507,9 +12412,12 @@ FieldOptions::uninterpreted_option() const { // OneofOptions // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int OneofOptions::uninterpreted_option_size() const { +inline int OneofOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int OneofOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void OneofOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -11522,13 +12430,19 @@ OneofOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.OneofOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& OneofOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& OneofOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.OneofOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* OneofOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* OneofOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& OneofOptions::uninterpreted_option() const { @@ -11542,7 +12456,8 @@ OneofOptions::uninterpreted_option() const { // optional bool allow_alias = 2; inline bool EnumOptions::_internal_has_allow_alias() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool EnumOptions::has_allow_alias() const { return _internal_has_allow_alias(); @@ -11551,19 +12466,26 @@ inline void EnumOptions::clear_allow_alias() { allow_alias_ = false; _has_bits_[0] &= ~0x00000001u; } +inline bool EnumOptions::_internal_allow_alias() const { + return allow_alias_; +} inline bool EnumOptions::allow_alias() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.allow_alias) - return allow_alias_; + return _internal_allow_alias(); } -inline void EnumOptions::set_allow_alias(bool value) { +inline void EnumOptions::_internal_set_allow_alias(bool value) { _has_bits_[0] |= 0x00000001u; allow_alias_ = value; +} +inline void EnumOptions::set_allow_alias(bool value) { + _internal_set_allow_alias(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.allow_alias) } // optional bool deprecated = 3 [default = false]; inline bool EnumOptions::_internal_has_deprecated() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool EnumOptions::has_deprecated() const { return _internal_has_deprecated(); @@ -11572,20 +12494,29 @@ inline void EnumOptions::clear_deprecated() { deprecated_ = false; _has_bits_[0] &= ~0x00000002u; } +inline bool EnumOptions::_internal_deprecated() const { + return deprecated_; +} inline bool EnumOptions::deprecated() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.deprecated) - return deprecated_; + return _internal_deprecated(); } -inline void EnumOptions::set_deprecated(bool value) { +inline void EnumOptions::_internal_set_deprecated(bool value) { _has_bits_[0] |= 0x00000002u; deprecated_ = value; +} +inline void EnumOptions::set_deprecated(bool value) { + _internal_set_deprecated(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int EnumOptions::uninterpreted_option_size() const { +inline int EnumOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int EnumOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void EnumOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -11598,13 +12529,19 @@ EnumOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& EnumOptions::uninterpreted_option() const { @@ -11618,7 +12555,8 @@ EnumOptions::uninterpreted_option() const { // optional bool deprecated = 1 [default = false]; inline bool EnumValueOptions::_internal_has_deprecated() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool EnumValueOptions::has_deprecated() const { return _internal_has_deprecated(); @@ -11627,20 +12565,29 @@ inline void EnumValueOptions::clear_deprecated() { deprecated_ = false; _has_bits_[0] &= ~0x00000001u; } +inline bool EnumValueOptions::_internal_deprecated() const { + return deprecated_; +} inline bool EnumValueOptions::deprecated() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.deprecated) - return deprecated_; + return _internal_deprecated(); } -inline void EnumValueOptions::set_deprecated(bool value) { +inline void EnumValueOptions::_internal_set_deprecated(bool value) { _has_bits_[0] |= 0x00000001u; deprecated_ = value; +} +inline void EnumValueOptions::set_deprecated(bool value) { + _internal_set_deprecated(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumValueOptions.deprecated) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int EnumValueOptions::uninterpreted_option_size() const { +inline int EnumValueOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int EnumValueOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void EnumValueOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -11653,13 +12600,19 @@ EnumValueOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValueOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumValueOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumValueOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& EnumValueOptions::uninterpreted_option() const { @@ -11673,7 +12626,8 @@ EnumValueOptions::uninterpreted_option() const { // optional bool deprecated = 33 [default = false]; inline bool ServiceOptions::_internal_has_deprecated() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool ServiceOptions::has_deprecated() const { return _internal_has_deprecated(); @@ -11682,20 +12636,29 @@ inline void ServiceOptions::clear_deprecated() { deprecated_ = false; _has_bits_[0] &= ~0x00000001u; } +inline bool ServiceOptions::_internal_deprecated() const { + return deprecated_; +} inline bool ServiceOptions::deprecated() const { // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.deprecated) - return deprecated_; + return _internal_deprecated(); } -inline void ServiceOptions::set_deprecated(bool value) { +inline void ServiceOptions::_internal_set_deprecated(bool value) { _has_bits_[0] |= 0x00000001u; deprecated_ = value; +} +inline void ServiceOptions::set_deprecated(bool value) { + _internal_set_deprecated(value); // @@protoc_insertion_point(field_set:google.protobuf.ServiceOptions.deprecated) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int ServiceOptions::uninterpreted_option_size() const { +inline int ServiceOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int ServiceOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void ServiceOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -11708,13 +12671,19 @@ ServiceOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& ServiceOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ServiceOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ServiceOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& ServiceOptions::uninterpreted_option() const { @@ -11728,7 +12697,8 @@ ServiceOptions::uninterpreted_option() const { // optional bool deprecated = 33 [default = false]; inline bool MethodOptions::_internal_has_deprecated() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool MethodOptions::has_deprecated() const { return _internal_has_deprecated(); @@ -11737,19 +12707,26 @@ inline void MethodOptions::clear_deprecated() { deprecated_ = false; _has_bits_[0] &= ~0x00000001u; } +inline bool MethodOptions::_internal_deprecated() const { + return deprecated_; +} inline bool MethodOptions::deprecated() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.deprecated) - return deprecated_; + return _internal_deprecated(); } -inline void MethodOptions::set_deprecated(bool value) { +inline void MethodOptions::_internal_set_deprecated(bool value) { _has_bits_[0] |= 0x00000001u; deprecated_ = value; +} +inline void MethodOptions::set_deprecated(bool value) { + _internal_set_deprecated(value); // @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.deprecated) } // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; inline bool MethodOptions::_internal_has_idempotency_level() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool MethodOptions::has_idempotency_level() const { return _internal_has_idempotency_level(); @@ -11758,21 +12735,30 @@ inline void MethodOptions::clear_idempotency_level() { idempotency_level_ = 0; _has_bits_[0] &= ~0x00000002u; } +inline PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel MethodOptions::_internal_idempotency_level() const { + return static_cast< PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel >(idempotency_level_); +} inline PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel MethodOptions::idempotency_level() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.idempotency_level) - return static_cast< PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel >(idempotency_level_); + return _internal_idempotency_level(); } -inline void MethodOptions::set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value) { +inline void MethodOptions::_internal_set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value) { assert(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(value)); _has_bits_[0] |= 0x00000002u; idempotency_level_ = value; +} +inline void MethodOptions::set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value) { + _internal_set_idempotency_level(value); // @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.idempotency_level) } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -inline int MethodOptions::uninterpreted_option_size() const { +inline int MethodOptions::_internal_uninterpreted_option_size() const { return uninterpreted_option_.size(); } +inline int MethodOptions::uninterpreted_option_size() const { + return _internal_uninterpreted_option_size(); +} inline void MethodOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } @@ -11785,13 +12771,19 @@ MethodOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.MethodOptions.uninterpreted_option) return &uninterpreted_option_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& MethodOptions::_internal_uninterpreted_option(int index) const { + return uninterpreted_option_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); + return _internal_uninterpreted_option(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MethodOptions::_internal_add_uninterpreted_option() { + return uninterpreted_option_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MethodOptions::add_uninterpreted_option() { // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option) - return uninterpreted_option_.Add(); + return _internal_add_uninterpreted_option(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& MethodOptions::uninterpreted_option() const { @@ -11805,7 +12797,8 @@ MethodOptions::uninterpreted_option() const { // required string name_part = 1; inline bool UninterpretedOption_NamePart::_internal_has_name_part() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool UninterpretedOption_NamePart::has_name_part() const { return _internal_has_name_part(); @@ -11897,7 +12890,8 @@ inline void UninterpretedOption_NamePart::unsafe_arena_set_allocated_name_part( // required bool is_extension = 2; inline bool UninterpretedOption_NamePart::_internal_has_is_extension() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool UninterpretedOption_NamePart::has_is_extension() const { return _internal_has_is_extension(); @@ -11906,13 +12900,19 @@ inline void UninterpretedOption_NamePart::clear_is_extension() { is_extension_ = false; _has_bits_[0] &= ~0x00000002u; } +inline bool UninterpretedOption_NamePart::_internal_is_extension() const { + return is_extension_; +} inline bool UninterpretedOption_NamePart::is_extension() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.is_extension) - return is_extension_; + return _internal_is_extension(); } -inline void UninterpretedOption_NamePart::set_is_extension(bool value) { +inline void UninterpretedOption_NamePart::_internal_set_is_extension(bool value) { _has_bits_[0] |= 0x00000002u; is_extension_ = value; +} +inline void UninterpretedOption_NamePart::set_is_extension(bool value) { + _internal_set_is_extension(value); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.is_extension) } @@ -11921,9 +12921,12 @@ inline void UninterpretedOption_NamePart::set_is_extension(bool value) { // UninterpretedOption // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; -inline int UninterpretedOption::name_size() const { +inline int UninterpretedOption::_internal_name_size() const { return name_.size(); } +inline int UninterpretedOption::name_size() const { + return _internal_name_size(); +} inline void UninterpretedOption::clear_name() { name_.Clear(); } @@ -11936,13 +12939,19 @@ UninterpretedOption::mutable_name() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.UninterpretedOption.name) return &name_; } +inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& UninterpretedOption::_internal_name(int index) const { + return name_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name) - return name_.Get(index); + return _internal_name(index); +} +inline PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* UninterpretedOption::_internal_add_name() { + return name_.Add(); } inline PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* UninterpretedOption::add_name() { // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name) - return name_.Add(); + return _internal_add_name(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >& UninterpretedOption::name() const { @@ -11952,7 +12961,8 @@ UninterpretedOption::name() const { // optional string identifier_value = 3; inline bool UninterpretedOption::_internal_has_identifier_value() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool UninterpretedOption::has_identifier_value() const { return _internal_has_identifier_value(); @@ -12044,7 +13054,8 @@ inline void UninterpretedOption::unsafe_arena_set_allocated_identifier_value( // optional uint64 positive_int_value = 4; inline bool UninterpretedOption::_internal_has_positive_int_value() const { - return (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; } inline bool UninterpretedOption::has_positive_int_value() const { return _internal_has_positive_int_value(); @@ -12053,19 +13064,26 @@ inline void UninterpretedOption::clear_positive_int_value() { positive_int_value_ = PROTOBUF_ULONGLONG(0); _has_bits_[0] &= ~0x00000008u; } +inline ::PROTOBUF_NAMESPACE_ID::uint64 UninterpretedOption::_internal_positive_int_value() const { + return positive_int_value_; +} inline ::PROTOBUF_NAMESPACE_ID::uint64 UninterpretedOption::positive_int_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.positive_int_value) - return positive_int_value_; + return _internal_positive_int_value(); } -inline void UninterpretedOption::set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void UninterpretedOption::_internal_set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { _has_bits_[0] |= 0x00000008u; positive_int_value_ = value; +} +inline void UninterpretedOption::set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { + _internal_set_positive_int_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.positive_int_value) } // optional int64 negative_int_value = 5; inline bool UninterpretedOption::_internal_has_negative_int_value() const { - return (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; } inline bool UninterpretedOption::has_negative_int_value() const { return _internal_has_negative_int_value(); @@ -12074,19 +13092,26 @@ inline void UninterpretedOption::clear_negative_int_value() { negative_int_value_ = PROTOBUF_LONGLONG(0); _has_bits_[0] &= ~0x00000010u; } +inline ::PROTOBUF_NAMESPACE_ID::int64 UninterpretedOption::_internal_negative_int_value() const { + return negative_int_value_; +} inline ::PROTOBUF_NAMESPACE_ID::int64 UninterpretedOption::negative_int_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.negative_int_value) - return negative_int_value_; + return _internal_negative_int_value(); } -inline void UninterpretedOption::set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void UninterpretedOption::_internal_set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value) { _has_bits_[0] |= 0x00000010u; negative_int_value_ = value; +} +inline void UninterpretedOption::set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_negative_int_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.negative_int_value) } // optional double double_value = 6; inline bool UninterpretedOption::_internal_has_double_value() const { - return (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; } inline bool UninterpretedOption::has_double_value() const { return _internal_has_double_value(); @@ -12095,19 +13120,26 @@ inline void UninterpretedOption::clear_double_value() { double_value_ = 0; _has_bits_[0] &= ~0x00000020u; } +inline double UninterpretedOption::_internal_double_value() const { + return double_value_; +} inline double UninterpretedOption::double_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.double_value) - return double_value_; + return _internal_double_value(); } -inline void UninterpretedOption::set_double_value(double value) { +inline void UninterpretedOption::_internal_set_double_value(double value) { _has_bits_[0] |= 0x00000020u; double_value_ = value; +} +inline void UninterpretedOption::set_double_value(double value) { + _internal_set_double_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.double_value) } // optional bytes string_value = 7; inline bool UninterpretedOption::_internal_has_string_value() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool UninterpretedOption::has_string_value() const { return _internal_has_string_value(); @@ -12199,7 +13231,8 @@ inline void UninterpretedOption::unsafe_arena_set_allocated_string_value( // optional string aggregate_value = 8; inline bool UninterpretedOption::_internal_has_aggregate_value() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool UninterpretedOption::has_aggregate_value() const { return _internal_has_aggregate_value(); @@ -12294,68 +13327,103 @@ inline void UninterpretedOption::unsafe_arena_set_allocated_aggregate_value( // SourceCodeInfo_Location // repeated int32 path = 1 [packed = true]; -inline int SourceCodeInfo_Location::path_size() const { +inline int SourceCodeInfo_Location::_internal_path_size() const { return path_.size(); } +inline int SourceCodeInfo_Location::path_size() const { + return _internal_path_size(); +} inline void SourceCodeInfo_Location::clear_path() { path_.Clear(); } +inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::_internal_path(int index) const { + return path_.Get(index); +} inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::path(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.path) - return path_.Get(index); + return _internal_path(index); } inline void SourceCodeInfo_Location::set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { path_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.path) } -inline void SourceCodeInfo_Location::add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void SourceCodeInfo_Location::_internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { path_.Add(value); +} +inline void SourceCodeInfo_Location::add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_path(value); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.path) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +SourceCodeInfo_Location::_internal_path() const { + return path_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& SourceCodeInfo_Location::path() const { // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.path) - return path_; + return _internal_path(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +SourceCodeInfo_Location::_internal_mutable_path() { + return &path_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* SourceCodeInfo_Location::mutable_path() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.path) - return &path_; + return _internal_mutable_path(); } // repeated int32 span = 2 [packed = true]; -inline int SourceCodeInfo_Location::span_size() const { +inline int SourceCodeInfo_Location::_internal_span_size() const { return span_.size(); } +inline int SourceCodeInfo_Location::span_size() const { + return _internal_span_size(); +} inline void SourceCodeInfo_Location::clear_span() { span_.Clear(); } +inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::_internal_span(int index) const { + return span_.Get(index); +} inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::span(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.span) - return span_.Get(index); + return _internal_span(index); } inline void SourceCodeInfo_Location::set_span(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { span_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.span) } -inline void SourceCodeInfo_Location::add_span(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void SourceCodeInfo_Location::_internal_add_span(::PROTOBUF_NAMESPACE_ID::int32 value) { span_.Add(value); +} +inline void SourceCodeInfo_Location::add_span(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_span(value); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.span) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +SourceCodeInfo_Location::_internal_span() const { + return span_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& SourceCodeInfo_Location::span() const { // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.span) - return span_; + return _internal_span(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +SourceCodeInfo_Location::_internal_mutable_span() { + return &span_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* SourceCodeInfo_Location::mutable_span() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.span) - return &span_; + return _internal_mutable_span(); } // optional string leading_comments = 3; inline bool SourceCodeInfo_Location::_internal_has_leading_comments() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool SourceCodeInfo_Location::has_leading_comments() const { return _internal_has_leading_comments(); @@ -12447,7 +13515,8 @@ inline void SourceCodeInfo_Location::unsafe_arena_set_allocated_leading_comments // optional string trailing_comments = 4; inline bool SourceCodeInfo_Location::_internal_has_trailing_comments() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool SourceCodeInfo_Location::has_trailing_comments() const { return _internal_has_trailing_comments(); @@ -12538,9 +13607,12 @@ inline void SourceCodeInfo_Location::unsafe_arena_set_allocated_trailing_comment } // repeated string leading_detached_comments = 6; -inline int SourceCodeInfo_Location::leading_detached_comments_size() const { +inline int SourceCodeInfo_Location::_internal_leading_detached_comments_size() const { return leading_detached_comments_.size(); } +inline int SourceCodeInfo_Location::leading_detached_comments_size() const { + return _internal_leading_detached_comments_size(); +} inline void SourceCodeInfo_Location::clear_leading_detached_comments() { leading_detached_comments_.Clear(); } @@ -12548,9 +13620,12 @@ inline std::string* SourceCodeInfo_Location::add_leading_detached_comments() { // @@protoc_insertion_point(field_add_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) return _internal_add_leading_detached_comments(); } +inline const std::string& SourceCodeInfo_Location::_internal_leading_detached_comments(int index) const { + return leading_detached_comments_.Get(index); +} inline const std::string& SourceCodeInfo_Location::leading_detached_comments(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) - return leading_detached_comments_.Get(index); + return _internal_leading_detached_comments(index); } inline std::string* SourceCodeInfo_Location::mutable_leading_detached_comments(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) @@ -12610,9 +13685,12 @@ SourceCodeInfo_Location::mutable_leading_detached_comments() { // SourceCodeInfo // repeated .google.protobuf.SourceCodeInfo.Location location = 1; -inline int SourceCodeInfo::location_size() const { +inline int SourceCodeInfo::_internal_location_size() const { return location_.size(); } +inline int SourceCodeInfo::location_size() const { + return _internal_location_size(); +} inline void SourceCodeInfo::clear_location() { location_.Clear(); } @@ -12625,13 +13703,19 @@ SourceCodeInfo::mutable_location() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.location) return &location_; } +inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& SourceCodeInfo::_internal_location(int index) const { + return location_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location) - return location_.Get(index); + return _internal_location(index); +} +inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* SourceCodeInfo::_internal_add_location() { + return location_.Add(); } inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* SourceCodeInfo::add_location() { // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location) - return location_.Add(); + return _internal_add_location(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >& SourceCodeInfo::location() const { @@ -12644,38 +13728,56 @@ SourceCodeInfo::location() const { // GeneratedCodeInfo_Annotation // repeated int32 path = 1 [packed = true]; -inline int GeneratedCodeInfo_Annotation::path_size() const { +inline int GeneratedCodeInfo_Annotation::_internal_path_size() const { return path_.size(); } +inline int GeneratedCodeInfo_Annotation::path_size() const { + return _internal_path_size(); +} inline void GeneratedCodeInfo_Annotation::clear_path() { path_.Clear(); } +inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_path(int index) const { + return path_.Get(index); +} inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::path(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path) - return path_.Get(index); + return _internal_path(index); } inline void GeneratedCodeInfo_Annotation::set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { path_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path) } -inline void GeneratedCodeInfo_Annotation::add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::_internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { path_.Add(value); +} +inline void GeneratedCodeInfo_Annotation::add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_path(value); // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +GeneratedCodeInfo_Annotation::_internal_path() const { + return path_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& GeneratedCodeInfo_Annotation::path() const { // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path) - return path_; + return _internal_path(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +GeneratedCodeInfo_Annotation::_internal_mutable_path() { + return &path_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* GeneratedCodeInfo_Annotation::mutable_path() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path) - return &path_; + return _internal_mutable_path(); } // optional string source_file = 2; inline bool GeneratedCodeInfo_Annotation::_internal_has_source_file() const { - return (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; } inline bool GeneratedCodeInfo_Annotation::has_source_file() const { return _internal_has_source_file(); @@ -12767,7 +13869,8 @@ inline void GeneratedCodeInfo_Annotation::unsafe_arena_set_allocated_source_file // optional int32 begin = 3; inline bool GeneratedCodeInfo_Annotation::_internal_has_begin() const { - return (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; } inline bool GeneratedCodeInfo_Annotation::has_begin() const { return _internal_has_begin(); @@ -12776,19 +13879,26 @@ inline void GeneratedCodeInfo_Annotation::clear_begin() { begin_ = 0; _has_bits_[0] &= ~0x00000002u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_begin() const { + return begin_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::begin() const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin) - return begin_; + return _internal_begin(); } -inline void GeneratedCodeInfo_Annotation::set_begin(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::_internal_set_begin(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000002u; begin_ = value; +} +inline void GeneratedCodeInfo_Annotation::set_begin(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_begin(value); // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin) } // optional int32 end = 4; inline bool GeneratedCodeInfo_Annotation::_internal_has_end() const { - return (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; } inline bool GeneratedCodeInfo_Annotation::has_end() const { return _internal_has_end(); @@ -12797,13 +13907,19 @@ inline void GeneratedCodeInfo_Annotation::clear_end() { end_ = 0; _has_bits_[0] &= ~0x00000004u; } +inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_end() const { + return end_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::end() const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end) - return end_; + return _internal_end(); } -inline void GeneratedCodeInfo_Annotation::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { _has_bits_[0] |= 0x00000004u; end_ = value; +} +inline void GeneratedCodeInfo_Annotation::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_end(value); // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end) } @@ -12812,9 +13928,12 @@ inline void GeneratedCodeInfo_Annotation::set_end(::PROTOBUF_NAMESPACE_ID::int32 // GeneratedCodeInfo // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; -inline int GeneratedCodeInfo::annotation_size() const { +inline int GeneratedCodeInfo::_internal_annotation_size() const { return annotation_.size(); } +inline int GeneratedCodeInfo::annotation_size() const { + return _internal_annotation_size(); +} inline void GeneratedCodeInfo::clear_annotation() { annotation_.Clear(); } @@ -12827,13 +13946,19 @@ GeneratedCodeInfo::mutable_annotation() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation) return &annotation_; } +inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::_internal_annotation(int index) const { + return annotation_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Get(index); + return _internal_annotation(index); +} +inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::_internal_add_annotation() { + return annotation_.Add(); } inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() { // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Add(); + return _internal_add_annotation(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >& GeneratedCodeInfo::annotation() const { diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index b315f26e8a..94e631daa1 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -42,6 +42,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -51,15 +55,10 @@ #include #include #include -#include - -#include -#include -#include -#include #include #include #include +#include #include @@ -3477,7 +3476,12 @@ TEST(CustomOptions, UnusedImportWarning) { MockErrorCollector error_collector; EXPECT_TRUE(pool.BuildFileCollectingErrors(file_proto, &error_collector)); - EXPECT_EQ("", error_collector.warning_text_); + EXPECT_EQ( + "custom_options_import.proto: " + "google/protobuf/unittest_custom_options.proto: IMPORT: Import " + "google/protobuf/unittest_custom_options.proto but not used.\n", + error_collector.warning_text_); + EXPECT_EQ("", error_collector.text_); } // Verifies that proto files can correctly be parsed, even if the diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index c029235ac4..d1de03e129 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -153,7 +153,6 @@ void Duration::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -195,63 +194,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Duration::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Duration) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // int64 seconds = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( - input, &seconds_))); - } else { - goto handle_unusual; - } - break; - } - - // int32 nanos = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &nanos_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Duration) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Duration) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Duration::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -262,13 +204,13 @@ failure: // int64 seconds = 1; if (this->seconds() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->seconds(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_seconds(), target); } // int32 nanos = 2; if (this->nanos() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->nanos(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_nanos(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -291,14 +233,14 @@ size_t Duration::ByteSizeLong() const { if (this->seconds() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->seconds()); + this->_internal_seconds()); } // int32 nanos = 2; if (this->nanos() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->nanos()); + this->_internal_nanos()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -333,10 +275,10 @@ void Duration::MergeFrom(const Duration& from) { (void) cached_has_bits; if (from.seconds() != 0) { - set_seconds(from.seconds()); + _internal_set_seconds(from._internal_seconds()); } if (from.nanos() != 0) { - set_nanos(from.nanos()); + _internal_set_nanos(from._internal_nanos()); } } diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index eb57be3414..414b4284a3 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -150,12 +150,7 @@ class PROTOBUF_EXPORT Duration : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -204,11 +199,19 @@ class PROTOBUF_EXPORT Duration : void clear_seconds(); ::PROTOBUF_NAMESPACE_ID::int64 seconds() const; void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_seconds() const; + void _internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value); + public: // int32 nanos = 2; void clear_nanos(); ::PROTOBUF_NAMESPACE_ID::int32 nanos() const; void set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_nanos() const; + void _internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Duration) private: @@ -238,13 +241,19 @@ class PROTOBUF_EXPORT Duration : inline void Duration::clear_seconds() { seconds_ = PROTOBUF_LONGLONG(0); } +inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::_internal_seconds() const { + return seconds_; +} inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::seconds() const { // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds) - return seconds_; + return _internal_seconds(); } -inline void Duration::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Duration::_internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { seconds_ = value; +} +inline void Duration::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_seconds(value); // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds) } @@ -252,13 +261,19 @@ inline void Duration::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { inline void Duration::clear_nanos() { nanos_ = 0; } +inline ::PROTOBUF_NAMESPACE_ID::int32 Duration::_internal_nanos() const { + return nanos_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 Duration::nanos() const { // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos) - return nanos_; + return _internal_nanos(); } -inline void Duration::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Duration::_internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { nanos_ = value; +} +inline void Duration::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_nanos(value); // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos) } diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc index a919ce0bca..2beb8b72b8 100644 --- a/src/google/protobuf/empty.pb.cc +++ b/src/google/protobuf/empty.pb.cc @@ -141,7 +141,6 @@ void Empty::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Empty::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -168,32 +167,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Empty::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Empty) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Empty) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Empty) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Empty::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 9768a4c225..055b0763f9 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -150,12 +150,7 @@ class PROTOBUF_EXPORT Empty : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc index 8342482b38..67213fc98e 100644 --- a/src/google/protobuf/extension_set.cc +++ b/src/google/protobuf/extension_set.cc @@ -1196,7 +1196,6 @@ bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, } } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* ExtensionSet::ParseField( uint64 tag, const char* ptr, const MessageLite* containing_type, internal::InternalMetadataWithArenaLite* metadata, @@ -1220,8 +1219,6 @@ const char* ExtensionSet::ParseMessageSetItem( return ParseMessageSetItemTmpl(ptr, containing_type, metadata, ctx); } -#endif - bool ExtensionSet::ParseFieldWithExtensionInfo(int number, bool was_packed_on_wire, const ExtensionInfo& extension, diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h index 328347d094..baf54c3182 100644 --- a/src/google/protobuf/extension_set.h +++ b/src/google/protobuf/extension_set.h @@ -146,7 +146,7 @@ class PROTOBUF_EXPORT GeneratedExtensionFinder : public ExtensionFinder { public: GeneratedExtensionFinder(const MessageLite* containing_type) : containing_type_(containing_type) {} - virtual ~GeneratedExtensionFinder() {} + ~GeneratedExtensionFinder() override {} // Returns true and fills in *output if found, otherwise returns false. bool Find(int number, ExtensionInfo* output) override; @@ -394,7 +394,6 @@ class PROTOBUF_EXPORT ExtensionSet { const MessageLite* containing_type, io::CodedOutputStream* unknown_fields); -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER // Lite parser const char* ParseField(uint64 tag, const char* ptr, const MessageLite* containing_type, @@ -434,7 +433,6 @@ class PROTOBUF_EXPORT ExtensionSet { } return ptr; } -#endif // Parse an entire message in MessageSet format. Such messages have no // fields, only extensions. @@ -541,9 +539,7 @@ class PROTOBUF_EXPORT ExtensionSet { virtual bool ReadMessage(const MessageLite& prototype, io::CodedInputStream* input) = 0; -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER virtual const char* _InternalParse(const char* ptr, ParseContext* ctx) = 0; -#endif virtual uint8* WriteMessageToArray( int number, uint8* target, io::EpsCopyOutputStream* stream) const = 0; @@ -762,7 +758,6 @@ class PROTOBUF_EXPORT ExtensionSet { ExtensionFinder* extension_finder, MessageSetFieldSkipper* field_skipper); -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool FindExtension(int wire_type, uint32 field, const MessageLite* containing_type, const internal::ParseContext* ctx, @@ -807,7 +802,6 @@ class PROTOBUF_EXPORT ExtensionSet { const Msg* containing_type, Metadata* metadata, internal::ParseContext* ctx); -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER // Hack: RepeatedPtrFieldBase declares ExtensionSet as a friend. This // friendship should automatically extend to ExtensionSet::Extension, but @@ -1583,8 +1577,7 @@ template & extension) { - const void* volatile unused = &extension; - (void)&unused; // Use address to avoid an extra load of volatile variable. + internal::StrongReference(extension); } } // namespace protobuf diff --git a/src/google/protobuf/extension_set_heavy.cc b/src/google/protobuf/extension_set_heavy.cc index 36cedd0f90..9b7ee4d0a4 100644 --- a/src/google/protobuf/extension_set_heavy.cc +++ b/src/google/protobuf/extension_set_heavy.cc @@ -318,7 +318,6 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool ExtensionSet::FindExtension(int wire_type, uint32 field, const Message* containing_type, const internal::ParseContext* ctx, @@ -370,8 +369,6 @@ const char* ExtensionSet::ParseMessageSetItem( return ParseMessageSetItemTmpl(ptr, containing_type, metadata, ctx); } -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, const Message* containing_type, UnknownFieldSet* unknown_fields) { diff --git a/src/google/protobuf/extension_set_inl.h b/src/google/protobuf/extension_set_inl.h index ec6efee39c..087a3a442c 100644 --- a/src/google/protobuf/extension_set_inl.h +++ b/src/google/protobuf/extension_set_inl.h @@ -38,7 +38,6 @@ namespace google { namespace protobuf { namespace internal { -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER template const char* ExtensionSet::ParseFieldWithExtensionInfo( int number, bool was_packed_on_wire, const ExtensionInfo& extension, @@ -267,7 +266,6 @@ const char* ExtensionSet::ParseMessageSetItemTmpl(const char* ptr, } return ptr; } -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER } // namespace internal } // namespace protobuf diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index 9c83c8cb87..81c9ec4607 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -147,7 +147,6 @@ void FieldMask::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* FieldMask::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -187,53 +186,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool FieldMask::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.FieldMask) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated string paths = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_add_paths())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - paths_.Get(paths_.size() - 1).data(), - static_cast(paths_.Get(paths_.size() - 1).length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.FieldMask.paths")); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.FieldMask) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.FieldMask) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* FieldMask::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -242,9 +194,8 @@ failure: (void) cached_has_bits; // repeated string paths = 1; - for (auto it = paths_.pointer_begin(), - end = paths_.pointer_end(); it < end; ++it) { - const auto& s = **it; + for (int i = 0, n = this->_internal_paths_size(); i < n; i++) { + const auto& s = this->_internal_paths(i); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( s.data(), static_cast(s.length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index becad8618d..ac0e2c229e 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -150,12 +150,7 @@ class PROTOBUF_EXPORT FieldMask : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -201,6 +196,9 @@ class PROTOBUF_EXPORT FieldMask : }; // repeated string paths = 1; int paths_size() const; + private: + int _internal_paths_size() const; + public: void clear_paths(); const std::string& paths(int index) const; std::string* mutable_paths(int index); @@ -216,6 +214,7 @@ class PROTOBUF_EXPORT FieldMask : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& paths() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_paths(); private: + const std::string& _internal_paths(int index) const; std::string* _internal_add_paths(); public: @@ -243,9 +242,12 @@ class PROTOBUF_EXPORT FieldMask : // FieldMask // repeated string paths = 1; -inline int FieldMask::paths_size() const { +inline int FieldMask::_internal_paths_size() const { return paths_.size(); } +inline int FieldMask::paths_size() const { + return _internal_paths_size(); +} inline void FieldMask::clear_paths() { paths_.Clear(); } @@ -253,9 +255,12 @@ inline std::string* FieldMask::add_paths() { // @@protoc_insertion_point(field_add_mutable:google.protobuf.FieldMask.paths) return _internal_add_paths(); } +inline const std::string& FieldMask::_internal_paths(int index) const { + return paths_.Get(index); +} inline const std::string& FieldMask::paths(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FieldMask.paths) - return paths_.Get(index); + return _internal_paths(index); } inline std::string* FieldMask::mutable_paths(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FieldMask.paths) diff --git a/src/google/protobuf/has_bits.h b/src/google/protobuf/has_bits.h index 11afde7193..540cac282f 100644 --- a/src/google/protobuf/has_bits.h +++ b/src/google/protobuf/has_bits.h @@ -70,7 +70,7 @@ class HasBits { } void Or(const HasBits& rhs) { - for (int i = 0; i < doublewords; i++) has_bits_[i] |= rhs[i]; + for (size_t i = 0; i < doublewords; i++) has_bits_[i] |= rhs[i]; } bool empty() const; diff --git a/src/google/protobuf/implicit_weak_message.cc b/src/google/protobuf/implicit_weak_message.cc index 35e64f0758..539061693c 100644 --- a/src/google/protobuf/implicit_weak_message.cc +++ b/src/google/protobuf/implicit_weak_message.cc @@ -41,19 +41,10 @@ namespace google { namespace protobuf { namespace internal { -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* ImplicitWeakMessage::_InternalParse(const char* ptr, ParseContext* ctx) { return ctx->AppendString(ptr, &data_); } -#else -bool ImplicitWeakMessage::MergePartialFromCodedStream( - io::CodedInputStream* input) { - io::StringOutputStream string_stream(&data_); - io::CodedOutputStream coded_stream(&string_stream, false); - return WireFormatLite::SkipMessage(input, &coded_stream); -} -#endif ExplicitlyConstructed implicit_weak_message_default_instance; diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h index 10d430cd07..e8f1959a25 100644 --- a/src/google/protobuf/implicit_weak_message.h +++ b/src/google/protobuf/implicit_weak_message.h @@ -78,11 +78,7 @@ class PROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite { data_.append(static_cast(other).data_); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ParseContext* ctx) final; -#else - bool MergePartialFromCodedStream(io::CodedInputStream* input) override; -#endif size_t ByteSizeLong() const override { return data_.size(); } diff --git a/src/google/protobuf/inlined_string_field.h b/src/google/protobuf/inlined_string_field.h index 781059dae7..991c0e1f3f 100644 --- a/src/google/protobuf/inlined_string_field.h +++ b/src/google/protobuf/inlined_string_field.h @@ -35,8 +35,9 @@ #include #include -#include +#include +// Must be included last. #include #ifdef SWIG diff --git a/src/google/protobuf/io/io_win32.cc b/src/google/protobuf/io/io_win32.cc index dcbdde4f36..d22ceac773 100755 --- a/src/google/protobuf/io/io_win32.cc +++ b/src/google/protobuf/io/io_win32.cc @@ -392,8 +392,8 @@ ExpandWildcardsResult ExpandWildcards( ExpandWildcardsResult matched = ExpandWildcardsResult::kErrorNoMatchingFile; do { // Ignore ".", "..", and directories. - if ((metadata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 - && kDot != metadata.cFileName && kDotDot != metadata.cFileName) { + if ((metadata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 && + kDot != metadata.cFileName && kDotDot != metadata.cFileName) { matched = ExpandWildcardsResult::kSuccess; string filename; if (!strings::wcs_to_utf8(metadata.cFileName, &filename)) { diff --git a/src/google/protobuf/io/io_win32.h b/src/google/protobuf/io/io_win32.h index 2463544ba0..7d11dc2b31 100755 --- a/src/google/protobuf/io/io_win32.h +++ b/src/google/protobuf/io/io_win32.h @@ -53,7 +53,6 @@ #include #include - #include // Compilers on Windows other than MSVC (e.g. Cygwin, MinGW32) define the @@ -92,7 +91,7 @@ enum class ExpandWildcardsResult { // `consume`. The resulting paths may not be absolute nor normalized. // // The function returns a value from `ExpandWildcardsResult`. -LIBPROTOBUF_EXPORT ExpandWildcardsResult ExpandWildcards( +PROTOBUF_EXPORT ExpandWildcardsResult ExpandWildcards( const std::string& path, std::function consume); namespace strings { diff --git a/src/google/protobuf/io/io_win32_unittest.cc b/src/google/protobuf/io/io_win32_unittest.cc index 09812a15df..f0ca47cfe7 100755 --- a/src/google/protobuf/io/io_win32_unittest.cc +++ b/src/google/protobuf/io/io_win32_unittest.cc @@ -430,18 +430,17 @@ TEST_F(IoWin32Test, ExpandWildcardsInRelativePathTest) { int found_b = 0; vector found_bad; // Assert matching a relative path pattern. Results should also be relative. - ExpandWildcardsResult result = - ExpandWildcards( - string(kUtf8Text) + "\\foo*.proto", - [&found_a, &found_b, &found_bad](const string& p) { - if (p == string(kUtf8Text) + "\\foo_a.proto") { - found_a++; - } else if (p == string(kUtf8Text) + "\\foo_b.proto") { - found_b++; - } else { - found_bad.push_back(p); - } - }); + ExpandWildcardsResult result = + ExpandWildcards(string(kUtf8Text) + "\\foo*.proto", + [&found_a, &found_b, &found_bad](const string& p) { + if (p == string(kUtf8Text) + "\\foo_a.proto") { + found_a++; + } else if (p == string(kUtf8Text) + "\\foo_b.proto") { + found_b++; + } else { + found_bad.push_back(p); + } + }); EXPECT_EQ(result, ExpandWildcardsResult::kSuccess); EXPECT_EQ(found_a, 1); EXPECT_EQ(found_b, 1); @@ -452,16 +451,14 @@ TEST_F(IoWin32Test, ExpandWildcardsInRelativePathTest) { // Assert matching the exact filename. found_a = 0; found_bad.clear(); - result = - ExpandWildcards( - string(kUtf8Text) + "\\foo_a.proto", - [&found_a, &found_bad](const string& p) { - if (p == string(kUtf8Text) + "\\foo_a.proto") { - found_a++; - } else { - found_bad.push_back(p); - } - }); + result = ExpandWildcards(string(kUtf8Text) + "\\foo_a.proto", + [&found_a, &found_bad](const string& p) { + if (p == string(kUtf8Text) + "\\foo_a.proto") { + found_a++; + } else { + found_bad.push_back(p); + } + }); EXPECT_EQ(result, ExpandWildcardsResult::kSuccess); EXPECT_EQ(found_a, 1); if (!found_bad.empty()) { @@ -482,24 +479,19 @@ TEST_F(IoWin32Test, ExpandWildcardsInAbsolutePathTest) { vector found_bad; // Assert matching an absolute path. The results should also use absolute // path. - ExpandWildcardsResult result = - ExpandWildcards( - string(test_tmpdir) + "\\" + kUtf8Text + "\\foo*.proto", - [this, &found_a, &found_b, &found_bad](const string& p) { - if (p == string(this->test_tmpdir) - + "\\" - + kUtf8Text - + "\\foo_a.proto") { - found_a++; - } else if (p == string(this->test_tmpdir) - + "\\" - + kUtf8Text - + "\\foo_b.proto") { - found_b++; - } else { - found_bad.push_back(p); - } - }); + ExpandWildcardsResult result = + ExpandWildcards(string(test_tmpdir) + "\\" + kUtf8Text + "\\foo*.proto", + [this, &found_a, &found_b, &found_bad](const string& p) { + if (p == string(this->test_tmpdir) + "\\" + kUtf8Text + + "\\foo_a.proto") { + found_a++; + } else if (p == string(this->test_tmpdir) + "\\" + + kUtf8Text + "\\foo_b.proto") { + found_b++; + } else { + found_bad.push_back(p); + } + }); EXPECT_EQ(result, ExpandWildcardsResult::kSuccess); EXPECT_EQ(found_a, 1); EXPECT_EQ(found_b, 1); @@ -510,19 +502,16 @@ TEST_F(IoWin32Test, ExpandWildcardsInAbsolutePathTest) { // Assert matching the exact filename. found_a = 0; found_bad.clear(); - result = - ExpandWildcards( - string(test_tmpdir) + "\\" + kUtf8Text + "\\foo_a.proto", - [this, &found_a, &found_bad](const string& p) { - if (p == string(this->test_tmpdir) - + "\\" - + kUtf8Text - + "\\foo_a.proto") { - found_a++; - } else { - found_bad.push_back(p); - } - }); + result = + ExpandWildcards(string(test_tmpdir) + "\\" + kUtf8Text + "\\foo_a.proto", + [this, &found_a, &found_bad](const string& p) { + if (p == string(this->test_tmpdir) + "\\" + kUtf8Text + + "\\foo_a.proto") { + found_a++; + } else { + found_bad.push_back(p); + } + }); EXPECT_EQ(result, ExpandWildcardsResult::kSuccess); EXPECT_EQ(found_a, 1); if (!found_bad.empty()) { @@ -535,7 +524,8 @@ TEST_F(IoWin32Test, ExpandWildcardsIgnoresDirectoriesTest) { EXPECT_TRUE(CreateDirectoryW(wNonAscii.c_str(), nullptr)); // Create mock files we will test pattern matching on. EXPECT_TRUE(CreateEmptyFile(wNonAscii + L"\\foo_a.proto")); - EXPECT_TRUE(CreateDirectoryW((wNonAscii + L"\\foo_b.proto").c_str(), nullptr)); + EXPECT_TRUE( + CreateDirectoryW((wNonAscii + L"\\foo_b.proto").c_str(), nullptr)); EXPECT_TRUE(CreateEmptyFile(wNonAscii + L"\\foo_c.proto")); // `cd` into `wtest_tmpdir`. EXPECT_TRUE(SetCurrentDirectoryW(wtest_tmpdir.c_str())); @@ -545,18 +535,17 @@ TEST_F(IoWin32Test, ExpandWildcardsIgnoresDirectoriesTest) { vector found_bad; // Assert that the pattern matches exactly the expected files, and using the // absolute path as did the input pattern. - ExpandWildcardsResult result = - ExpandWildcards( - string(kUtf8Text) + "\\foo*.proto", - [&found_a, &found_c, &found_bad](const string& p) { - if (p == string(kUtf8Text) + "\\foo_a.proto") { - found_a++; - } else if (p == string(kUtf8Text) + "\\foo_c.proto") { - found_c++; - } else { - found_bad.push_back(p); - } - }); + ExpandWildcardsResult result = + ExpandWildcards(string(kUtf8Text) + "\\foo*.proto", + [&found_a, &found_c, &found_bad](const string& p) { + if (p == string(kUtf8Text) + "\\foo_a.proto") { + found_a++; + } else if (p == string(kUtf8Text) + "\\foo_c.proto") { + found_c++; + } else { + found_bad.push_back(p); + } + }); EXPECT_EQ(result, ExpandWildcardsResult::kSuccess); EXPECT_EQ(found_a, 1); EXPECT_EQ(found_c, 1); @@ -574,18 +563,18 @@ TEST_F(IoWin32Test, ExpandWildcardsFailsIfNoFileMatchesTest) { EXPECT_TRUE(SetCurrentDirectoryW(wtest_tmpdir.c_str())); // Control test: should match foo*.proto - ExpandWildcardsResult result = ExpandWildcards( - string(kUtf8Text) + "\\foo*.proto", [](const string&) {}); + ExpandWildcardsResult result = + ExpandWildcards(string(kUtf8Text) + "\\foo*.proto", [](const string&) {}); EXPECT_EQ(result, ExpandWildcardsResult::kSuccess); // Control test: should match foo_a.proto - result = ExpandWildcards( - string(kUtf8Text) + "\\foo_a.proto", [](const string&) {}); + result = ExpandWildcards(string(kUtf8Text) + "\\foo_a.proto", + [](const string&) {}); EXPECT_EQ(result, ExpandWildcardsResult::kSuccess); // Actual test: should not match anything. - result = ExpandWildcards( - string(kUtf8Text) + "\\bar*.proto", [](const string&) {}); + result = + ExpandWildcards(string(kUtf8Text) + "\\bar*.proto", [](const string&) {}); ASSERT_EQ(result, ExpandWildcardsResult::kErrorNoMatchingFile); } diff --git a/src/google/protobuf/lite_unittest.cc b/src/google/protobuf/lite_unittest.cc index ccaea13c33..cd5ccc4eab 100644 --- a/src/google/protobuf/lite_unittest.cc +++ b/src/google/protobuf/lite_unittest.cc @@ -1062,11 +1062,9 @@ TEST(Lite, CorrectEnding) { // for non-group messages (like TestAllTypesLite) which made it not accept // end-group. This is not a real big deal, but I think going forward its // good to have all parse loops behave 'exactly' the same. -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER EXPECT_TRUE(msg.MergePartialFromCodedStream(&cis)); EXPECT_FALSE(cis.ConsumedEntireMessage()); EXPECT_TRUE(cis.LastTagWas(132)); -#endif } { // This is an incomplete end-group tag. This should be a genuine parse @@ -1076,9 +1074,7 @@ TEST(Lite, CorrectEnding) { // Unfortunately the old parser detects a parse error in ReadTag and returns // 0 (as it states 0 is an invalid tag). However 0 is not an invalid tag // as it can be used to terminate the stream, so this returns true. -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER EXPECT_FALSE(msg.MergePartialFromCodedStream(&cis)); -#endif } } diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h index e2d6756c20..947bdb7f9c 100644 --- a/src/google/protobuf/map_entry_lite.h +++ b/src/google/protobuf/map_entry_lite.h @@ -234,7 +234,6 @@ class MapEntryImpl : public Base { MergeFromInternal(*::google::protobuf::internal::DownCast(&other)); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ParseContext* ctx) final { while (!ctx->Done(&ptr)) { uint32 tag; @@ -262,47 +261,6 @@ class MapEntryImpl : public Base { } return ptr; } -#else - bool MergePartialFromCodedStream(io::CodedInputStream* input) override { - uint32 tag; - - for (;;) { - // 1) corrupted data: return false; - // 2) unknown field: skip without putting into unknown field set; - // 3) unknown enum value: keep it in parsing. In proto2, caller should - // check the value and put this entry into containing message's unknown - // field set if the value is an unknown enum. In proto3, caller doesn't - // need to care whether the value is unknown enum; - // 4) missing key/value: missed key/value will have default value. caller - // should take this entry as if key/value is set to default value. - tag = input->ReadTagNoLastTag(); - switch (tag) { - case kKeyTag: - if (!KeyTypeHandler::Read(input, mutable_key())) { - return false; - } - set_has_key(); - break; - - case kValueTag: - if (!ValueTypeHandler::Read(input, mutable_value())) { - return false; - } - set_has_value(); - if (input->ExpectAtEnd()) return true; - break; - - default: - if (tag == 0 || WireFormatLite::GetTagWireType(tag) == - WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - if (!WireFormatLite::SkipField(input, tag)) return false; - break; - } - } - } -#endif size_t ByteSizeLong() const override { size_t size = 0; diff --git a/src/google/protobuf/map_field_lite.h b/src/google/protobuf/map_field_lite.h index 180a788454..91b098d654 100644 --- a/src/google/protobuf/map_field_lite.h +++ b/src/google/protobuf/map_field_lite.h @@ -63,11 +63,9 @@ class MapFieldLite { typedef Map MapType; typedef EntryType EntryTypeTrait; - MapFieldLite() : arena_(NULL) { SetDefaultEnumValue(); } + MapFieldLite() { SetDefaultEnumValue(); } - explicit MapFieldLite(Arena* arena) : arena_(arena), map_(arena) { - SetDefaultEnumValue(); - } + explicit MapFieldLite(Arena* arena) : map_(arena) { SetDefaultEnumValue(); } // Accessors const Map& GetMap() const { return map_; } @@ -92,21 +90,17 @@ class MapFieldLite { // Used in the implementation of parsing. Caller should take the ownership iff // arena_ is NULL. EntryType* NewEntry() const { - if (arena_ == NULL) { - return new EntryType(); - } else { - return Arena::CreateMessage(arena_); - } + return Arena::CreateMessage(map_.arena_); } // Used in the implementation of serializing enum value type. Caller should // take the ownership iff arena_ is NULL. EntryType* NewEnumEntryWrapper(const Key& key, const T t) const { - return EntryType::EnumWrap(key, t, arena_); + return EntryType::EnumWrap(key, t, map_.arena_); } // Used in the implementation of serializing other value types. Caller should // take the ownership iff arena_ is NULL. EntryType* NewEntryWrapper(const Key& key, const T& t) const { - return EntryType::Wrap(key, t, arena_); + return EntryType::Wrap(key, t, map_.arena_); } const char* _InternalParse(const char* ptr, ParseContext* ctx) { @@ -126,7 +120,6 @@ class MapFieldLite { private: typedef void DestructorSkippable_; - Arena* arena_; Map map_; friend class ::PROTOBUF_NAMESPACE_ID::Arena; diff --git a/src/google/protobuf/map_test.cc b/src/google/protobuf/map_test.cc index 99a7f67411..33c6321319 100644 --- a/src/google/protobuf/map_test.cc +++ b/src/google/protobuf/map_test.cc @@ -71,11 +71,11 @@ #include #include #include -#include #include #include #include #include +#include #include @@ -1832,6 +1832,16 @@ TEST_F(MapFieldReflectionTest, MapSizeWithDuplicatedKey) { } } +TEST_F(MapFieldReflectionTest, UninitializedEntry) { + unittest::TestRequiredMessageMap message; + const Reflection* reflection = message.GetReflection(); + const FieldDescriptor* field = + message.GetDescriptor()->FindFieldByName("map_field"); + auto entry = reflection->AddMessage(&message, field); + EXPECT_FALSE(entry->IsInitialized()); + EXPECT_FALSE(message.IsInitialized()); +} + // Generated Message Test =========================================== TEST(GeneratedMapFieldTest, Accessors) { @@ -2292,11 +2302,9 @@ TEST(GeneratedMapFieldTest, KeysValuesUnknownsWireFormat) { if (is_value) expected_value = static_cast(c); bool res = message.ParseFromString(wire_format); bool expect_success = true; -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER // Unfortunately the old map parser accepts malformed input, the new // parser accepts only correct input. if (j != items - 1) expect_success = false; -#endif if (expect_success) { ASSERT_TRUE(res); ASSERT_EQ(1, message.map_int32_int32().size()); diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h index 71ab6417af..f2f384f923 100644 --- a/src/google/protobuf/map_type_handler.h +++ b/src/google/protobuf/map_type_handler.h @@ -510,7 +510,7 @@ inline const char* ReadSFIXED32(const char* ptr, int32* value) { template \ const char* MapTypeHandler::Read( \ const char* begin, ParseContext* ctx, MapEntryAccessorType* value) { \ - (void) ctx; \ + (void)ctx; \ return Read##FieldType(begin, value); \ } @@ -615,7 +615,7 @@ MapTypeHandler::DefaultIfNotInitialized( template inline bool MapTypeHandler::IsInitialized( Type* value) { - return value->IsInitialized(); + return value ? value->IsInitialized() : false; } // Definition for string/bytes handler diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc index af1c74906e..09446eea47 100644 --- a/src/google/protobuf/message.cc +++ b/src/google/protobuf/message.cc @@ -136,13 +136,6 @@ void Message::DiscardUnknownFields() { return ReflectionOps::DiscardUnknownFields(this); } -#if !GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Message::MergePartialFromCodedStream(io::CodedInputStream* input) { - return WireFormat::ParseAndMergePartial(input, this); -} -#endif - -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER namespace internal { class ReflectionAccessor { @@ -296,7 +289,8 @@ const char* ParseLenDelim(int field_number, const FieldDescriptor* field, } enum { kNone = 0, kVerify, kStrict } utf8_level = kNone; const char* field_name = nullptr; - auto parse_string = [ptr, ctx, &utf8_level, &field_name](std::string* s) { + auto parse_string = [ptr, ctx, &utf8_level, + &field_name](std::string* s) -> const char* { switch (utf8_level) { case kNone: return internal::InlineGreedyStringParser(s, ptr, ctx); @@ -306,6 +300,8 @@ const char* ParseLenDelim(int field_number, const FieldDescriptor* field, case kStrict: return internal::InlineGreedyStringParserUTF8(s, ptr, ctx, field_name); } + GOOGLE_LOG(FATAL) << "Should not reach here"; + return nullptr; // Make compiler happy }; switch (field->type()) { case FieldDescriptor::TYPE_STRING: { @@ -524,7 +520,6 @@ const char* Message::_InternalParse(const char* ptr, ReflectiveFieldParser field_parser(this, ctx); return internal::WireFormatParser(field_parser, ptr, ctx); } -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER uint8* Message::InternalSerializeWithCachedSizesToArray( uint8* target, io::EpsCopyOutputStream* stream) const { diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 0ead26a7fc..155500e1b8 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -296,13 +296,9 @@ class PROTOBUF_EXPORT Message : public MessageLite { void Clear() override; bool IsInitialized() const override; void CheckTypeAndMergeFrom(const MessageLite& other) override; -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER // Reflective parser const char* _InternalParse(const char* ptr, internal::ParseContext* ctx) override; -#else - bool MergePartialFromCodedStream(io::CodedInputStream* input) override; -#endif size_t ByteSizeLong() const override; uint8* InternalSerializeWithCachedSizesToArray( uint8* target, io::EpsCopyOutputStream* stream) const override; @@ -1204,9 +1200,7 @@ T* DynamicCastToGenerated(Message* from) { // of loops (on x86-64 it compiles into two "mov" instructions). template void LinkMessageReflection() { - typedef const T& GetDefaultInstanceFunction(); - GetDefaultInstanceFunction* volatile unused = &T::default_instance; - (void)&unused; // Use address to avoid an extra load of volatile variable. + internal::StrongReference(T::default_instance); } // ============================================================================= diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc index 4b51affb3e..3b2901559b 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -124,8 +124,6 @@ void MessageLite::LogInitializationErrorMessage() const { namespace internal { -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - template bool MergePartialFromImpl(StringPiece input, MessageLite* msg) { const char* ptr; @@ -157,38 +155,6 @@ bool MergePartialFromImpl(BoundedZCIS input, MessageLite* msg) { return ctx.EndedAtLimit(); } -#else // !GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - -inline bool InlineMergePartialEntireStream(io::CodedInputStream* cis, - MessageLite* message, - bool aliasing) { - return message->MergePartialFromCodedStream(cis) && - cis->ConsumedEntireMessage(); -} - -template -bool MergePartialFromImpl(StringPiece input, MessageLite* msg) { - io::CodedInputStream decoder(reinterpret_cast(input.data()), - input.size()); - return InlineMergePartialEntireStream(&decoder, msg, aliasing); -} - -template -bool MergePartialFromImpl(BoundedZCIS input, MessageLite* msg) { - io::CodedInputStream decoder(input.zcis); - decoder.PushLimit(input.limit); - return InlineMergePartialEntireStream(&decoder, msg, aliasing) && - decoder.BytesUntilLimit() == 0; -} - -template -bool MergePartialFromImpl(io::ZeroCopyInputStream* input, MessageLite* msg) { - io::CodedInputStream decoder(input); - return InlineMergePartialEntireStream(&decoder, msg, aliasing); -} - -#endif // !GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - template bool MergePartialFromImpl(StringPiece input, MessageLite* msg); template bool MergePartialFromImpl(StringPiece input, @@ -210,7 +176,6 @@ MessageLite* MessageLite::New(Arena* arena) const { return message; } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER class ZeroCopyCodedInputStream : public io::ZeroCopyInputStream { public: ZeroCopyCodedInputStream(io::CodedInputStream* cis) : cis_(cis) {} @@ -252,7 +217,6 @@ bool MessageLite::MergePartialFromCodedStream(io::CodedInputStream* input) { input->SetConsumed(); return true; } -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool MessageLite::MergeFromCodedStream(io::CodedInputStream* input) { return MergePartialFromCodedStream(input) && IsInitializedWithErrors(); diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index 1da0d117c6..1ef5d23143 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -330,11 +330,7 @@ class PROTOBUF_EXPORT MessageLite { // // MergeFromCodedStream() is just implemented as MergePartialFromCodedStream() // followed by IsInitialized(). -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool MergePartialFromCodedStream(io::CodedInputStream* input); -#else - virtual bool MergePartialFromCodedStream(io::CodedInputStream* input) = 0; -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER // Merge a protocol buffer contained in a string. bool MergeFromString(const std::string& data); @@ -438,12 +434,10 @@ class PROTOBUF_EXPORT MessageLite { // method.) virtual int GetCachedSize() const = 0; -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER virtual const char* _InternalParse(const char* ptr, internal::ParseContext* ctx) { return nullptr; } -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER protected: template diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc index 93fcb5e4e5..27bb309859 100644 --- a/src/google/protobuf/message_unittest.inc +++ b/src/google/protobuf/message_unittest.inc @@ -305,7 +305,9 @@ class RepeatedInputStream : public io::ZeroCopyInputStream { return false; } - virtual int64 ByteCount() const { return total_byte_count_; } + virtual int64 ByteCount() const { + return total_byte_count_; + } private: std::string data_; diff --git a/src/google/protobuf/parse_context.cc b/src/google/protobuf/parse_context.cc index 17d645331b..1d78ee6385 100644 --- a/src/google/protobuf/parse_context.cc +++ b/src/google/protobuf/parse_context.cc @@ -119,8 +119,7 @@ const char* EpsCopyInputStream::Next(int overrun, int d) { const void* data; // ZeroCopyInputStream indicates Next may return 0 size buffers. Hence // we loop. - while (zcis_->Next(&data, &size_)) { - overall_limit_ -= size_; + while (StreamNext(&data)) { if (size_ > kSlopBytes) { // We got a large chunk std::memcpy(buffer_ + kSlopBytes, data, kSlopBytes); @@ -310,7 +309,6 @@ const char* EpsCopyInputStream::InitFrom(io::ZeroCopyInputStream* zcis) { return buffer_; } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* ParseContext::ParseMessage(MessageLite* msg, const char* ptr) { return ParseMessage(msg, ptr); } @@ -318,7 +316,6 @@ const char* ParseContext::ParseMessage(Message* msg, const char* ptr) { // Use reinterptret case to prevent inclusion of non lite header return ParseMessage(reinterpret_cast(msg), ptr); } -#endif inline void WriteVarint(uint64 val, std::string* s) { while (val >= 128) { diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h index bc7a0ad05a..f15cb35f88 100644 --- a/src/google/protobuf/parse_context.h +++ b/src/google/protobuf/parse_context.h @@ -119,7 +119,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { } else { count = size_ + static_cast(buffer_end_ - ptr); } - if (count > 0) zcis_->BackUp(count); + if (count > 0) StreamBackUp(count); } // If return value is negative it's an error @@ -193,6 +193,9 @@ class PROTOBUF_EXPORT EpsCopyInputStream { return ptr > limit_end_ && (next_chunk_ == nullptr || ptr - buffer_end_ > limit_); } + int BytesUntilLimit(const char* ptr) const { + return limit_ + static_cast(buffer_end_ - ptr); + } // Returns true if more data is available, if false is returned one has to // call Done for further checks. bool DataAvailable(const char* ptr) { return ptr < limit_end_; } @@ -273,6 +276,15 @@ class PROTOBUF_EXPORT EpsCopyInputStream { const char* SkipFallback(const char* ptr, int size); const char* AppendStringFallback(const char* ptr, int size, std::string* str); const char* ReadStringFallback(const char* ptr, int size, std::string* str); + bool StreamNext(const void** data) { + bool res = zcis_->Next(data, &size_); + if (res) overall_limit_ -= size_; + return res; + } + void StreamBackUp(int count) { + zcis_->BackUp(count); + overall_limit_ += count; + } template const char* AppendSize(const char* ptr, int size, const A& append) { @@ -438,7 +450,9 @@ T UnalignedLoad(const char* p) { return res; } +PROTOBUF_EXPORT std::pair VarintParseSlow32(const char* p, uint32 res); +PROTOBUF_EXPORT std::pair VarintParseSlow64(const char* p, uint32 res); inline const char* VarintParseSlow(const char* p, uint32 res, uint32* out) { @@ -473,6 +487,7 @@ PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) { // Used for tags, could read up to 5 bytes which must be available. // Caller must ensure its safe to call. +PROTOBUF_EXPORT std::pair ReadTagFallback(const char* p, uint32 res); // Same as ParseVarint but only accept 5 bytes at most. @@ -538,6 +553,7 @@ inline const char* ParseBigVarint(const char* p, uint64* out) { return nullptr; } +PROTOBUF_EXPORT std::pair ReadSizeFallback(const char* p, uint32 first); // Used for tags, could read up to 5 bytes which must be available. Additionally // it makes sure the unsigned value fits a int32, otherwise returns nullptr. @@ -625,6 +641,8 @@ inline PROTOBUF_MUST_USE_RESULT const char* InlineGreedyStringParserUTF8Verify( auto p = InlineGreedyStringParser(s, ptr, ctx); #ifndef NDEBUG VerifyUTF8(*s, field_name); +#else // !NDEBUG + (void)field_name; #endif // !NDEBUG return p; } diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index afd7f0ed71..766b3bb27a 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -364,3 +364,19 @@ // violations. So let's ignore for now. #pragma clang diagnostic ignored "-Wshorten-64-to-32" #endif + +// PROTOBUF_ASSUME(pred) tells the compiler that it can assume pred is true. To +// be safe, we also validate the assumption with a GOOGLE_DCHECK in unoptimized +// builds. The macro does not do anything useful if the compiler does not +// support __builtin_assume. +#ifdef __has_builtin +#if __has_builtin(__builtin_assume) +#define PROTOBUF_ASSUME(pred) \ + GOOGLE_DCHECK(pred); \ + __builtin_assume(pred) +#else +#define PROTOBUF_ASSUME(pred) GOOGLE_DCHECK(pred) +#endif +#else +#define PROTOBUF_ASSUME(pred) GOOGLE_DCHECK(pred) +#endif diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc index 7df776b5aa..a5c5d04283 100644 --- a/src/google/protobuf/port_undef.inc +++ b/src/google/protobuf/port_undef.inc @@ -64,6 +64,7 @@ #undef PROTOBUF_NAMESPACE_OPEN #undef PROTOBUF_NAMESPACE_CLOSE #undef PROTOBUF_UNUSED +#undef PROTOBUF_ASSUME // Restore macro that may have been #undef'd in port_def.inc. #ifdef _MSC_VER diff --git a/src/google/protobuf/reflection_ops.cc b/src/google/protobuf/reflection_ops.cc index f2852f83b7..077956a7bd 100644 --- a/src/google/protobuf/reflection_ops.cc +++ b/src/google/protobuf/reflection_ops.cc @@ -234,45 +234,48 @@ bool ReflectionOps::IsInitialized(const Message& message) { return true; } +static bool IsMapValueMessageTyped(const FieldDescriptor* map_field) { + return map_field->message_type()->field(1)->cpp_type() == + FieldDescriptor::CPPTYPE_MESSAGE; +} + void ReflectionOps::DiscardUnknownFields(Message* message) { const Reflection* reflection = GetReflectionOrDie(*message); reflection->MutableUnknownFields(message)->Clear(); + // Walk through the fields of this message and DiscardUnknownFields on any + // messages present. std::vector fields; reflection->ListFields(*message, &fields); for (int i = 0; i < fields.size(); i++) { const FieldDescriptor* field = fields[i]; - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - if (field->is_repeated()) { - if (field->is_map()) { - const FieldDescriptor* value_field = field->message_type()->field(1); - if (value_field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - const MapFieldBase* map_field = - reflection->MutableMapData(message, field); - if (map_field->IsMapValid()) { - MapIterator iter(message, field); - MapIterator end(message, field); - for (map_field->MapBegin(&iter), map_field->MapEnd(&end); - iter != end; ++iter) { - iter.MutableValueRef() - ->MutableMessageValue() - ->DiscardUnknownFields(); - } - continue; - } - } else { - continue; - } - } - int size = reflection->FieldSize(*message, field); - for (int j = 0; j < size; j++) { - reflection->MutableRepeatedMessage(message, field, j) - ->DiscardUnknownFields(); + // Skip over non-message fields. + if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) { + continue; + } + // Discard the unknown fields in maps that contain message values. + if (field->is_map() && IsMapValueMessageTyped(field)) { + const MapFieldBase* map_field = + reflection->MutableMapData(message, field); + if (map_field->IsMapValid()) { + MapIterator iter(message, field); + MapIterator end(message, field); + for (map_field->MapBegin(&iter), map_field->MapEnd(&end); iter != end; + ++iter) { + iter.MutableValueRef()->MutableMessageValue()->DiscardUnknownFields(); } - } else { - reflection->MutableMessage(message, field)->DiscardUnknownFields(); } + // Discard every unknown field inside messages in a repeated field. + } else if (field->is_repeated()) { + int size = reflection->FieldSize(*message, field); + for (int j = 0; j < size; j++) { + reflection->MutableRepeatedMessage(message, field, j) + ->DiscardUnknownFields(); + } + // Discard the unknown fields inside an optional message. + } else { + reflection->MutableMessage(message, field)->DiscardUnknownFields(); } } } diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index 6dea4e8fbb..bb6e8a9ee2 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -138,7 +138,6 @@ void SourceContext::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* SourceContext::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { @@ -172,52 +171,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool SourceContext::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.SourceContext) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string file_name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_file_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_file_name().data(), static_cast(this->_internal_file_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.SourceContext.file_name")); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.SourceContext) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.SourceContext) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* SourceContext::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 73cd2278d6..7ef7613fc3 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -135,12 +135,7 @@ class PROTOBUF_EXPORT SourceContext : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index cd49d6df38..e2da2bc8cd 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -257,7 +257,6 @@ void Struct::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Struct::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -297,59 +296,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Struct::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Struct) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // map fields = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - Struct_FieldsEntry_DoNotUse::Parser< ::PROTOBUF_NAMESPACE_ID::internal::MapField< - Struct_FieldsEntry_DoNotUse, - std::string, PROTOBUF_NAMESPACE_ID::Value, - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE, - 0 >, - ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value > > parser(&fields_); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessageNoVirtual( - input, &parser)); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - parser.key().data(), static_cast(parser.key().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Struct.FieldsEntry.key")); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Struct) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Struct) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Struct::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -358,7 +304,7 @@ failure: (void) cached_has_bits; // map fields = 1; - if (!this->fields().empty()) { + if (!this->_internal_fields().empty()) { typedef ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >::const_pointer ConstPtr; typedef ConstPtr SortItem; @@ -373,14 +319,14 @@ failure: }; if (stream->IsSerializationDeterministic() && - this->fields().size() > 1) { + this->_internal_fields().size() > 1) { ::std::unique_ptr items( - new SortItem[this->fields().size()]); + new SortItem[this->_internal_fields().size()]); typedef ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >::size_type size_type; size_type n = 0; for (::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >::const_iterator - it = this->fields().begin(); - it != this->fields().end(); ++it, ++n) { + it = this->_internal_fields().begin(); + it != this->_internal_fields().end(); ++it, ++n) { items[static_cast(n)] = SortItem(&*it); } ::std::sort(&items[0], &items[static_cast(n)], Less()); @@ -390,8 +336,8 @@ failure: } } else { for (::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >::const_iterator - it = this->fields().begin(); - it != this->fields().end(); ++it) { + it = this->_internal_fields().begin(); + it != this->_internal_fields().end(); ++it) { target = Struct_FieldsEntry_DoNotUse::Funcs::InternalSerialize(1, it->first, it->second, target, stream); Utf8Check::Check(&(*it)); } @@ -416,10 +362,10 @@ size_t Struct::ByteSizeLong() const { // map fields = 1; total_size += 1 * - ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->fields_size()); + ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_fields_size()); for (::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >::const_iterator - it = this->fields().begin(); - it != this->fields().end(); ++it) { + it = this->_internal_fields().begin(); + it != this->_internal_fields().end(); ++it) { total_size += Struct_FieldsEntry_DoNotUse::Funcs::ByteSizeLong(it->first, it->second); } @@ -562,11 +508,11 @@ Value::Value(const Value& from) clear_has_kind(); switch (from.kind_case()) { case kNullValue: { - set_null_value(from.null_value()); + _internal_set_null_value(from._internal_null_value()); break; } case kNumberValue: { - set_number_value(from.number_value()); + _internal_set_number_value(from._internal_number_value()); break; } case kStringValue: { @@ -574,15 +520,15 @@ Value::Value(const Value& from) break; } case kBoolValue: { - set_bool_value(from.bool_value()); + _internal_set_bool_value(from._internal_bool_value()); break; } case kStructValue: { - mutable_struct_value()->PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from.struct_value()); + _internal_mutable_struct_value()->PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from._internal_struct_value()); break; } case kListValue: { - mutable_list_value()->PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from.list_value()); + _internal_mutable_list_value()->PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from._internal_list_value()); break; } case KIND_NOT_SET: { @@ -674,7 +620,6 @@ void Value::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -688,13 +633,13 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); - set_null_value(static_cast(val)); + _internal_set_null_value(static_cast(val)); } else goto handle_unusual; continue; // double number_value = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 17)) { - set_number_value(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr)); + _internal_set_number_value(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr)); ptr += sizeof(double); } else goto handle_unusual; continue; @@ -708,21 +653,21 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte // bool bool_value = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { - set_bool_value(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); + _internal_set_bool_value(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); CHK_(ptr); } else goto handle_unusual; continue; // .google.protobuf.Struct struct_value = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { - ptr = ctx->ParseMessage(mutable_struct_value(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_struct_value(), ptr); CHK_(ptr); } else goto handle_unusual; continue; // .google.protobuf.ListValue list_value = 6; case 6: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { - ptr = ctx->ParseMessage(mutable_list_value(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_list_value(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -745,116 +690,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Value::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Value) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // .google.protobuf.NullValue null_value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - set_null_value(static_cast< PROTOBUF_NAMESPACE_ID::NullValue >(value)); - } else { - goto handle_unusual; - } - break; - } - - // double number_value = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (17 & 0xFF)) { - clear_kind(); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - double, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_DOUBLE>( - input, &kind_.number_value_))); - set_has_number_value(); - } else { - goto handle_unusual; - } - break; - } - - // string string_value = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_string_value())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_string_value().data(), static_cast(this->_internal_string_value().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Value.string_value")); - } else { - goto handle_unusual; - } - break; - } - - // bool bool_value = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (32 & 0xFF)) { - clear_kind(); - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &kind_.bool_value_))); - set_has_bool_value(); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.Struct struct_value = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_struct_value())); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.ListValue list_value = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_list_value())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Value) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Value) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Value::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -863,20 +698,20 @@ failure: (void) cached_has_bits; // .google.protobuf.NullValue null_value = 1; - if (has_null_value()) { + if (_internal_has_null_value()) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 1, this->null_value(), target); + 1, this->_internal_null_value(), target); } // double number_value = 2; - if (has_number_value()) { + if (_internal_has_number_value()) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(2, this->number_value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(2, this->_internal_number_value(), target); } // string string_value = 3; - if (has_string_value()) { + if (_internal_has_string_value()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_string_value().data(), static_cast(this->_internal_string_value().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -886,13 +721,13 @@ failure: } // bool bool_value = 4; - if (has_bool_value()) { + if (_internal_has_bool_value()) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->bool_value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->_internal_bool_value(), target); } // .google.protobuf.Struct struct_value = 5; - if (has_struct_value()) { + if (_internal_has_struct_value()) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessageToArray( @@ -900,7 +735,7 @@ failure: } // .google.protobuf.ListValue list_value = 6; - if (has_list_value()) { + if (_internal_has_list_value()) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessageToArray( @@ -927,7 +762,7 @@ size_t Value::ByteSizeLong() const { // .google.protobuf.NullValue null_value = 1; case kNullValue: { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->null_value()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_null_value()); break; } // double number_value = 2; @@ -998,11 +833,11 @@ void Value::MergeFrom(const Value& from) { switch (from.kind_case()) { case kNullValue: { - set_null_value(from.null_value()); + _internal_set_null_value(from._internal_null_value()); break; } case kNumberValue: { - set_number_value(from.number_value()); + _internal_set_number_value(from._internal_number_value()); break; } case kStringValue: { @@ -1010,15 +845,15 @@ void Value::MergeFrom(const Value& from) { break; } case kBoolValue: { - set_bool_value(from.bool_value()); + _internal_set_bool_value(from._internal_bool_value()); break; } case kStructValue: { - mutable_struct_value()->PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from.struct_value()); + _internal_mutable_struct_value()->PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from._internal_struct_value()); break; } case kListValue: { - mutable_list_value()->PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from.list_value()); + _internal_mutable_list_value()->PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from._internal_list_value()); break; } case KIND_NOT_SET: { @@ -1124,7 +959,6 @@ void ListValue::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* ListValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -1139,7 +973,7 @@ const char* ListValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_values(), ptr); + ptr = ctx->ParseMessage(_internal_add_values(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); @@ -1164,48 +998,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool ListValue::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.ListValue) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .google.protobuf.Value values = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_values())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.ListValue) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.ListValue) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* ListValue::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1214,11 +1006,11 @@ failure: (void) cached_has_bits; // repeated .google.protobuf.Value values = 1; - for (auto it = this->values_.pointer_begin(), - end = this->values_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_values_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(1, **it, target, stream); + InternalWriteMessageToArray(1, this->_internal_values(i), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1238,7 +1030,7 @@ size_t ListValue::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.Value values = 1; - total_size += 1UL * this->values_size(); + total_size += 1UL * this->_internal_values_size(); for (const auto& msg : this->values_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 9b7f5d195b..244bbbe677 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -222,12 +222,7 @@ class PROTOBUF_EXPORT Struct : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -274,7 +269,16 @@ class PROTOBUF_EXPORT Struct : }; // map fields = 1; int fields_size() const; + private: + int _internal_fields_size() const; + public: void clear_fields(); + private: + const ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >& + _internal_fields() const; + ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >* + _internal_mutable_fields(); + public: const ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >& fields() const; ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >* @@ -393,12 +397,7 @@ class PROTOBUF_EXPORT Value : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -449,23 +448,31 @@ class PROTOBUF_EXPORT Value : }; // .google.protobuf.NullValue null_value = 1; private: - bool has_null_value() const; + bool _internal_has_null_value() const; public: void clear_null_value(); PROTOBUF_NAMESPACE_ID::NullValue null_value() const; void set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value); + private: + PROTOBUF_NAMESPACE_ID::NullValue _internal_null_value() const; + void _internal_set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value); + public: // double number_value = 2; private: - bool has_number_value() const; + bool _internal_has_number_value() const; public: void clear_number_value(); double number_value() const; void set_number_value(double value); + private: + double _internal_number_value() const; + void _internal_set_number_value(double value); + public: // string string_value = 3; private: - bool has_string_value() const; + bool _internal_has_string_value() const; public: void clear_string_value(); const std::string& string_value() const; @@ -493,11 +500,15 @@ class PROTOBUF_EXPORT Value : // bool bool_value = 4; private: - bool has_bool_value() const; + bool _internal_has_bool_value() const; public: void clear_bool_value(); bool bool_value() const; void set_bool_value(bool value); + private: + bool _internal_bool_value() const; + void _internal_set_bool_value(bool value); + public: // .google.protobuf.Struct struct_value = 5; bool has_struct_value() const; @@ -509,6 +520,10 @@ class PROTOBUF_EXPORT Value : PROTOBUF_NAMESPACE_ID::Struct* release_struct_value(); PROTOBUF_NAMESPACE_ID::Struct* mutable_struct_value(); void set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value); + private: + const PROTOBUF_NAMESPACE_ID::Struct& _internal_struct_value() const; + PROTOBUF_NAMESPACE_ID::Struct* _internal_mutable_struct_value(); + public: void unsafe_arena_set_allocated_struct_value( PROTOBUF_NAMESPACE_ID::Struct* struct_value); PROTOBUF_NAMESPACE_ID::Struct* unsafe_arena_release_struct_value(); @@ -523,6 +538,10 @@ class PROTOBUF_EXPORT Value : PROTOBUF_NAMESPACE_ID::ListValue* release_list_value(); PROTOBUF_NAMESPACE_ID::ListValue* mutable_list_value(); void set_allocated_list_value(PROTOBUF_NAMESPACE_ID::ListValue* list_value); + private: + const PROTOBUF_NAMESPACE_ID::ListValue& _internal_list_value() const; + PROTOBUF_NAMESPACE_ID::ListValue* _internal_mutable_list_value(); + public: void unsafe_arena_set_allocated_list_value( PROTOBUF_NAMESPACE_ID::ListValue* list_value); PROTOBUF_NAMESPACE_ID::ListValue* unsafe_arena_release_list_value(); @@ -646,12 +665,7 @@ class PROTOBUF_EXPORT ListValue : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -697,10 +711,17 @@ class PROTOBUF_EXPORT ListValue : }; // repeated .google.protobuf.Value values = 1; int values_size() const; + private: + int _internal_values_size() const; + public: void clear_values(); PROTOBUF_NAMESPACE_ID::Value* mutable_values(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >* mutable_values(); + private: + const PROTOBUF_NAMESPACE_ID::Value& _internal_values(int index) const; + PROTOBUF_NAMESPACE_ID::Value* _internal_add_values(); + public: const PROTOBUF_NAMESPACE_ID::Value& values(int index) const; PROTOBUF_NAMESPACE_ID::Value* add_values(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >& @@ -732,21 +753,32 @@ class PROTOBUF_EXPORT ListValue : // Struct // map fields = 1; -inline int Struct::fields_size() const { +inline int Struct::_internal_fields_size() const { return fields_.size(); } +inline int Struct::fields_size() const { + return _internal_fields_size(); +} inline void Struct::clear_fields() { fields_.Clear(); } inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >& +Struct::_internal_fields() const { + return fields_.GetMap(); +} +inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >& Struct::fields() const { // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields) - return fields_.GetMap(); + return _internal_fields(); +} +inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >* +Struct::_internal_mutable_fields() { + return fields_.MutableMap(); } inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >* Struct::mutable_fields() { // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields) - return fields_.MutableMap(); + return _internal_mutable_fields(); } // ------------------------------------------------------------------- @@ -754,72 +786,84 @@ Struct::mutable_fields() { // Value // .google.protobuf.NullValue null_value = 1; -inline bool Value::has_null_value() const { +inline bool Value::_internal_has_null_value() const { return kind_case() == kNullValue; } inline void Value::set_has_null_value() { _oneof_case_[0] = kNullValue; } inline void Value::clear_null_value() { - if (has_null_value()) { + if (_internal_has_null_value()) { kind_.null_value_ = 0; clear_has_kind(); } } -inline PROTOBUF_NAMESPACE_ID::NullValue Value::null_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value) - if (has_null_value()) { +inline PROTOBUF_NAMESPACE_ID::NullValue Value::_internal_null_value() const { + if (_internal_has_null_value()) { return static_cast< PROTOBUF_NAMESPACE_ID::NullValue >(kind_.null_value_); } return static_cast< PROTOBUF_NAMESPACE_ID::NullValue >(0); } -inline void Value::set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value) { - if (!has_null_value()) { +inline PROTOBUF_NAMESPACE_ID::NullValue Value::null_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value) + return _internal_null_value(); +} +inline void Value::_internal_set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value) { + if (!_internal_has_null_value()) { clear_kind(); set_has_null_value(); } kind_.null_value_ = value; +} +inline void Value::set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value) { // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value) + _internal_set_null_value(value); } // double number_value = 2; -inline bool Value::has_number_value() const { +inline bool Value::_internal_has_number_value() const { return kind_case() == kNumberValue; } inline void Value::set_has_number_value() { _oneof_case_[0] = kNumberValue; } inline void Value::clear_number_value() { - if (has_number_value()) { + if (_internal_has_number_value()) { kind_.number_value_ = 0; clear_has_kind(); } } -inline double Value::number_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.number_value) - if (has_number_value()) { +inline double Value::_internal_number_value() const { + if (_internal_has_number_value()) { return kind_.number_value_; } return 0; } -inline void Value::set_number_value(double value) { - if (!has_number_value()) { +inline void Value::_internal_set_number_value(double value) { + if (!_internal_has_number_value()) { clear_kind(); set_has_number_value(); } kind_.number_value_ = value; +} +inline double Value::number_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.number_value) + return _internal_number_value(); +} +inline void Value::set_number_value(double value) { + _internal_set_number_value(value); // @@protoc_insertion_point(field_set:google.protobuf.Value.number_value) } // string string_value = 3; -inline bool Value::has_string_value() const { +inline bool Value::_internal_has_string_value() const { return kind_case() == kStringValue; } inline void Value::set_has_string_value() { _oneof_case_[0] = kStringValue; } inline void Value::clear_string_value() { - if (has_string_value()) { + if (_internal_has_string_value()) { kind_.string_value_.Destroy(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_kind(); @@ -838,13 +882,13 @@ inline std::string* Value::mutable_string_value() { return _internal_mutable_string_value(); } inline const std::string& Value::_internal_string_value() const { - if (has_string_value()) { + if (_internal_has_string_value()) { return kind_.string_value_.Get(); } return *&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); } inline void Value::_internal_set_string_value(const std::string& value) { - if (!has_string_value()) { + if (!_internal_has_string_value()) { clear_kind(); set_has_string_value(); kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -854,7 +898,7 @@ inline void Value::_internal_set_string_value(const std::string& value) { } inline void Value::set_string_value(std::string&& value) { // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value) - if (!has_string_value()) { + if (!_internal_has_string_value()) { clear_kind(); set_has_string_value(); kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -865,7 +909,7 @@ inline void Value::set_string_value(std::string&& value) { } inline void Value::set_string_value(const char* value) { GOOGLE_DCHECK(value != nullptr); - if (!has_string_value()) { + if (!_internal_has_string_value()) { clear_kind(); set_has_string_value(); kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -876,7 +920,7 @@ inline void Value::set_string_value(const char* value) { } inline void Value::set_string_value(const char* value, size_t size) { - if (!has_string_value()) { + if (!_internal_has_string_value()) { clear_kind(); set_has_string_value(); kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -888,7 +932,7 @@ inline void Value::set_string_value(const char* value, // @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value) } inline std::string* Value::_internal_mutable_string_value() { - if (!has_string_value()) { + if (!_internal_has_string_value()) { clear_kind(); set_has_string_value(); kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -898,7 +942,7 @@ inline std::string* Value::_internal_mutable_string_value() { } inline std::string* Value::release_string_value() { // @@protoc_insertion_point(field_release:google.protobuf.Value.string_value) - if (has_string_value()) { + if (_internal_has_string_value()) { clear_has_kind(); return kind_.string_value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); @@ -919,7 +963,7 @@ inline void Value::set_allocated_string_value(std::string* string_value) { inline std::string* Value::unsafe_arena_release_string_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.string_value) GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); - if (has_string_value()) { + if (_internal_has_string_value()) { clear_has_kind(); return kind_.string_value_.UnsafeArenaRelease( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); @@ -929,7 +973,7 @@ inline std::string* Value::unsafe_arena_release_string_value() { } inline void Value::unsafe_arena_set_allocated_string_value(std::string* string_value) { GOOGLE_DCHECK(GetArenaNoVirtual() != nullptr); - if (!has_string_value()) { + if (!_internal_has_string_value()) { kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } clear_kind(); @@ -941,43 +985,52 @@ inline void Value::unsafe_arena_set_allocated_string_value(std::string* string_v } // bool bool_value = 4; -inline bool Value::has_bool_value() const { +inline bool Value::_internal_has_bool_value() const { return kind_case() == kBoolValue; } inline void Value::set_has_bool_value() { _oneof_case_[0] = kBoolValue; } inline void Value::clear_bool_value() { - if (has_bool_value()) { + if (_internal_has_bool_value()) { kind_.bool_value_ = false; clear_has_kind(); } } -inline bool Value::bool_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.bool_value) - if (has_bool_value()) { +inline bool Value::_internal_bool_value() const { + if (_internal_has_bool_value()) { return kind_.bool_value_; } return false; } -inline void Value::set_bool_value(bool value) { - if (!has_bool_value()) { +inline void Value::_internal_set_bool_value(bool value) { + if (!_internal_has_bool_value()) { clear_kind(); set_has_bool_value(); } kind_.bool_value_ = value; +} +inline bool Value::bool_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.bool_value) + return _internal_bool_value(); +} +inline void Value::set_bool_value(bool value) { + _internal_set_bool_value(value); // @@protoc_insertion_point(field_set:google.protobuf.Value.bool_value) } // .google.protobuf.Struct struct_value = 5; -inline bool Value::has_struct_value() const { +inline bool Value::_internal_has_struct_value() const { return kind_case() == kStructValue; } +inline bool Value::has_struct_value() const { + return _internal_has_struct_value(); +} inline void Value::set_has_struct_value() { _oneof_case_[0] = kStructValue; } inline void Value::clear_struct_value() { - if (has_struct_value()) { + if (_internal_has_struct_value()) { if (GetArenaNoVirtual() == nullptr) { delete kind_.struct_value_; } @@ -998,12 +1051,15 @@ inline PROTOBUF_NAMESPACE_ID::Struct* Value::release_struct_value() { return nullptr; } } -inline const PROTOBUF_NAMESPACE_ID::Struct& Value::struct_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) - return has_struct_value() +inline const PROTOBUF_NAMESPACE_ID::Struct& Value::_internal_struct_value() const { + return _internal_has_struct_value() ? *kind_.struct_value_ : *reinterpret_cast< PROTOBUF_NAMESPACE_ID::Struct*>(&PROTOBUF_NAMESPACE_ID::_Struct_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::Struct& Value::struct_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) + return _internal_struct_value(); +} inline PROTOBUF_NAMESPACE_ID::Struct* Value::unsafe_arena_release_struct_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value) if (has_struct_value()) { @@ -1023,26 +1079,32 @@ inline void Value::unsafe_arena_set_allocated_struct_value(PROTOBUF_NAMESPACE_ID } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value) } -inline PROTOBUF_NAMESPACE_ID::Struct* Value::mutable_struct_value() { - if (!has_struct_value()) { +inline PROTOBUF_NAMESPACE_ID::Struct* Value::_internal_mutable_struct_value() { + if (!_internal_has_struct_value()) { clear_kind(); set_has_struct_value(); kind_.struct_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Struct >( GetArenaNoVirtual()); } - // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) return kind_.struct_value_; } +inline PROTOBUF_NAMESPACE_ID::Struct* Value::mutable_struct_value() { + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) + return _internal_mutable_struct_value(); +} // .google.protobuf.ListValue list_value = 6; -inline bool Value::has_list_value() const { +inline bool Value::_internal_has_list_value() const { return kind_case() == kListValue; } +inline bool Value::has_list_value() const { + return _internal_has_list_value(); +} inline void Value::set_has_list_value() { _oneof_case_[0] = kListValue; } inline void Value::clear_list_value() { - if (has_list_value()) { + if (_internal_has_list_value()) { if (GetArenaNoVirtual() == nullptr) { delete kind_.list_value_; } @@ -1063,12 +1125,15 @@ inline PROTOBUF_NAMESPACE_ID::ListValue* Value::release_list_value() { return nullptr; } } -inline const PROTOBUF_NAMESPACE_ID::ListValue& Value::list_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) - return has_list_value() +inline const PROTOBUF_NAMESPACE_ID::ListValue& Value::_internal_list_value() const { + return _internal_has_list_value() ? *kind_.list_value_ : *reinterpret_cast< PROTOBUF_NAMESPACE_ID::ListValue*>(&PROTOBUF_NAMESPACE_ID::_ListValue_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::ListValue& Value::list_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) + return _internal_list_value(); +} inline PROTOBUF_NAMESPACE_ID::ListValue* Value::unsafe_arena_release_list_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value) if (has_list_value()) { @@ -1088,16 +1153,19 @@ inline void Value::unsafe_arena_set_allocated_list_value(PROTOBUF_NAMESPACE_ID:: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value) } -inline PROTOBUF_NAMESPACE_ID::ListValue* Value::mutable_list_value() { - if (!has_list_value()) { +inline PROTOBUF_NAMESPACE_ID::ListValue* Value::_internal_mutable_list_value() { + if (!_internal_has_list_value()) { clear_kind(); set_has_list_value(); kind_.list_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ListValue >( GetArenaNoVirtual()); } - // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) return kind_.list_value_; } +inline PROTOBUF_NAMESPACE_ID::ListValue* Value::mutable_list_value() { + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) + return _internal_mutable_list_value(); +} inline bool Value::has_kind() const { return kind_case() != KIND_NOT_SET; @@ -1113,9 +1181,12 @@ inline Value::KindCase Value::kind_case() const { // ListValue // repeated .google.protobuf.Value values = 1; -inline int ListValue::values_size() const { +inline int ListValue::_internal_values_size() const { return values_.size(); } +inline int ListValue::values_size() const { + return _internal_values_size(); +} inline void ListValue::clear_values() { values_.Clear(); } @@ -1128,13 +1199,19 @@ ListValue::mutable_values() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values) return &values_; } +inline const PROTOBUF_NAMESPACE_ID::Value& ListValue::_internal_values(int index) const { + return values_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Value& ListValue::values(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values) - return values_.Get(index); + return _internal_values(index); +} +inline PROTOBUF_NAMESPACE_ID::Value* ListValue::_internal_add_values() { + return values_.Add(); } inline PROTOBUF_NAMESPACE_ID::Value* ListValue::add_values() { // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values) - return values_.Add(); + return _internal_add_values(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >& ListValue::values() const { diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 8728b705d1..3515cba917 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -187,6 +187,14 @@ T* OnShutdownDelete(T* p) { return p; } +// Strongly references the given variable such that the linker will be forced +// to pull in this variable's translation unit. +template +void StrongReference(const T& var) { + auto volatile unused = &var; + (void)&unused; // Use address to avoid an extra load of "unused". +} + } // namespace internal #if PROTOBUF_USE_EXCEPTIONS diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index 5b8e85dc74..d25783ea83 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -203,7 +203,7 @@ inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64 v) { __sanitizer_unaligned_store64(p, v); } -#elif GOOGLE_PROTOBUF_USE_UNALIGNED +#elif defined(GOOGLE_PROTOBUF_USE_UNALIGNED) && GOOGLE_PROTOBUF_USE_UNALIGNED #define GOOGLE_UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) #define GOOGLE_UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) @@ -431,13 +431,6 @@ class BigEndian { } // namespace protobuf } // namespace google -#ifdef PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -#define GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER \ - PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -#else -#define GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER 0 -#endif - #include #endif // GOOGLE_PROTOBUF_STUBS_PORT_H_ diff --git a/src/google/protobuf/test_messages_proto2.proto b/src/google/protobuf/test_messages_proto2.proto index cb1a3a52e0..1d0c33f566 100644 --- a/src/google/protobuf/test_messages_proto2.proto +++ b/src/google/protobuf/test_messages_proto2.proto @@ -38,6 +38,7 @@ syntax = "proto2"; package protobuf_test_messages.proto2; + option java_package = "com.google.protobuf_test_messages.proto2"; // This is the default, but we specify it here explicitly. @@ -66,111 +67,111 @@ message TestAllTypesProto2 { } // Singular - optional int32 optional_int32 = 1; - optional int64 optional_int64 = 2; - optional uint32 optional_uint32 = 3; - optional uint64 optional_uint64 = 4; - optional sint32 optional_sint32 = 5; - optional sint64 optional_sint64 = 6; - optional fixed32 optional_fixed32 = 7; - optional fixed64 optional_fixed64 = 8; - optional sfixed32 optional_sfixed32 = 9; + optional int32 optional_int32 = 1; + optional int64 optional_int64 = 2; + optional uint32 optional_uint32 = 3; + optional uint64 optional_uint64 = 4; + optional sint32 optional_sint32 = 5; + optional sint64 optional_sint64 = 6; + optional fixed32 optional_fixed32 = 7; + optional fixed64 optional_fixed64 = 8; + optional sfixed32 optional_sfixed32 = 9; optional sfixed64 optional_sfixed64 = 10; - optional float optional_float = 11; - optional double optional_double = 12; - optional bool optional_bool = 13; - optional string optional_string = 14; - optional bytes optional_bytes = 15; + optional float optional_float = 11; + optional double optional_double = 12; + optional bool optional_bool = 13; + optional string optional_string = 14; + optional bytes optional_bytes = 15; - optional NestedMessage optional_nested_message = 18; - optional ForeignMessageProto2 optional_foreign_message = 19; + optional NestedMessage optional_nested_message = 18; + optional ForeignMessageProto2 optional_foreign_message = 19; - optional NestedEnum optional_nested_enum = 21; - optional ForeignEnumProto2 optional_foreign_enum = 22; + optional NestedEnum optional_nested_enum = 21; + optional ForeignEnumProto2 optional_foreign_enum = 22; - optional string optional_string_piece = 24 [ctype=STRING_PIECE]; - optional string optional_cord = 25 [ctype=CORD]; + optional string optional_string_piece = 24 [ctype = STRING_PIECE]; + optional string optional_cord = 25 [ctype = CORD]; optional TestAllTypesProto2 recursive_message = 27; // Repeated - repeated int32 repeated_int32 = 31; - repeated int64 repeated_int64 = 32; - repeated uint32 repeated_uint32 = 33; - repeated uint64 repeated_uint64 = 34; - repeated sint32 repeated_sint32 = 35; - repeated sint64 repeated_sint64 = 36; - repeated fixed32 repeated_fixed32 = 37; - repeated fixed64 repeated_fixed64 = 38; + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; repeated sfixed32 repeated_sfixed32 = 39; repeated sfixed64 repeated_sfixed64 = 40; - repeated float repeated_float = 41; - repeated double repeated_double = 42; - repeated bool repeated_bool = 43; - repeated string repeated_string = 44; - repeated bytes repeated_bytes = 45; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; - repeated NestedMessage repeated_nested_message = 48; - repeated ForeignMessageProto2 repeated_foreign_message = 49; + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessageProto2 repeated_foreign_message = 49; - repeated NestedEnum repeated_nested_enum = 51; - repeated ForeignEnumProto2 repeated_foreign_enum = 52; + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnumProto2 repeated_foreign_enum = 52; - repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; - repeated string repeated_cord = 55 [ctype=CORD]; + repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; + repeated string repeated_cord = 55 [ctype = CORD]; // Packed - repeated int32 packed_int32 = 75 [packed=true]; - repeated int64 packed_int64 = 76 [packed=true]; - repeated uint32 packed_uint32 = 77 [packed=true]; - repeated uint64 packed_uint64 = 78 [packed=true]; - repeated sint32 packed_sint32 = 79 [packed=true]; - repeated sint64 packed_sint64 = 80 [packed=true]; - repeated fixed32 packed_fixed32 = 81 [packed=true]; - repeated fixed64 packed_fixed64 = 82 [packed=true]; - repeated sfixed32 packed_sfixed32 = 83 [packed=true]; - repeated sfixed64 packed_sfixed64 = 84 [packed=true]; - repeated float packed_float = 85 [packed=true]; - repeated double packed_double = 86 [packed=true]; - repeated bool packed_bool = 87 [packed=true]; - repeated NestedEnum packed_nested_enum = 88 [packed=true]; + repeated int32 packed_int32 = 75 [packed = true]; + repeated int64 packed_int64 = 76 [packed = true]; + repeated uint32 packed_uint32 = 77 [packed = true]; + repeated uint64 packed_uint64 = 78 [packed = true]; + repeated sint32 packed_sint32 = 79 [packed = true]; + repeated sint64 packed_sint64 = 80 [packed = true]; + repeated fixed32 packed_fixed32 = 81 [packed = true]; + repeated fixed64 packed_fixed64 = 82 [packed = true]; + repeated sfixed32 packed_sfixed32 = 83 [packed = true]; + repeated sfixed64 packed_sfixed64 = 84 [packed = true]; + repeated float packed_float = 85 [packed = true]; + repeated double packed_double = 86 [packed = true]; + repeated bool packed_bool = 87 [packed = true]; + repeated NestedEnum packed_nested_enum = 88 [packed = true]; // Unpacked - repeated int32 unpacked_int32 = 89 [packed=false]; - repeated int64 unpacked_int64 = 90 [packed=false]; - repeated uint32 unpacked_uint32 = 91 [packed=false]; - repeated uint64 unpacked_uint64 = 92 [packed=false]; - repeated sint32 unpacked_sint32 = 93 [packed=false]; - repeated sint64 unpacked_sint64 = 94 [packed=false]; - repeated fixed32 unpacked_fixed32 = 95 [packed=false]; - repeated fixed64 unpacked_fixed64 = 96 [packed=false]; - repeated sfixed32 unpacked_sfixed32 = 97 [packed=false]; - repeated sfixed64 unpacked_sfixed64 = 98 [packed=false]; - repeated float unpacked_float = 99 [packed=false]; - repeated double unpacked_double = 100 [packed=false]; - repeated bool unpacked_bool = 101 [packed=false]; - repeated NestedEnum unpacked_nested_enum = 102 [packed=false]; + repeated int32 unpacked_int32 = 89 [packed = false]; + repeated int64 unpacked_int64 = 90 [packed = false]; + repeated uint32 unpacked_uint32 = 91 [packed = false]; + repeated uint64 unpacked_uint64 = 92 [packed = false]; + repeated sint32 unpacked_sint32 = 93 [packed = false]; + repeated sint64 unpacked_sint64 = 94 [packed = false]; + repeated fixed32 unpacked_fixed32 = 95 [packed = false]; + repeated fixed64 unpacked_fixed64 = 96 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 97 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 98 [packed = false]; + repeated float unpacked_float = 99 [packed = false]; + repeated double unpacked_double = 100 [packed = false]; + repeated bool unpacked_bool = 101 [packed = false]; + repeated NestedEnum unpacked_nested_enum = 102 [packed = false]; // Map - map < int32, int32> map_int32_int32 = 56; - map < int64, int64> map_int64_int64 = 57; - map < uint32, uint32> map_uint32_uint32 = 58; - map < uint64, uint64> map_uint64_uint64 = 59; - map < sint32, sint32> map_sint32_sint32 = 60; - map < sint64, sint64> map_sint64_sint64 = 61; - map < fixed32, fixed32> map_fixed32_fixed32 = 62; - map < fixed64, fixed64> map_fixed64_fixed64 = 63; - map map_sfixed32_sfixed32 = 64; - map map_sfixed64_sfixed64 = 65; - map < int32, float> map_int32_float = 66; - map < int32, double> map_int32_double = 67; - map < bool, bool> map_bool_bool = 68; - map < string, string> map_string_string = 69; - map < string, bytes> map_string_bytes = 70; - map < string, NestedMessage> map_string_nested_message = 71; - map < string, ForeignMessageProto2> map_string_foreign_message = 72; - map < string, NestedEnum> map_string_nested_enum = 73; - map < string, ForeignEnumProto2> map_string_foreign_enum = 74; + map map_int32_int32 = 56; + map map_int64_int64 = 57; + map map_uint32_uint32 = 58; + map map_uint64_uint64 = 59; + map map_sint32_sint32 = 60; + map map_sint64_sint64 = 61; + map map_fixed32_fixed32 = 62; + map map_fixed64_fixed64 = 63; + map map_sfixed32_sfixed32 = 64; + map map_sfixed64_sfixed64 = 65; + map map_int32_float = 66; + map map_int32_double = 67; + map map_bool_bool = 68; + map map_string_string = 69; + map map_string_bytes = 70; + map map_string_nested_message = 71; + map map_string_foreign_message = 72; + map map_string_nested_enum = 73; + map map_string_foreign_enum = 74; oneof oneof_field { uint32 oneof_uint32 = 111; @@ -191,7 +192,7 @@ message TestAllTypesProto2 { optional group Data = 201 { optional int32 group_int32 = 202; optional uint32 group_uint32 = 203; - }; + } // Test field-name-to-JSON-name convention. // (protobuf says names can be any valid C/C++ identifier.) @@ -220,6 +221,7 @@ message TestAllTypesProto2 { // message_set test case. message MessageSetCorrect { option message_set_wire_format = true; + extensions 4 to max; } @@ -253,7 +255,7 @@ extend TestAllTypesProto2 { } message UnknownToTestAllTypes { - optional int32 optional_int32 = 1001; + optional int32 optional_int32 = 1001; optional string optional_string = 1002; optional ForeignMessageProto2 nested_message = 1003; optional group OptionalGroup = 1004 { @@ -262,4 +264,3 @@ message UnknownToTestAllTypes { optional bool optional_bool = 1006; repeated int32 repeated_int32 = 1011; } - diff --git a/src/google/protobuf/test_messages_proto3.proto b/src/google/protobuf/test_messages_proto3.proto index 4e00669958..a10f44d946 100644 --- a/src/google/protobuf/test_messages_proto3.proto +++ b/src/google/protobuf/test_messages_proto3.proto @@ -38,6 +38,7 @@ syntax = "proto3"; package protobuf_test_messages.proto3; + option java_package = "com.google.protobuf_test_messages.proto3"; option objc_class_prefix = "Proto3"; @@ -85,112 +86,112 @@ message TestAllTypesProto3 { } // Singular - int32 optional_int32 = 1; - int64 optional_int64 = 2; - uint32 optional_uint32 = 3; - uint64 optional_uint64 = 4; - sint32 optional_sint32 = 5; - sint64 optional_sint64 = 6; - fixed32 optional_fixed32 = 7; - fixed64 optional_fixed64 = 8; - sfixed32 optional_sfixed32 = 9; + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; sfixed64 optional_sfixed64 = 10; - float optional_float = 11; - double optional_double = 12; - bool optional_bool = 13; - string optional_string = 14; - bytes optional_bytes = 15; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; - NestedMessage optional_nested_message = 18; - ForeignMessage optional_foreign_message = 19; + NestedMessage optional_nested_message = 18; + ForeignMessage optional_foreign_message = 19; - NestedEnum optional_nested_enum = 21; - ForeignEnum optional_foreign_enum = 22; - AliasedEnum optional_aliased_enum = 23; + NestedEnum optional_nested_enum = 21; + ForeignEnum optional_foreign_enum = 22; + AliasedEnum optional_aliased_enum = 23; - string optional_string_piece = 24 [ctype=STRING_PIECE]; - string optional_cord = 25 [ctype=CORD]; + string optional_string_piece = 24 [ctype = STRING_PIECE]; + string optional_cord = 25 [ctype = CORD]; TestAllTypesProto3 recursive_message = 27; // Repeated - repeated int32 repeated_int32 = 31; - repeated int64 repeated_int64 = 32; - repeated uint32 repeated_uint32 = 33; - repeated uint64 repeated_uint64 = 34; - repeated sint32 repeated_sint32 = 35; - repeated sint64 repeated_sint64 = 36; - repeated fixed32 repeated_fixed32 = 37; - repeated fixed64 repeated_fixed64 = 38; + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; repeated sfixed32 repeated_sfixed32 = 39; repeated sfixed64 repeated_sfixed64 = 40; - repeated float repeated_float = 41; - repeated double repeated_double = 42; - repeated bool repeated_bool = 43; - repeated string repeated_string = 44; - repeated bytes repeated_bytes = 45; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; - repeated NestedMessage repeated_nested_message = 48; - repeated ForeignMessage repeated_foreign_message = 49; + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; - repeated NestedEnum repeated_nested_enum = 51; - repeated ForeignEnum repeated_foreign_enum = 52; + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; - repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; - repeated string repeated_cord = 55 [ctype=CORD]; + repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; + repeated string repeated_cord = 55 [ctype = CORD]; // Packed - repeated int32 packed_int32 = 75 [packed=true]; - repeated int64 packed_int64 = 76 [packed=true]; - repeated uint32 packed_uint32 = 77 [packed=true]; - repeated uint64 packed_uint64 = 78 [packed=true]; - repeated sint32 packed_sint32 = 79 [packed=true]; - repeated sint64 packed_sint64 = 80 [packed=true]; - repeated fixed32 packed_fixed32 = 81 [packed=true]; - repeated fixed64 packed_fixed64 = 82 [packed=true]; - repeated sfixed32 packed_sfixed32 = 83 [packed=true]; - repeated sfixed64 packed_sfixed64 = 84 [packed=true]; - repeated float packed_float = 85 [packed=true]; - repeated double packed_double = 86 [packed=true]; - repeated bool packed_bool = 87 [packed=true]; - repeated NestedEnum packed_nested_enum = 88 [packed=true]; + repeated int32 packed_int32 = 75 [packed = true]; + repeated int64 packed_int64 = 76 [packed = true]; + repeated uint32 packed_uint32 = 77 [packed = true]; + repeated uint64 packed_uint64 = 78 [packed = true]; + repeated sint32 packed_sint32 = 79 [packed = true]; + repeated sint64 packed_sint64 = 80 [packed = true]; + repeated fixed32 packed_fixed32 = 81 [packed = true]; + repeated fixed64 packed_fixed64 = 82 [packed = true]; + repeated sfixed32 packed_sfixed32 = 83 [packed = true]; + repeated sfixed64 packed_sfixed64 = 84 [packed = true]; + repeated float packed_float = 85 [packed = true]; + repeated double packed_double = 86 [packed = true]; + repeated bool packed_bool = 87 [packed = true]; + repeated NestedEnum packed_nested_enum = 88 [packed = true]; // Unpacked - repeated int32 unpacked_int32 = 89 [packed=false]; - repeated int64 unpacked_int64 = 90 [packed=false]; - repeated uint32 unpacked_uint32 = 91 [packed=false]; - repeated uint64 unpacked_uint64 = 92 [packed=false]; - repeated sint32 unpacked_sint32 = 93 [packed=false]; - repeated sint64 unpacked_sint64 = 94 [packed=false]; - repeated fixed32 unpacked_fixed32 = 95 [packed=false]; - repeated fixed64 unpacked_fixed64 = 96 [packed=false]; - repeated sfixed32 unpacked_sfixed32 = 97 [packed=false]; - repeated sfixed64 unpacked_sfixed64 = 98 [packed=false]; - repeated float unpacked_float = 99 [packed=false]; - repeated double unpacked_double = 100 [packed=false]; - repeated bool unpacked_bool = 101 [packed=false]; - repeated NestedEnum unpacked_nested_enum = 102 [packed=false]; + repeated int32 unpacked_int32 = 89 [packed = false]; + repeated int64 unpacked_int64 = 90 [packed = false]; + repeated uint32 unpacked_uint32 = 91 [packed = false]; + repeated uint64 unpacked_uint64 = 92 [packed = false]; + repeated sint32 unpacked_sint32 = 93 [packed = false]; + repeated sint64 unpacked_sint64 = 94 [packed = false]; + repeated fixed32 unpacked_fixed32 = 95 [packed = false]; + repeated fixed64 unpacked_fixed64 = 96 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 97 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 98 [packed = false]; + repeated float unpacked_float = 99 [packed = false]; + repeated double unpacked_double = 100 [packed = false]; + repeated bool unpacked_bool = 101 [packed = false]; + repeated NestedEnum unpacked_nested_enum = 102 [packed = false]; // Map - map < int32, int32> map_int32_int32 = 56; - map < int64, int64> map_int64_int64 = 57; - map < uint32, uint32> map_uint32_uint32 = 58; - map < uint64, uint64> map_uint64_uint64 = 59; - map < sint32, sint32> map_sint32_sint32 = 60; - map < sint64, sint64> map_sint64_sint64 = 61; - map < fixed32, fixed32> map_fixed32_fixed32 = 62; - map < fixed64, fixed64> map_fixed64_fixed64 = 63; - map map_sfixed32_sfixed32 = 64; - map map_sfixed64_sfixed64 = 65; - map < int32, float> map_int32_float = 66; - map < int32, double> map_int32_double = 67; - map < bool, bool> map_bool_bool = 68; - map < string, string> map_string_string = 69; - map < string, bytes> map_string_bytes = 70; - map < string, NestedMessage> map_string_nested_message = 71; - map < string, ForeignMessage> map_string_foreign_message = 72; - map < string, NestedEnum> map_string_nested_enum = 73; - map < string, ForeignEnum> map_string_foreign_enum = 74; + map map_int32_int32 = 56; + map map_int64_int64 = 57; + map map_uint32_uint32 = 58; + map map_uint64_uint64 = 59; + map map_sint32_sint32 = 60; + map map_sint64_sint64 = 61; + map map_fixed32_fixed32 = 62; + map map_fixed64_fixed64 = 63; + map map_sfixed32_sfixed32 = 64; + map map_sfixed64_sfixed64 = 65; + map map_int32_float = 66; + map map_int32_double = 67; + map map_bool_bool = 68; + map map_string_string = 69; + map map_string_bytes = 70; + map map_string_nested_message = 71; + map map_string_foreign_message = 72; + map map_string_nested_enum = 73; + map map_string_foreign_enum = 74; oneof oneof_field { uint32 oneof_uint32 = 111; diff --git a/src/google/protobuf/test_util_lite.cc b/src/google/protobuf/test_util_lite.cc index a83d109298..a897fe26b5 100644 --- a/src/google/protobuf/test_util_lite.cc +++ b/src/google/protobuf/test_util_lite.cc @@ -33,10 +33,11 @@ // Sanjay Ghemawat, Jeff Dean, and others. #include + #include #include #include - +#include namespace google { namespace protobuf { diff --git a/src/google/protobuf/testing/zcgunzip.cc b/src/google/protobuf/testing/zcgunzip.cc index d3403fd1e6..68f8172f61 100644 --- a/src/google/protobuf/testing/zcgunzip.cc +++ b/src/google/protobuf/testing/zcgunzip.cc @@ -39,9 +39,9 @@ // output. #include +#include #include #include -#include #include #ifdef _WIN32 diff --git a/src/google/protobuf/testing/zcgzip.cc b/src/google/protobuf/testing/zcgzip.cc index 4875755e37..808d058a1e 100644 --- a/src/google/protobuf/testing/zcgzip.cc +++ b/src/google/protobuf/testing/zcgzip.cc @@ -38,9 +38,9 @@ // Reads data on standard input and writes compressed gzip stream to standard // output. +#include #include #include -#include #include #ifdef _WIN32 diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc index 75d10077c7..8fc197a99a 100644 --- a/src/google/protobuf/text_format.cc +++ b/src/google/protobuf/text_format.cc @@ -1620,11 +1620,11 @@ void TextFormat::FastFieldValuePrinter::PrintUInt64( } void TextFormat::FastFieldValuePrinter::PrintFloat( float val, BaseTextGenerator* generator) const { - generator->PrintString(SimpleFtoa(val)); + generator->PrintString(!std::isnan(val) ? SimpleFtoa(val) : "nan"); } void TextFormat::FastFieldValuePrinter::PrintDouble( double val, BaseTextGenerator* generator) const { - generator->PrintString(SimpleDtoa(val)); + generator->PrintString(!std::isnan(val) ? SimpleDtoa(val) : "nan"); } void TextFormat::FastFieldValuePrinter::PrintEnum( int32 val, const std::string& name, BaseTextGenerator* generator) const { diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc index fcabc5f6a8..dd507da8b6 100644 --- a/src/google/protobuf/text_format_unittest.cc +++ b/src/google/protobuf/text_format_unittest.cc @@ -36,6 +36,7 @@ #include #include + #include #include @@ -1001,6 +1002,9 @@ TEST_F(TextFormatTest, PrintExotic) { message.add_repeated_double(std::numeric_limits::infinity()); message.add_repeated_double(-std::numeric_limits::infinity()); message.add_repeated_double(std::numeric_limits::quiet_NaN()); + message.add_repeated_double(-std::numeric_limits::quiet_NaN()); + message.add_repeated_double(std::numeric_limits::signaling_NaN()); + message.add_repeated_double(-std::numeric_limits::signaling_NaN()); message.add_repeated_string(std::string("\000\001\a\b\f\n\r\t\v\\\'\"", 12)); // Fun story: We used to use 1.23e22 instead of 1.23e21 above, but this @@ -1023,6 +1027,9 @@ TEST_F(TextFormatTest, PrintExotic) { "repeated_double: inf\n" "repeated_double: -inf\n" "repeated_double: nan\n" + "repeated_double: nan\n" + "repeated_double: nan\n" + "repeated_double: nan\n" "repeated_string: " "\"\\000\\001\\007\\010\\014\\n\\r\\t\\013\\\\\\'\\\"\"\n", RemoveRedundantZeros(message.DebugString())); diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index 01e1acfbce..7e06e289e7 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -153,7 +153,6 @@ void Timestamp::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Timestamp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -195,63 +194,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Timestamp::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Timestamp) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // int64 seconds = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( - input, &seconds_))); - } else { - goto handle_unusual; - } - break; - } - - // int32 nanos = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &nanos_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Timestamp) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Timestamp) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Timestamp::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -262,13 +204,13 @@ failure: // int64 seconds = 1; if (this->seconds() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->seconds(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_seconds(), target); } // int32 nanos = 2; if (this->nanos() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->nanos(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_nanos(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -291,14 +233,14 @@ size_t Timestamp::ByteSizeLong() const { if (this->seconds() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->seconds()); + this->_internal_seconds()); } // int32 nanos = 2; if (this->nanos() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->nanos()); + this->_internal_nanos()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -333,10 +275,10 @@ void Timestamp::MergeFrom(const Timestamp& from) { (void) cached_has_bits; if (from.seconds() != 0) { - set_seconds(from.seconds()); + _internal_set_seconds(from._internal_seconds()); } if (from.nanos() != 0) { - set_nanos(from.nanos()); + _internal_set_nanos(from._internal_nanos()); } } diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index ff9d0d9598..dda0fc1c66 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -150,12 +150,7 @@ class PROTOBUF_EXPORT Timestamp : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -204,11 +199,19 @@ class PROTOBUF_EXPORT Timestamp : void clear_seconds(); ::PROTOBUF_NAMESPACE_ID::int64 seconds() const; void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_seconds() const; + void _internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value); + public: // int32 nanos = 2; void clear_nanos(); ::PROTOBUF_NAMESPACE_ID::int32 nanos() const; void set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_nanos() const; + void _internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Timestamp) private: @@ -238,13 +241,19 @@ class PROTOBUF_EXPORT Timestamp : inline void Timestamp::clear_seconds() { seconds_ = PROTOBUF_LONGLONG(0); } +inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::_internal_seconds() const { + return seconds_; +} inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::seconds() const { // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds) - return seconds_; + return _internal_seconds(); } -inline void Timestamp::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Timestamp::_internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { seconds_ = value; +} +inline void Timestamp::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_seconds(value); // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds) } @@ -252,13 +261,19 @@ inline void Timestamp::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { inline void Timestamp::clear_nanos() { nanos_ = 0; } +inline ::PROTOBUF_NAMESPACE_ID::int32 Timestamp::_internal_nanos() const { + return nanos_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 Timestamp::nanos() const { // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos) - return nanos_; + return _internal_nanos(); } -inline void Timestamp::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Timestamp::_internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { nanos_ = value; +} +inline void Timestamp::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_nanos(value); // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos) } diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index caf16c96c4..949eeed17f 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -414,7 +414,7 @@ Type::Type(const Type& from) name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), GetArenaNoVirtual()); } - if (from.has_source_context()) { + if (from._internal_has_source_context()) { source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); } else { source_context_ = nullptr; @@ -475,7 +475,6 @@ void Type::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -497,7 +496,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_fields(), ptr); + ptr = ctx->ParseMessage(_internal_add_fields(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); @@ -521,7 +520,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_options(), ptr); + ptr = ctx->ParseMessage(_internal_add_options(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); @@ -530,7 +529,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter // .google.protobuf.SourceContext source_context = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { - ptr = ctx->ParseMessage(mutable_source_context(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -539,7 +538,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); - set_syntax(static_cast(val)); + _internal_set_syntax(static_cast(val)); } else goto handle_unusual; continue; default: { @@ -561,115 +560,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Type::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Type) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Type.name")); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Field fields = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_fields())); - } else { - goto handle_unusual; - } - break; - } - - // repeated string oneofs = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_add_oneofs())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - oneofs_.Get(oneofs_.size() - 1).data(), - static_cast(oneofs_.Get(oneofs_.size() - 1).length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Type.oneofs")); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Option options = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_options())); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.SourceContext source_context = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_source_context())); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.Syntax syntax = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (48 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - set_syntax(static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(value)); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Type) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Type) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Type::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -688,17 +578,16 @@ failure: } // repeated .google.protobuf.Field fields = 2; - for (auto it = this->fields_.pointer_begin(), - end = this->fields_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_fields_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(2, **it, target, stream); + InternalWriteMessageToArray(2, this->_internal_fields(i), target, stream); } // repeated string oneofs = 3; - for (auto it = oneofs_.pointer_begin(), - end = oneofs_.pointer_end(); it < end; ++it) { - const auto& s = **it; + for (int i = 0, n = this->_internal_oneofs_size(); i < n; i++) { + const auto& s = this->_internal_oneofs(i); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( s.data(), static_cast(s.length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -707,11 +596,11 @@ failure: } // repeated .google.protobuf.Option options = 4; - for (auto it = this->options_.pointer_begin(), - end = this->options_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_options_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(4, **it, target, stream); + InternalWriteMessageToArray(4, this->_internal_options(i), target, stream); } // .google.protobuf.SourceContext source_context = 5; @@ -726,7 +615,7 @@ failure: if (this->syntax() != 0) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 6, this->syntax(), target); + 6, this->_internal_syntax(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -746,7 +635,7 @@ size_t Type::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.Field fields = 2; - total_size += 1UL * this->fields_size(); + total_size += 1UL * this->_internal_fields_size(); for (const auto& msg : this->fields_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -761,7 +650,7 @@ size_t Type::ByteSizeLong() const { } // repeated .google.protobuf.Option options = 4; - total_size += 1UL * this->options_size(); + total_size += 1UL * this->_internal_options_size(); for (const auto& msg : this->options_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -784,7 +673,7 @@ size_t Type::ByteSizeLong() const { // .google.protobuf.Syntax syntax = 6; if (this->syntax() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->syntax()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -825,10 +714,10 @@ void Type::MergeFrom(const Type& from) { _internal_set_name(from._internal_name()); } if (from.has_source_context()) { - mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from.source_context()); + _internal_mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); } if (from.syntax() != 0) { - set_syntax(from.syntax()); + _internal_set_syntax(from._internal_syntax()); } } @@ -975,7 +864,6 @@ void Field::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -989,7 +877,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); - set_kind(static_cast(val)); + _internal_set_kind(static_cast(val)); } else goto handle_unusual; continue; // .google.protobuf.Field.Cardinality cardinality = 2; @@ -997,7 +885,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); - set_cardinality(static_cast(val)); + _internal_set_cardinality(static_cast(val)); } else goto handle_unusual; continue; // int32 number = 3; @@ -1041,7 +929,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_options(), ptr); + ptr = ctx->ParseMessage(_internal_add_options(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<74>(ptr)); @@ -1080,175 +968,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Field::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Field) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // .google.protobuf.Field.Kind kind = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - set_kind(static_cast< PROTOBUF_NAMESPACE_ID::Field_Kind >(value)); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.Field.Cardinality cardinality = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - set_cardinality(static_cast< PROTOBUF_NAMESPACE_ID::Field_Cardinality >(value)); - } else { - goto handle_unusual; - } - break; - } - - // int32 number = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &number_))); - } else { - goto handle_unusual; - } - break; - } - - // string name = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Field.name")); - } else { - goto handle_unusual; - } - break; - } - - // string type_url = 6; - case 6: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_type_url())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_type_url().data(), static_cast(this->_internal_type_url().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Field.type_url")); - } else { - goto handle_unusual; - } - break; - } - - // int32 oneof_index = 7; - case 7: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (56 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &oneof_index_))); - } else { - goto handle_unusual; - } - break; - } - - // bool packed = 8; - case 8: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (64 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &packed_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Option options = 9; - case 9: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (74 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_options())); - } else { - goto handle_unusual; - } - break; - } - - // string json_name = 10; - case 10: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (82 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_json_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_json_name().data(), static_cast(this->_internal_json_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Field.json_name")); - } else { - goto handle_unusual; - } - break; - } - - // string default_value = 11; - case 11: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (90 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_default_value())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_default_value().data(), static_cast(this->_internal_default_value().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Field.default_value")); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Field) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Field) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Field::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1260,20 +979,20 @@ failure: if (this->kind() != 0) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 1, this->kind(), target); + 1, this->_internal_kind(), target); } // .google.protobuf.Field.Cardinality cardinality = 2; if (this->cardinality() != 0) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 2, this->cardinality(), target); + 2, this->_internal_cardinality(), target); } // int32 number = 3; if (this->number() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->number(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_number(), target); } // string name = 4; @@ -1299,21 +1018,21 @@ failure: // int32 oneof_index = 7; if (this->oneof_index() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(7, this->oneof_index(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(7, this->_internal_oneof_index(), target); } // bool packed = 8; if (this->packed() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(8, this->packed(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(8, this->_internal_packed(), target); } // repeated .google.protobuf.Option options = 9; - for (auto it = this->options_.pointer_begin(), - end = this->options_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_options_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(9, **it, target, stream); + InternalWriteMessageToArray(9, this->_internal_options(i), target, stream); } // string json_name = 10; @@ -1353,7 +1072,7 @@ size_t Field::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.Option options = 9; - total_size += 1UL * this->options_size(); + total_size += 1UL * this->_internal_options_size(); for (const auto& msg : this->options_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -1390,27 +1109,27 @@ size_t Field::ByteSizeLong() const { // .google.protobuf.Field.Kind kind = 1; if (this->kind() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->kind()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_kind()); } // .google.protobuf.Field.Cardinality cardinality = 2; if (this->cardinality() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->cardinality()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_cardinality()); } // int32 number = 3; if (this->number() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->number()); + this->_internal_number()); } // int32 oneof_index = 7; if (this->oneof_index() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->oneof_index()); + this->_internal_oneof_index()); } // bool packed = 8; @@ -1463,19 +1182,19 @@ void Field::MergeFrom(const Field& from) { _internal_set_default_value(from._internal_default_value()); } if (from.kind() != 0) { - set_kind(from.kind()); + _internal_set_kind(from._internal_kind()); } if (from.cardinality() != 0) { - set_cardinality(from.cardinality()); + _internal_set_cardinality(from._internal_cardinality()); } if (from.number() != 0) { - set_number(from.number()); + _internal_set_number(from._internal_number()); } if (from.oneof_index() != 0) { - set_oneof_index(from.oneof_index()); + _internal_set_oneof_index(from._internal_oneof_index()); } if (from.packed() != 0) { - set_packed(from.packed()); + _internal_set_packed(from._internal_packed()); } } @@ -1580,7 +1299,7 @@ Enum::Enum(const Enum& from) name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), GetArenaNoVirtual()); } - if (from.has_source_context()) { + if (from._internal_has_source_context()) { source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); } else { source_context_ = nullptr; @@ -1640,7 +1359,6 @@ void Enum::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -1662,7 +1380,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_enumvalue(), ptr); + ptr = ctx->ParseMessage(_internal_add_enumvalue(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); @@ -1674,7 +1392,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_options(), ptr); + ptr = ctx->ParseMessage(_internal_add_options(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); @@ -1683,7 +1401,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter // .google.protobuf.SourceContext source_context = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { - ptr = ctx->ParseMessage(mutable_source_context(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -1692,7 +1410,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); - set_syntax(static_cast(val)); + _internal_set_syntax(static_cast(val)); } else goto handle_unusual; continue; default: { @@ -1714,99 +1432,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Enum::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Enum) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Enum.name")); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.EnumValue enumvalue = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_enumvalue())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Option options = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_options())); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.SourceContext source_context = 4; - case 4: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_source_context())); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.Syntax syntax = 5; - case 5: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (40 & 0xFF)) { - int value = 0; - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - set_syntax(static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(value)); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Enum) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Enum) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Enum::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1825,19 +1450,19 @@ failure: } // repeated .google.protobuf.EnumValue enumvalue = 2; - for (auto it = this->enumvalue_.pointer_begin(), - end = this->enumvalue_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_enumvalue_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(2, **it, target, stream); + InternalWriteMessageToArray(2, this->_internal_enumvalue(i), target, stream); } // repeated .google.protobuf.Option options = 3; - for (auto it = this->options_.pointer_begin(), - end = this->options_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_options_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(3, **it, target, stream); + InternalWriteMessageToArray(3, this->_internal_options(i), target, stream); } // .google.protobuf.SourceContext source_context = 4; @@ -1852,7 +1477,7 @@ failure: if (this->syntax() != 0) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( - 5, this->syntax(), target); + 5, this->_internal_syntax(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1872,14 +1497,14 @@ size_t Enum::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.EnumValue enumvalue = 2; - total_size += 1UL * this->enumvalue_size(); + total_size += 1UL * this->_internal_enumvalue_size(); for (const auto& msg : this->enumvalue_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } // repeated .google.protobuf.Option options = 3; - total_size += 1UL * this->options_size(); + total_size += 1UL * this->_internal_options_size(); for (const auto& msg : this->options_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -1902,7 +1527,7 @@ size_t Enum::ByteSizeLong() const { // .google.protobuf.Syntax syntax = 5; if (this->syntax() != 0) { total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->syntax()); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1942,10 +1567,10 @@ void Enum::MergeFrom(const Enum& from) { _internal_set_name(from._internal_name()); } if (from.has_source_context()) { - mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from.source_context()); + _internal_mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); } if (from.syntax() != 0) { - set_syntax(from.syntax()); + _internal_set_syntax(from._internal_syntax()); } } @@ -2061,7 +1686,6 @@ void EnumValue::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -2090,7 +1714,7 @@ const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: ptr -= 1; do { ptr += 1; - ptr = ctx->ParseMessage(add_options(), ptr); + ptr = ctx->ParseMessage(_internal_add_options(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); @@ -2115,76 +1739,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool EnumValue::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.EnumValue) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.EnumValue.name")); - } else { - goto handle_unusual; - } - break; - } - - // int32 number = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &number_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .google.protobuf.Option options = 3; - case 3: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, add_options())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.EnumValue) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.EnumValue) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* EnumValue::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -2205,15 +1759,15 @@ failure: // int32 number = 2; if (this->number() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->number(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_number(), target); } // repeated .google.protobuf.Option options = 3; - for (auto it = this->options_.pointer_begin(), - end = this->options_.pointer_end(); it < end; ++it) { + for (unsigned int i = 0, + n = static_cast(this->_internal_options_size()); i < n; i++) { stream->EnsureSpace(&target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessageToArray(3, **it, target, stream); + InternalWriteMessageToArray(3, this->_internal_options(i), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -2233,7 +1787,7 @@ size_t EnumValue::ByteSizeLong() const { (void) cached_has_bits; // repeated .google.protobuf.Option options = 3; - total_size += 1UL * this->options_size(); + total_size += 1UL * this->_internal_options_size(); for (const auto& msg : this->options_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); @@ -2250,7 +1804,7 @@ size_t EnumValue::ByteSizeLong() const { if (this->number() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->number()); + this->_internal_number()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -2289,7 +1843,7 @@ void EnumValue::MergeFrom(const EnumValue& from) { _internal_set_name(from._internal_name()); } if (from.number() != 0) { - set_number(from.number()); + _internal_set_number(from._internal_number()); } } @@ -2380,7 +1934,7 @@ Option::Option(const Option& from) name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), GetArenaNoVirtual()); } - if (from.has_value()) { + if (from._internal_has_value()) { value_ = new PROTOBUF_NAMESPACE_ID::Any(*from.value_); } else { value_ = nullptr; @@ -2434,7 +1988,6 @@ void Option::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Option::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -2453,7 +2006,7 @@ const char* Option::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int // .google.protobuf.Any value = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { - ptr = ctx->ParseMessage(mutable_value(), ptr); + ptr = ctx->ParseMessage(_internal_mutable_value(), ptr); CHK_(ptr); } else goto handle_unusual; continue; @@ -2476,63 +2029,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Option::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Option) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string name = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_name())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.Option.name")); - } else { - goto handle_unusual; - } - break; - } - - // .google.protobuf.Any value = 2; - case 2: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage( - input, mutable_value())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Option) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Option) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Option::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -2623,7 +2119,7 @@ void Option::MergeFrom(const Option& from) { _internal_set_name(from._internal_name()); } if (from.has_value()) { - mutable_value()->PROTOBUF_NAMESPACE_ID::Any::MergeFrom(from.value()); + _internal_mutable_value()->PROTOBUF_NAMESPACE_ID::Any::MergeFrom(from._internal_value()); } } diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index b60e23432e..88feaadfc1 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -263,12 +263,7 @@ class PROTOBUF_EXPORT Type : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -319,10 +314,17 @@ class PROTOBUF_EXPORT Type : }; // repeated .google.protobuf.Field fields = 2; int fields_size() const; + private: + int _internal_fields_size() const; + public: void clear_fields(); PROTOBUF_NAMESPACE_ID::Field* mutable_fields(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Field >* mutable_fields(); + private: + const PROTOBUF_NAMESPACE_ID::Field& _internal_fields(int index) const; + PROTOBUF_NAMESPACE_ID::Field* _internal_add_fields(); + public: const PROTOBUF_NAMESPACE_ID::Field& fields(int index) const; PROTOBUF_NAMESPACE_ID::Field* add_fields(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Field >& @@ -330,6 +332,9 @@ class PROTOBUF_EXPORT Type : // repeated string oneofs = 3; int oneofs_size() const; + private: + int _internal_oneofs_size() const; + public: void clear_oneofs(); const std::string& oneofs(int index) const; std::string* mutable_oneofs(int index); @@ -345,15 +350,23 @@ class PROTOBUF_EXPORT Type : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& oneofs() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_oneofs(); private: + const std::string& _internal_oneofs(int index) const; std::string* _internal_add_oneofs(); public: // repeated .google.protobuf.Option options = 4; int options_size() const; + private: + int _internal_options_size() const; + public: void clear_options(); PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); + private: + const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + public: const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; PROTOBUF_NAMESPACE_ID::Option* add_options(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& @@ -394,6 +407,10 @@ class PROTOBUF_EXPORT Type : PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + private: + const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; + PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); + public: void unsafe_arena_set_allocated_source_context( PROTOBUF_NAMESPACE_ID::SourceContext* source_context); PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); @@ -402,6 +419,10 @@ class PROTOBUF_EXPORT Type : void clear_syntax(); PROTOBUF_NAMESPACE_ID::Syntax syntax() const; void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + private: + PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Type) private: @@ -506,12 +527,7 @@ class PROTOBUF_EXPORT Field : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -664,10 +680,17 @@ class PROTOBUF_EXPORT Field : }; // repeated .google.protobuf.Option options = 9; int options_size() const; + private: + int _internal_options_size() const; + public: void clear_options(); PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); + private: + const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + public: const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; PROTOBUF_NAMESPACE_ID::Option* add_options(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& @@ -777,26 +800,46 @@ class PROTOBUF_EXPORT Field : void clear_kind(); PROTOBUF_NAMESPACE_ID::Field_Kind kind() const; void set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value); + private: + PROTOBUF_NAMESPACE_ID::Field_Kind _internal_kind() const; + void _internal_set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value); + public: // .google.protobuf.Field.Cardinality cardinality = 2; void clear_cardinality(); PROTOBUF_NAMESPACE_ID::Field_Cardinality cardinality() const; void set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value); + private: + PROTOBUF_NAMESPACE_ID::Field_Cardinality _internal_cardinality() const; + void _internal_set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value); + public: // int32 number = 3; void clear_number(); ::PROTOBUF_NAMESPACE_ID::int32 number() const; void set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const; + void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // int32 oneof_index = 7; void clear_oneof_index(); ::PROTOBUF_NAMESPACE_ID::int32 oneof_index() const; void set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_oneof_index() const; + void _internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // bool packed = 8; void clear_packed(); bool packed() const; void set_packed(bool value); + private: + bool _internal_packed() const; + void _internal_set_packed(bool value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Field) private: @@ -905,12 +948,7 @@ class PROTOBUF_EXPORT Enum : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -960,10 +998,17 @@ class PROTOBUF_EXPORT Enum : }; // repeated .google.protobuf.EnumValue enumvalue = 2; int enumvalue_size() const; + private: + int _internal_enumvalue_size() const; + public: void clear_enumvalue(); PROTOBUF_NAMESPACE_ID::EnumValue* mutable_enumvalue(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValue >* mutable_enumvalue(); + private: + const PROTOBUF_NAMESPACE_ID::EnumValue& _internal_enumvalue(int index) const; + PROTOBUF_NAMESPACE_ID::EnumValue* _internal_add_enumvalue(); + public: const PROTOBUF_NAMESPACE_ID::EnumValue& enumvalue(int index) const; PROTOBUF_NAMESPACE_ID::EnumValue* add_enumvalue(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValue >& @@ -971,10 +1016,17 @@ class PROTOBUF_EXPORT Enum : // repeated .google.protobuf.Option options = 3; int options_size() const; + private: + int _internal_options_size() const; + public: void clear_options(); PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); + private: + const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + public: const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; PROTOBUF_NAMESPACE_ID::Option* add_options(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& @@ -1015,6 +1067,10 @@ class PROTOBUF_EXPORT Enum : PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + private: + const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; + PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); + public: void unsafe_arena_set_allocated_source_context( PROTOBUF_NAMESPACE_ID::SourceContext* source_context); PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); @@ -1023,6 +1079,10 @@ class PROTOBUF_EXPORT Enum : void clear_syntax(); PROTOBUF_NAMESPACE_ID::Syntax syntax() const; void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + private: + PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Enum) private: @@ -1126,12 +1186,7 @@ class PROTOBUF_EXPORT EnumValue : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1179,10 +1234,17 @@ class PROTOBUF_EXPORT EnumValue : }; // repeated .google.protobuf.Option options = 3; int options_size() const; + private: + int _internal_options_size() const; + public: void clear_options(); PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); + private: + const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + public: const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; PROTOBUF_NAMESPACE_ID::Option* add_options(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& @@ -1217,6 +1279,10 @@ class PROTOBUF_EXPORT EnumValue : void clear_number(); ::PROTOBUF_NAMESPACE_ID::int32 number() const; void set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const; + void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.EnumValue) private: @@ -1318,12 +1384,7 @@ class PROTOBUF_EXPORT Option : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1403,6 +1464,10 @@ class PROTOBUF_EXPORT Option : PROTOBUF_NAMESPACE_ID::Any* release_value(); PROTOBUF_NAMESPACE_ID::Any* mutable_value(); void set_allocated_value(PROTOBUF_NAMESPACE_ID::Any* value); + private: + const PROTOBUF_NAMESPACE_ID::Any& _internal_value() const; + PROTOBUF_NAMESPACE_ID::Any* _internal_mutable_value(); + public: void unsafe_arena_set_allocated_value( PROTOBUF_NAMESPACE_ID::Any* value); PROTOBUF_NAMESPACE_ID::Any* unsafe_arena_release_value(); @@ -1514,9 +1579,12 @@ inline void Type::unsafe_arena_set_allocated_name( } // repeated .google.protobuf.Field fields = 2; -inline int Type::fields_size() const { +inline int Type::_internal_fields_size() const { return fields_.size(); } +inline int Type::fields_size() const { + return _internal_fields_size(); +} inline void Type::clear_fields() { fields_.Clear(); } @@ -1529,13 +1597,19 @@ Type::mutable_fields() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.fields) return &fields_; } +inline const PROTOBUF_NAMESPACE_ID::Field& Type::_internal_fields(int index) const { + return fields_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Field& Type::fields(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Type.fields) - return fields_.Get(index); + return _internal_fields(index); +} +inline PROTOBUF_NAMESPACE_ID::Field* Type::_internal_add_fields() { + return fields_.Add(); } inline PROTOBUF_NAMESPACE_ID::Field* Type::add_fields() { // @@protoc_insertion_point(field_add:google.protobuf.Type.fields) - return fields_.Add(); + return _internal_add_fields(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Field >& Type::fields() const { @@ -1544,9 +1618,12 @@ Type::fields() const { } // repeated string oneofs = 3; -inline int Type::oneofs_size() const { +inline int Type::_internal_oneofs_size() const { return oneofs_.size(); } +inline int Type::oneofs_size() const { + return _internal_oneofs_size(); +} inline void Type::clear_oneofs() { oneofs_.Clear(); } @@ -1554,9 +1631,12 @@ inline std::string* Type::add_oneofs() { // @@protoc_insertion_point(field_add_mutable:google.protobuf.Type.oneofs) return _internal_add_oneofs(); } +inline const std::string& Type::_internal_oneofs(int index) const { + return oneofs_.Get(index); +} inline const std::string& Type::oneofs(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Type.oneofs) - return oneofs_.Get(index); + return _internal_oneofs(index); } inline std::string* Type::mutable_oneofs(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Type.oneofs) @@ -1612,9 +1692,12 @@ Type::mutable_oneofs() { } // repeated .google.protobuf.Option options = 4; -inline int Type::options_size() const { +inline int Type::_internal_options_size() const { return options_.size(); } +inline int Type::options_size() const { + return _internal_options_size(); +} inline void Type::clear_options() { options_.Clear(); } @@ -1627,13 +1710,19 @@ Type::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.options) return &options_; } +inline const PROTOBUF_NAMESPACE_ID::Option& Type::_internal_options(int index) const { + return options_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Option& Type::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Type.options) - return options_.Get(index); + return _internal_options(index); +} +inline PROTOBUF_NAMESPACE_ID::Option* Type::_internal_add_options() { + return options_.Add(); } inline PROTOBUF_NAMESPACE_ID::Option* Type::add_options() { // @@protoc_insertion_point(field_add:google.protobuf.Type.options) - return options_.Add(); + return _internal_add_options(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& Type::options() const { @@ -1642,15 +1731,21 @@ Type::options() const { } // .google.protobuf.SourceContext source_context = 5; -inline bool Type::has_source_context() const { +inline bool Type::_internal_has_source_context() const { return this != internal_default_instance() && source_context_ != nullptr; } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Type::source_context() const { +inline bool Type::has_source_context() const { + return _internal_has_source_context(); +} +inline const PROTOBUF_NAMESPACE_ID::SourceContext& Type::_internal_source_context() const { const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; - // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::SourceContext& Type::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context) + return _internal_source_context(); +} inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::release_source_context() { auto temp = unsafe_arena_release_source_context(); if (GetArenaNoVirtual() != nullptr) { @@ -1665,15 +1760,18 @@ inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::unsafe_arena_release_source_c source_context_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::mutable_source_context() { +inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::_internal_mutable_source_context() { if (source_context_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); source_context_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) return source_context_; } +inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::mutable_source_context() { + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) + return _internal_mutable_source_context(); +} inline void Type::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -1697,13 +1795,19 @@ inline void Type::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceCont inline void Type::clear_syntax() { syntax_ = 0; } +inline PROTOBUF_NAMESPACE_ID::Syntax Type::_internal_syntax() const { + return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +} inline PROTOBUF_NAMESPACE_ID::Syntax Type::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Type.syntax) - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); + return _internal_syntax(); } -inline void Type::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Type::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; +} +inline void Type::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { + _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Type.syntax) } @@ -1715,13 +1819,19 @@ inline void Type::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { inline void Field::clear_kind() { kind_ = 0; } +inline PROTOBUF_NAMESPACE_ID::Field_Kind Field::_internal_kind() const { + return static_cast< PROTOBUF_NAMESPACE_ID::Field_Kind >(kind_); +} inline PROTOBUF_NAMESPACE_ID::Field_Kind Field::kind() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.kind) - return static_cast< PROTOBUF_NAMESPACE_ID::Field_Kind >(kind_); + return _internal_kind(); } -inline void Field::set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value) { +inline void Field::_internal_set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value) { kind_ = value; +} +inline void Field::set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value) { + _internal_set_kind(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.kind) } @@ -1729,13 +1839,19 @@ inline void Field::set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value) { inline void Field::clear_cardinality() { cardinality_ = 0; } +inline PROTOBUF_NAMESPACE_ID::Field_Cardinality Field::_internal_cardinality() const { + return static_cast< PROTOBUF_NAMESPACE_ID::Field_Cardinality >(cardinality_); +} inline PROTOBUF_NAMESPACE_ID::Field_Cardinality Field::cardinality() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.cardinality) - return static_cast< PROTOBUF_NAMESPACE_ID::Field_Cardinality >(cardinality_); + return _internal_cardinality(); } -inline void Field::set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value) { +inline void Field::_internal_set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value) { cardinality_ = value; +} +inline void Field::set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value) { + _internal_set_cardinality(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.cardinality) } @@ -1743,13 +1859,19 @@ inline void Field::set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality valu inline void Field::clear_number() { number_ = 0; } +inline ::PROTOBUF_NAMESPACE_ID::int32 Field::_internal_number() const { + return number_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 Field::number() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.number) - return number_; + return _internal_number(); } -inline void Field::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Field::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { number_ = value; +} +inline void Field::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_number(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.number) } @@ -1921,13 +2043,19 @@ inline void Field::unsafe_arena_set_allocated_type_url( inline void Field::clear_oneof_index() { oneof_index_ = 0; } +inline ::PROTOBUF_NAMESPACE_ID::int32 Field::_internal_oneof_index() const { + return oneof_index_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 Field::oneof_index() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index) - return oneof_index_; + return _internal_oneof_index(); } -inline void Field::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Field::_internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { oneof_index_ = value; +} +inline void Field::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_oneof_index(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index) } @@ -1935,20 +2063,29 @@ inline void Field::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { inline void Field::clear_packed() { packed_ = false; } +inline bool Field::_internal_packed() const { + return packed_; +} inline bool Field::packed() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.packed) - return packed_; + return _internal_packed(); } -inline void Field::set_packed(bool value) { +inline void Field::_internal_set_packed(bool value) { packed_ = value; +} +inline void Field::set_packed(bool value) { + _internal_set_packed(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.packed) } // repeated .google.protobuf.Option options = 9; -inline int Field::options_size() const { +inline int Field::_internal_options_size() const { return options_.size(); } +inline int Field::options_size() const { + return _internal_options_size(); +} inline void Field::clear_options() { options_.Clear(); } @@ -1961,13 +2098,19 @@ Field::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Field.options) return &options_; } +inline const PROTOBUF_NAMESPACE_ID::Option& Field::_internal_options(int index) const { + return options_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Option& Field::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Field.options) - return options_.Get(index); + return _internal_options(index); +} +inline PROTOBUF_NAMESPACE_ID::Option* Field::_internal_add_options() { + return options_.Add(); } inline PROTOBUF_NAMESPACE_ID::Option* Field::add_options() { // @@protoc_insertion_point(field_add:google.protobuf.Field.options) - return options_.Add(); + return _internal_add_options(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& Field::options() const { @@ -2226,9 +2369,12 @@ inline void Enum::unsafe_arena_set_allocated_name( } // repeated .google.protobuf.EnumValue enumvalue = 2; -inline int Enum::enumvalue_size() const { +inline int Enum::_internal_enumvalue_size() const { return enumvalue_.size(); } +inline int Enum::enumvalue_size() const { + return _internal_enumvalue_size(); +} inline void Enum::clear_enumvalue() { enumvalue_.Clear(); } @@ -2241,13 +2387,19 @@ Enum::mutable_enumvalue() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.enumvalue) return &enumvalue_; } +inline const PROTOBUF_NAMESPACE_ID::EnumValue& Enum::_internal_enumvalue(int index) const { + return enumvalue_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::EnumValue& Enum::enumvalue(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue) - return enumvalue_.Get(index); + return _internal_enumvalue(index); +} +inline PROTOBUF_NAMESPACE_ID::EnumValue* Enum::_internal_add_enumvalue() { + return enumvalue_.Add(); } inline PROTOBUF_NAMESPACE_ID::EnumValue* Enum::add_enumvalue() { // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue) - return enumvalue_.Add(); + return _internal_add_enumvalue(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValue >& Enum::enumvalue() const { @@ -2256,9 +2408,12 @@ Enum::enumvalue() const { } // repeated .google.protobuf.Option options = 3; -inline int Enum::options_size() const { +inline int Enum::_internal_options_size() const { return options_.size(); } +inline int Enum::options_size() const { + return _internal_options_size(); +} inline void Enum::clear_options() { options_.Clear(); } @@ -2271,13 +2426,19 @@ Enum::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.options) return &options_; } +inline const PROTOBUF_NAMESPACE_ID::Option& Enum::_internal_options(int index) const { + return options_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Option& Enum::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.options) - return options_.Get(index); + return _internal_options(index); +} +inline PROTOBUF_NAMESPACE_ID::Option* Enum::_internal_add_options() { + return options_.Add(); } inline PROTOBUF_NAMESPACE_ID::Option* Enum::add_options() { // @@protoc_insertion_point(field_add:google.protobuf.Enum.options) - return options_.Add(); + return _internal_add_options(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& Enum::options() const { @@ -2286,15 +2447,21 @@ Enum::options() const { } // .google.protobuf.SourceContext source_context = 4; -inline bool Enum::has_source_context() const { +inline bool Enum::_internal_has_source_context() const { return this != internal_default_instance() && source_context_ != nullptr; } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Enum::source_context() const { +inline bool Enum::has_source_context() const { + return _internal_has_source_context(); +} +inline const PROTOBUF_NAMESPACE_ID::SourceContext& Enum::_internal_source_context() const { const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; - // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::SourceContext& Enum::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context) + return _internal_source_context(); +} inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::release_source_context() { auto temp = unsafe_arena_release_source_context(); if (GetArenaNoVirtual() != nullptr) { @@ -2309,15 +2476,18 @@ inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::unsafe_arena_release_source_c source_context_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::mutable_source_context() { +inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::_internal_mutable_source_context() { if (source_context_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); source_context_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) return source_context_; } +inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::mutable_source_context() { + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) + return _internal_mutable_source_context(); +} inline void Enum::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { @@ -2341,13 +2511,19 @@ inline void Enum::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceCont inline void Enum::clear_syntax() { syntax_ = 0; } +inline PROTOBUF_NAMESPACE_ID::Syntax Enum::_internal_syntax() const { + return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +} inline PROTOBUF_NAMESPACE_ID::Syntax Enum::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.syntax) - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); + return _internal_syntax(); } -inline void Enum::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Enum::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; +} +inline void Enum::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { + _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Enum.syntax) } @@ -2441,20 +2617,29 @@ inline void EnumValue::unsafe_arena_set_allocated_name( inline void EnumValue::clear_number() { number_ = 0; } +inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValue::_internal_number() const { + return number_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValue::number() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number) - return number_; + return _internal_number(); } -inline void EnumValue::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumValue::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { number_ = value; +} +inline void EnumValue::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_number(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number) } // repeated .google.protobuf.Option options = 3; -inline int EnumValue::options_size() const { +inline int EnumValue::_internal_options_size() const { return options_.size(); } +inline int EnumValue::options_size() const { + return _internal_options_size(); +} inline void EnumValue::clear_options() { options_.Clear(); } @@ -2467,13 +2652,19 @@ EnumValue::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValue.options) return &options_; } +inline const PROTOBUF_NAMESPACE_ID::Option& EnumValue::_internal_options(int index) const { + return options_.Get(index); +} inline const PROTOBUF_NAMESPACE_ID::Option& EnumValue::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options) - return options_.Get(index); + return _internal_options(index); +} +inline PROTOBUF_NAMESPACE_ID::Option* EnumValue::_internal_add_options() { + return options_.Add(); } inline PROTOBUF_NAMESPACE_ID::Option* EnumValue::add_options() { // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options) - return options_.Add(); + return _internal_add_options(); } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& EnumValue::options() const { @@ -2568,15 +2759,21 @@ inline void Option::unsafe_arena_set_allocated_name( } // .google.protobuf.Any value = 2; -inline bool Option::has_value() const { +inline bool Option::_internal_has_value() const { return this != internal_default_instance() && value_ != nullptr; } -inline const PROTOBUF_NAMESPACE_ID::Any& Option::value() const { +inline bool Option::has_value() const { + return _internal_has_value(); +} +inline const PROTOBUF_NAMESPACE_ID::Any& Option::_internal_value() const { const PROTOBUF_NAMESPACE_ID::Any* p = value_; - // @@protoc_insertion_point(field_get:google.protobuf.Option.value) return p != nullptr ? *p : *reinterpret_cast( &PROTOBUF_NAMESPACE_ID::_Any_default_instance_); } +inline const PROTOBUF_NAMESPACE_ID::Any& Option::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Option.value) + return _internal_value(); +} inline PROTOBUF_NAMESPACE_ID::Any* Option::release_value() { auto temp = unsafe_arena_release_value(); if (GetArenaNoVirtual() != nullptr) { @@ -2591,15 +2788,18 @@ inline PROTOBUF_NAMESPACE_ID::Any* Option::unsafe_arena_release_value() { value_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::Any* Option::mutable_value() { +inline PROTOBUF_NAMESPACE_ID::Any* Option::_internal_mutable_value() { if (value_ == nullptr) { auto* p = CreateMaybeMessage(GetArenaNoVirtual()); value_ = p; } - // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) return value_; } +inline PROTOBUF_NAMESPACE_ID::Any* Option::mutable_value() { + // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) + return _internal_mutable_value(); +} inline void Option::set_allocated_value(PROTOBUF_NAMESPACE_ID::Any* value) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == nullptr) { diff --git a/src/google/protobuf/unknown_field_set.cc b/src/google/protobuf/unknown_field_set.cc index 935b760bd6..fcffe85fcd 100644 --- a/src/google/protobuf/unknown_field_set.cc +++ b/src/google/protobuf/unknown_field_set.cc @@ -278,7 +278,6 @@ uint8* UnknownField::InternalSerializeLengthDelimitedNoTag( return target; } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER namespace internal { const char* PackedEnumParser(void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(int), @@ -359,7 +358,5 @@ const char* UnknownFieldParse(uint32 tag, InternalMetadataWithArena* metadata, } } // namespace internal -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/unknown_field_set.h b/src/google/protobuf/unknown_field_set.h index 4d46ff4692..5973c3e36f 100644 --- a/src/google/protobuf/unknown_field_set.h +++ b/src/google/protobuf/unknown_field_set.h @@ -178,7 +178,6 @@ class PROTOBUF_EXPORT UnknownFieldSet { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(UnknownFieldSet); }; -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER namespace internal { inline void WriteVarint(uint32 num, uint64 val, UnknownFieldSet* unknown) { @@ -212,7 +211,6 @@ const char* UnknownFieldParse(uint32 tag, InternalMetadataWithArena* metadata, const char* ptr, ParseContext* ctx); } // namespace internal -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER // Represents one field in an UnknownFieldSet. class PROTOBUF_EXPORT UnknownField { diff --git a/src/google/protobuf/util/field_mask_util.h b/src/google/protobuf/util/field_mask_util.h index 3e7a93e25a..75ea520642 100644 --- a/src/google/protobuf/util/field_mask_util.h +++ b/src/google/protobuf/util/field_mask_util.h @@ -37,8 +37,9 @@ #include #include -#include +#include +// Must be included last. #include namespace google { diff --git a/src/google/protobuf/util/internal/datapiece.h b/src/google/protobuf/util/internal/datapiece.h index e1e892b0f1..cc5553d051 100644 --- a/src/google/protobuf/util/internal/datapiece.h +++ b/src/google/protobuf/util/internal/datapiece.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/google/protobuf/util/internal/default_value_objectwriter.h b/src/google/protobuf/util/internal/default_value_objectwriter.h index 2975513a9a..e311309675 100644 --- a/src/google/protobuf/util/internal/default_value_objectwriter.h +++ b/src/google/protobuf/util/internal/default_value_objectwriter.h @@ -42,7 +42,7 @@ #include #include #include -#include +#include // Must be included last. #include diff --git a/src/google/protobuf/util/internal/error_listener.h b/src/google/protobuf/util/internal/error_listener.h index c2b7560d93..07cb95701d 100644 --- a/src/google/protobuf/util/internal/error_listener.h +++ b/src/google/protobuf/util/internal/error_listener.h @@ -40,8 +40,9 @@ #include #include #include -#include +#include +// Must be included last. #include namespace google { diff --git a/src/google/protobuf/util/internal/field_mask_utility.cc b/src/google/protobuf/util/internal/field_mask_utility.cc index 27e5afa417..74586d427b 100644 --- a/src/google/protobuf/util/internal/field_mask_utility.cc +++ b/src/google/protobuf/util/internal/field_mask_utility.cc @@ -34,6 +34,7 @@ #include #include +// Must be included last. #include namespace google { diff --git a/src/google/protobuf/util/internal/field_mask_utility.h b/src/google/protobuf/util/internal/field_mask_utility.h index 4e369a650c..7335af506b 100644 --- a/src/google/protobuf/util/internal/field_mask_utility.h +++ b/src/google/protobuf/util/internal/field_mask_utility.h @@ -38,7 +38,7 @@ #include #include -#include +#include #include namespace google { diff --git a/src/google/protobuf/util/internal/json_stream_parser.h b/src/google/protobuf/util/internal/json_stream_parser.h index b2e1866976..3370c87a12 100644 --- a/src/google/protobuf/util/internal/json_stream_parser.h +++ b/src/google/protobuf/util/internal/json_stream_parser.h @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include diff --git a/src/google/protobuf/util/internal/json_stream_parser_test.cc b/src/google/protobuf/util/internal/json_stream_parser_test.cc index b7db879082..f9f36147bb 100644 --- a/src/google/protobuf/util/internal/json_stream_parser_test.cc +++ b/src/google/protobuf/util/internal/json_stream_parser_test.cc @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/src/google/protobuf/util/internal/object_source.h b/src/google/protobuf/util/internal/object_source.h index c8ee36fbc0..28b1aaec9d 100644 --- a/src/google/protobuf/util/internal/object_source.h +++ b/src/google/protobuf/util/internal/object_source.h @@ -32,9 +32,10 @@ #define GOOGLE_PROTOBUF_UTIL_CONVERTER_OBJECT_SOURCE_H__ #include -#include +#include #include +// Must be included last. #include namespace google { diff --git a/src/google/protobuf/util/internal/object_writer.h b/src/google/protobuf/util/internal/object_writer.h index 6e0830e93e..856d77d074 100644 --- a/src/google/protobuf/util/internal/object_writer.h +++ b/src/google/protobuf/util/internal/object_writer.h @@ -32,8 +32,9 @@ #define GOOGLE_PROTOBUF_UTIL_CONVERTER_OBJECT_WRITER_H__ #include -#include +#include +// Must be included last. #include namespace google { diff --git a/src/google/protobuf/util/internal/protostream_objectsource.h b/src/google/protobuf/util/internal/protostream_objectsource.h index 366b45cdff..9a9a74c318 100644 --- a/src/google/protobuf/util/internal/protostream_objectsource.h +++ b/src/google/protobuf/util/internal/protostream_objectsource.h @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/google/protobuf/util/internal/protostream_objectsource_test.cc b/src/google/protobuf/util/internal/protostream_objectsource_test.cc index dc2875ab4b..c67aeea859 100644 --- a/src/google/protobuf/util/internal/protostream_objectsource_test.cc +++ b/src/google/protobuf/util/internal/protostream_objectsource_test.cc @@ -47,7 +47,6 @@ #include #include #include -#include #include #include diff --git a/src/google/protobuf/util/internal/type_info.cc b/src/google/protobuf/util/internal/type_info.cc index d9a59ca0e9..818df64172 100644 --- a/src/google/protobuf/util/internal/type_info.cc +++ b/src/google/protobuf/util/internal/type_info.cc @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/google/protobuf/util/internal/type_info.h b/src/google/protobuf/util/internal/type_info.h index b933b77ad7..eb5c8576a1 100644 --- a/src/google/protobuf/util/internal/type_info.h +++ b/src/google/protobuf/util/internal/type_info.h @@ -34,10 +34,11 @@ #include #include #include -#include +#include #include #include +// Must be included last. #include namespace google { diff --git a/src/google/protobuf/util/internal/utility.h b/src/google/protobuf/util/internal/utility.h index 703d2a7604..37a998e91b 100644 --- a/src/google/protobuf/util/internal/utility.h +++ b/src/google/protobuf/util/internal/utility.h @@ -41,10 +41,10 @@ #include #include #include -#include #include #include +// Must be included last. #include namespace google { diff --git a/src/google/protobuf/util/json_format_proto3.proto b/src/google/protobuf/util/json_format_proto3.proto index 1e72794d45..b62487a578 100644 --- a/src/google/protobuf/util/json_format_proto3.proto +++ b/src/google/protobuf/util/json_format_proto3.proto @@ -113,6 +113,10 @@ message TestNestedMap { map map_map = 7; } +message TestStringMap { + map string_map = 1; +} + message TestWrapper { google.protobuf.BoolValue bool_value = 1; google.protobuf.Int32Value int32_value = 2; diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 84087326fb..2a5598a32a 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -368,7 +368,6 @@ void DoubleValue::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* DoubleValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -403,50 +402,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool DoubleValue::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.DoubleValue) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // double value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (9 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - double, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_DOUBLE>( - input, &value_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.DoubleValue) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.DoubleValue) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* DoubleValue::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -457,7 +412,7 @@ failure: // double value = 1; if (!(this->value() <= 0 && this->value() >= 0)) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->_internal_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -513,7 +468,7 @@ void DoubleValue::MergeFrom(const DoubleValue& from) { (void) cached_has_bits; if (!(from.value() <= 0 && from.value() >= 0)) { - set_value(from.value()); + _internal_set_value(from._internal_value()); } } @@ -612,7 +567,6 @@ void FloatValue::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* FloatValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -647,50 +601,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool FloatValue::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.FloatValue) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // float value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (13 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - float, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_FLOAT>( - input, &value_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.FloatValue) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.FloatValue) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* FloatValue::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -701,7 +611,7 @@ failure: // float value = 1; if (!(this->value() <= 0 && this->value() >= 0)) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -757,7 +667,7 @@ void FloatValue::MergeFrom(const FloatValue& from) { (void) cached_has_bits; if (!(from.value() <= 0 && from.value() >= 0)) { - set_value(from.value()); + _internal_set_value(from._internal_value()); } } @@ -856,7 +766,6 @@ void Int64Value::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Int64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -891,50 +800,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Int64Value::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Int64Value) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // int64 value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( - input, &value_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Int64Value) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Int64Value) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Int64Value::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -945,7 +810,7 @@ failure: // int64 value = 1; if (this->value() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -968,7 +833,7 @@ size_t Int64Value::ByteSizeLong() const { if (this->value() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->value()); + this->_internal_value()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1003,7 +868,7 @@ void Int64Value::MergeFrom(const Int64Value& from) { (void) cached_has_bits; if (from.value() != 0) { - set_value(from.value()); + _internal_set_value(from._internal_value()); } } @@ -1102,7 +967,6 @@ void UInt64Value::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* UInt64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -1137,50 +1001,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool UInt64Value::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.UInt64Value) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // uint64 value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::uint64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_UINT64>( - input, &value_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.UInt64Value) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.UInt64Value) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* UInt64Value::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1191,7 +1011,7 @@ failure: // uint64 value = 1; if (this->value() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(1, this->value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(1, this->_internal_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1214,7 +1034,7 @@ size_t UInt64Value::ByteSizeLong() const { if (this->value() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( - this->value()); + this->_internal_value()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1249,7 +1069,7 @@ void UInt64Value::MergeFrom(const UInt64Value& from) { (void) cached_has_bits; if (from.value() != 0) { - set_value(from.value()); + _internal_set_value(from._internal_value()); } } @@ -1348,7 +1168,6 @@ void Int32Value::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* Int32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -1383,50 +1202,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Int32Value::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.Int32Value) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // int32 value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( - input, &value_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.Int32Value) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.Int32Value) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* Int32Value::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1437,7 +1212,7 @@ failure: // int32 value = 1; if (this->value() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1460,7 +1235,7 @@ size_t Int32Value::ByteSizeLong() const { if (this->value() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->value()); + this->_internal_value()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1495,7 +1270,7 @@ void Int32Value::MergeFrom(const Int32Value& from) { (void) cached_has_bits; if (from.value() != 0) { - set_value(from.value()); + _internal_set_value(from._internal_value()); } } @@ -1594,7 +1369,6 @@ void UInt32Value::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* UInt32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -1629,50 +1403,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool UInt32Value::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.UInt32Value) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // uint32 value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - ::PROTOBUF_NAMESPACE_ID::uint32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_UINT32>( - input, &value_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.UInt32Value) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.UInt32Value) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* UInt32Value::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1683,7 +1413,7 @@ failure: // uint32 value = 1; if (this->value() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1706,7 +1436,7 @@ size_t UInt32Value::ByteSizeLong() const { if (this->value() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( - this->value()); + this->_internal_value()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1741,7 +1471,7 @@ void UInt32Value::MergeFrom(const UInt32Value& from) { (void) cached_has_bits; if (from.value() != 0) { - set_value(from.value()); + _internal_set_value(from._internal_value()); } } @@ -1840,7 +1570,6 @@ void BoolValue::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* BoolValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -1875,50 +1604,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool BoolValue::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.BoolValue) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // bool value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { - - DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< - bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( - input, &value_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.BoolValue) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.BoolValue) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* BoolValue::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -1929,7 +1614,7 @@ failure: // bool value = 1; if (this->value() != 0) { stream->EnsureSpace(&target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -1985,7 +1670,7 @@ void BoolValue::MergeFrom(const BoolValue& from) { (void) cached_has_bits; if (from.value() != 0) { - set_value(from.value()); + _internal_set_value(from._internal_value()); } } @@ -2090,7 +1775,6 @@ void StringValue::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* StringValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -2125,52 +1809,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool StringValue::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.StringValue) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // string value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( - input, this->_internal_mutable_value())); - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_value().data(), static_cast(this->_internal_value().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, - "google.protobuf.StringValue.value")); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.StringValue) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.StringValue) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* StringValue::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { @@ -2349,7 +1987,6 @@ void BytesValue::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* BytesValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; @@ -2384,48 +2021,6 @@ failure: goto success; #undef CHK_ } -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool BytesValue::MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.BytesValue) - for (;;) { - ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // bytes value = 1; - case 1: { - if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) { - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadBytes( - input, this->_internal_mutable_value())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.BytesValue) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.BytesValue) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* BytesValue::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index b32d1364c2..a28a7b4e57 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -182,12 +182,7 @@ class PROTOBUF_EXPORT DoubleValue : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -235,6 +230,10 @@ class PROTOBUF_EXPORT DoubleValue : void clear_value(); double value() const; void set_value(double value); + private: + double _internal_value() const; + void _internal_set_value(double value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.DoubleValue) private: @@ -334,12 +333,7 @@ class PROTOBUF_EXPORT FloatValue : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -387,6 +381,10 @@ class PROTOBUF_EXPORT FloatValue : void clear_value(); float value() const; void set_value(float value); + private: + float _internal_value() const; + void _internal_set_value(float value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.FloatValue) private: @@ -486,12 +484,7 @@ class PROTOBUF_EXPORT Int64Value : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -539,6 +532,10 @@ class PROTOBUF_EXPORT Int64Value : void clear_value(); ::PROTOBUF_NAMESPACE_ID::int64 value() const; void set_value(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_value() const; + void _internal_set_value(::PROTOBUF_NAMESPACE_ID::int64 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Int64Value) private: @@ -638,12 +635,7 @@ class PROTOBUF_EXPORT UInt64Value : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -691,6 +683,10 @@ class PROTOBUF_EXPORT UInt64Value : void clear_value(); ::PROTOBUF_NAMESPACE_ID::uint64 value() const; void set_value(::PROTOBUF_NAMESPACE_ID::uint64 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint64 _internal_value() const; + void _internal_set_value(::PROTOBUF_NAMESPACE_ID::uint64 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.UInt64Value) private: @@ -790,12 +786,7 @@ class PROTOBUF_EXPORT Int32Value : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -843,6 +834,10 @@ class PROTOBUF_EXPORT Int32Value : void clear_value(); ::PROTOBUF_NAMESPACE_ID::int32 value() const; void set_value(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_value() const; + void _internal_set_value(::PROTOBUF_NAMESPACE_ID::int32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.Int32Value) private: @@ -942,12 +937,7 @@ class PROTOBUF_EXPORT UInt32Value : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -995,6 +985,10 @@ class PROTOBUF_EXPORT UInt32Value : void clear_value(); ::PROTOBUF_NAMESPACE_ID::uint32 value() const; void set_value(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_value() const; + void _internal_set_value(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.UInt32Value) private: @@ -1094,12 +1088,7 @@ class PROTOBUF_EXPORT BoolValue : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1147,6 +1136,10 @@ class PROTOBUF_EXPORT BoolValue : void clear_value(); bool value() const; void set_value(bool value); + private: + bool _internal_value() const; + void _internal_set_value(bool value); + public: // @@protoc_insertion_point(class_scope:google.protobuf.BoolValue) private: @@ -1246,12 +1239,7 @@ class PROTOBUF_EXPORT StringValue : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1418,12 +1406,7 @@ class PROTOBUF_EXPORT BytesValue : bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - #else - bool MergePartialFromCodedStream( - ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER ::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } @@ -1519,13 +1502,19 @@ class PROTOBUF_EXPORT BytesValue : inline void DoubleValue::clear_value() { value_ = 0; } +inline double DoubleValue::_internal_value() const { + return value_; +} inline double DoubleValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.DoubleValue.value) - return value_; + return _internal_value(); } -inline void DoubleValue::set_value(double value) { +inline void DoubleValue::_internal_set_value(double value) { value_ = value; +} +inline void DoubleValue::set_value(double value) { + _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.DoubleValue.value) } @@ -1537,13 +1526,19 @@ inline void DoubleValue::set_value(double value) { inline void FloatValue::clear_value() { value_ = 0; } +inline float FloatValue::_internal_value() const { + return value_; +} inline float FloatValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.FloatValue.value) - return value_; + return _internal_value(); } -inline void FloatValue::set_value(float value) { +inline void FloatValue::_internal_set_value(float value) { value_ = value; +} +inline void FloatValue::set_value(float value) { + _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.FloatValue.value) } @@ -1555,13 +1550,19 @@ inline void FloatValue::set_value(float value) { inline void Int64Value::clear_value() { value_ = PROTOBUF_LONGLONG(0); } +inline ::PROTOBUF_NAMESPACE_ID::int64 Int64Value::_internal_value() const { + return value_; +} inline ::PROTOBUF_NAMESPACE_ID::int64 Int64Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value) - return value_; + return _internal_value(); } -inline void Int64Value::set_value(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Int64Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::int64 value) { value_ = value; +} +inline void Int64Value::set_value(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value) } @@ -1573,13 +1574,19 @@ inline void Int64Value::set_value(::PROTOBUF_NAMESPACE_ID::int64 value) { inline void UInt64Value::clear_value() { value_ = PROTOBUF_ULONGLONG(0); } +inline ::PROTOBUF_NAMESPACE_ID::uint64 UInt64Value::_internal_value() const { + return value_; +} inline ::PROTOBUF_NAMESPACE_ID::uint64 UInt64Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value) - return value_; + return _internal_value(); } -inline void UInt64Value::set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void UInt64Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { value_ = value; +} +inline void UInt64Value::set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { + _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value) } @@ -1591,13 +1598,19 @@ inline void UInt64Value::set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { inline void Int32Value::clear_value() { value_ = 0; } +inline ::PROTOBUF_NAMESPACE_ID::int32 Int32Value::_internal_value() const { + return value_; +} inline ::PROTOBUF_NAMESPACE_ID::int32 Int32Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value) - return value_; + return _internal_value(); } -inline void Int32Value::set_value(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Int32Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::int32 value) { value_ = value; +} +inline void Int32Value::set_value(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value) } @@ -1609,13 +1622,19 @@ inline void Int32Value::set_value(::PROTOBUF_NAMESPACE_ID::int32 value) { inline void UInt32Value::clear_value() { value_ = 0u; } +inline ::PROTOBUF_NAMESPACE_ID::uint32 UInt32Value::_internal_value() const { + return value_; +} inline ::PROTOBUF_NAMESPACE_ID::uint32 UInt32Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value) - return value_; + return _internal_value(); } -inline void UInt32Value::set_value(::PROTOBUF_NAMESPACE_ID::uint32 value) { +inline void UInt32Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::uint32 value) { value_ = value; +} +inline void UInt32Value::set_value(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value) } @@ -1627,13 +1646,19 @@ inline void UInt32Value::set_value(::PROTOBUF_NAMESPACE_ID::uint32 value) { inline void BoolValue::clear_value() { value_ = false; } +inline bool BoolValue::_internal_value() const { + return value_; +} inline bool BoolValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.BoolValue.value) - return value_; + return _internal_value(); } -inline void BoolValue::set_value(bool value) { +inline void BoolValue::_internal_set_value(bool value) { value_ = value; +} +inline void BoolValue::set_value(bool value) { + _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.BoolValue.value) }