diff --git a/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc b/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc index 2eec070af6..9822c3717d 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc @@ -257,11 +257,25 @@ void SingularPrimitive::GenerateInlineAccessorDefinitions( void SingularPrimitive::GenerateSerializeWithCachedSizesToArray( io::Printer* p) const { - p->Emit(R"cc( - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::Write$DeclaredType$ToArray( - $number$, this->_internal_$name$(), target); - )cc"); + if ((descriptor_->number() < 16) && + (descriptor_->type() == FieldDescriptor::TYPE_INT32 || + descriptor_->type() == FieldDescriptor::TYPE_INT64 || + descriptor_->type() == FieldDescriptor::TYPE_ENUM)) { + // Call special non-inlined routine with tag number hardcoded as a + // template parameter that handles the EnsureSpace and the writing + // of the tag+value to the array + p->Emit(R"cc( + target = ::$proto_ns$::internal::WireFormatLite:: + Write$declared_type$ToArrayWithField<$number$>( + stream, this->_internal_$name$(), target); + )cc"); + } else { + p->Emit(R"cc( + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::Write$DeclaredType$ToArray( + $number$, this->_internal_$name$(), target); + )cc"); + } } void SingularPrimitive::GenerateByteSize(io::Printer* p) const { diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index e34f19bde3..5559e69e6c 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -2852,7 +2852,7 @@ void MessageGenerator::GenerateClear(io::Printer* p) { const int kMaxUnconditionalPrimitiveBytesClear = 4; format( - "void $classname$::Clear() {\n" + "PROTOBUF_NOINLINE void $classname$::Clear() {\n" "// @@protoc_insertion_point(message_clear_start:$full_name$)\n"); format.Indent(); @@ -3939,7 +3939,7 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { if (descriptor_->options().message_set_wire_format()) { // Special-case MessageSet. format( - "::size_t $classname$::ByteSizeLong() const {\n" + "PROTOBUF_NOINLINE ::size_t $classname$::ByteSizeLong() const {\n" "$annotate_bytesize$" "// @@protoc_insertion_point(message_set_byte_size_start:$full_name$)\n" " ::size_t total_size = $extensions$.MessageSetByteSize();\n" @@ -4182,7 +4182,7 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { void MessageGenerator::GenerateIsInitialized(io::Printer* p) { if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(p); - format("bool $classname$::IsInitialized() const {\n"); + format("PROTOBUF_NOINLINE bool $classname$::IsInitialized() const {\n"); format.Indent(); if (descriptor_->extension_range_count() > 0) { diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 7c46a2bc61..24fa913995 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -380,7 +380,7 @@ void Version::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void Version::Clear() { +PROTOBUF_NOINLINE void Version::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -482,23 +482,23 @@ failure: cached_has_bits = _impl_._has_bits_[0]; // optional int32 major = 1; if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 1, this->_internal_major(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_major(), target); } // optional int32 minor = 2; if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 2, this->_internal_minor(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_minor(), target); } // optional int32 patch = 3; if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 3, this->_internal_patch(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<3>( + stream, this->_internal_patch(), target); } // optional string suffix = 4; @@ -596,7 +596,7 @@ void Version::CopyFrom(const Version& from) { MergeFrom(from); } -bool Version::IsInitialized() const { +PROTOBUF_NOINLINE bool Version::IsInitialized() const { return true; } @@ -712,7 +712,7 @@ void CodeGeneratorRequest::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void CodeGeneratorRequest::Clear() { +PROTOBUF_NOINLINE void CodeGeneratorRequest::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -943,7 +943,7 @@ void CodeGeneratorRequest::CopyFrom(const CodeGeneratorRequest& from) { MergeFrom(from); } -bool CodeGeneratorRequest::IsInitialized() const { +PROTOBUF_NOINLINE bool CodeGeneratorRequest::IsInitialized() const { if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_proto_file())) return false; return true; @@ -1092,7 +1092,7 @@ void CodeGeneratorResponse_File::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void CodeGeneratorResponse_File::Clear() { +PROTOBUF_NOINLINE void CodeGeneratorResponse_File::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -1323,7 +1323,7 @@ void CodeGeneratorResponse_File::CopyFrom(const CodeGeneratorResponse_File& from MergeFrom(from); } -bool CodeGeneratorResponse_File::IsInitialized() const { +PROTOBUF_NOINLINE bool CodeGeneratorResponse_File::IsInitialized() const { return true; } @@ -1427,7 +1427,7 @@ void CodeGeneratorResponse::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void CodeGeneratorResponse::Clear() { +PROTOBUF_NOINLINE void CodeGeneratorResponse::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -1618,7 +1618,7 @@ void CodeGeneratorResponse::CopyFrom(const CodeGeneratorResponse& from) { MergeFrom(from); } -bool CodeGeneratorResponse::IsInitialized() const { +PROTOBUF_NOINLINE bool CodeGeneratorResponse::IsInitialized() const { return true; } diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 5d0c9cdc29..8724006013 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1879,7 +1879,7 @@ void FileDescriptorSet::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void FileDescriptorSet::Clear() { +PROTOBUF_NOINLINE void FileDescriptorSet::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -1998,7 +1998,7 @@ void FileDescriptorSet::CopyFrom(const FileDescriptorSet& from) { MergeFrom(from); } -bool FileDescriptorSet::IsInitialized() const { +PROTOBUF_NOINLINE bool FileDescriptorSet::IsInitialized() const { if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_file())) return false; return true; @@ -2192,7 +2192,7 @@ void FileDescriptorProto::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void FileDescriptorProto::Clear() { +PROTOBUF_NOINLINE void FileDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -2720,7 +2720,7 @@ void FileDescriptorProto::CopyFrom(const FileDescriptorProto& from) { MergeFrom(from); } -bool FileDescriptorProto::IsInitialized() const { +PROTOBUF_NOINLINE bool FileDescriptorProto::IsInitialized() const { if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_message_type())) return false; if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_enum_type())) @@ -2850,7 +2850,7 @@ void DescriptorProto_ExtensionRange::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void DescriptorProto_ExtensionRange::Clear() { +PROTOBUF_NOINLINE void DescriptorProto_ExtensionRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -2939,16 +2939,16 @@ failure: cached_has_bits = _impl_._has_bits_[0]; // optional int32 start = 1; if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 1, this->_internal_start(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_start(), target); } // optional int32 end = 2; if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 2, this->_internal_end(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_end(), target); } // optional .google.protobuf.ExtensionRangeOptions options = 3; @@ -3038,7 +3038,7 @@ void DescriptorProto_ExtensionRange::CopyFrom(const DescriptorProto_ExtensionRan MergeFrom(from); } -bool DescriptorProto_ExtensionRange::IsInitialized() const { +PROTOBUF_NOINLINE bool DescriptorProto_ExtensionRange::IsInitialized() const { if ((_impl_._has_bits_[0] & 0x00000001u) != 0) { if (!_impl_.options_->IsInitialized()) return false; } @@ -3118,7 +3118,7 @@ void DescriptorProto_ReservedRange::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void DescriptorProto_ReservedRange::Clear() { +PROTOBUF_NOINLINE void DescriptorProto_ReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -3194,16 +3194,16 @@ failure: cached_has_bits = _impl_._has_bits_[0]; // optional int32 start = 1; if (cached_has_bits & 0x00000001u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 1, this->_internal_start(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_start(), target); } // optional int32 end = 2; if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 2, this->_internal_end(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_end(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -3275,7 +3275,7 @@ void DescriptorProto_ReservedRange::CopyFrom(const DescriptorProto_ReservedRange MergeFrom(from); } -bool DescriptorProto_ReservedRange::IsInitialized() const { +PROTOBUF_NOINLINE bool DescriptorProto_ReservedRange::IsInitialized() const { return true; } @@ -3402,7 +3402,7 @@ void DescriptorProto::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void DescriptorProto::Clear() { +PROTOBUF_NOINLINE void DescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -3819,7 +3819,7 @@ void DescriptorProto::CopyFrom(const DescriptorProto& from) { MergeFrom(from); } -bool DescriptorProto::IsInitialized() const { +PROTOBUF_NOINLINE bool DescriptorProto::IsInitialized() const { if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_field())) return false; if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_nested_type())) @@ -3982,7 +3982,7 @@ void ExtensionRangeOptions_Declaration::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void ExtensionRangeOptions_Declaration::Clear() { +PROTOBUF_NOINLINE void ExtensionRangeOptions_Declaration::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions.Declaration) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -4112,9 +4112,9 @@ failure: cached_has_bits = _impl_._has_bits_[0]; // optional int32 number = 1; if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 1, this->_internal_number(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_number(), target); } // optional string full_name = 2; @@ -4256,7 +4256,7 @@ void ExtensionRangeOptions_Declaration::CopyFrom(const ExtensionRangeOptions_Dec MergeFrom(from); } -bool ExtensionRangeOptions_Declaration::IsInitialized() const { +PROTOBUF_NOINLINE bool ExtensionRangeOptions_Declaration::IsInitialized() const { return true; } @@ -4351,7 +4351,7 @@ void ExtensionRangeOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void ExtensionRangeOptions::Clear() { +PROTOBUF_NOINLINE void ExtensionRangeOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -4550,7 +4550,7 @@ void ExtensionRangeOptions::CopyFrom(const ExtensionRangeOptions& from) { MergeFrom(from); } -bool ExtensionRangeOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool ExtensionRangeOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -4771,7 +4771,7 @@ void FieldDescriptorProto::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void FieldDescriptorProto::Clear() { +PROTOBUF_NOINLINE void FieldDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -5001,9 +5001,9 @@ failure: // optional int32 number = 3; if (cached_has_bits & 0x00000040u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 3, this->_internal_number(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<3>( + stream, this->_internal_number(), target); } // optional .google.protobuf.FieldDescriptorProto.Label label = 4; @@ -5045,9 +5045,9 @@ failure: // optional int32 oneof_index = 9; if (cached_has_bits & 0x00000080u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 9, this->_internal_oneof_index(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<9>( + stream, this->_internal_oneof_index(), target); } // optional string json_name = 10; @@ -5221,7 +5221,7 @@ void FieldDescriptorProto::CopyFrom(const FieldDescriptorProto& from) { MergeFrom(from); } -bool FieldDescriptorProto::IsInitialized() const { +PROTOBUF_NOINLINE bool FieldDescriptorProto::IsInitialized() const { if ((_impl_._has_bits_[0] & 0x00000020u) != 0) { if (!_impl_.options_->IsInitialized()) return false; } @@ -5339,7 +5339,7 @@ void OneofDescriptorProto::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void OneofDescriptorProto::Clear() { +PROTOBUF_NOINLINE void OneofDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -5504,7 +5504,7 @@ void OneofDescriptorProto::CopyFrom(const OneofDescriptorProto& from) { MergeFrom(from); } -bool OneofDescriptorProto::IsInitialized() const { +PROTOBUF_NOINLINE bool OneofDescriptorProto::IsInitialized() const { if ((_impl_._has_bits_[0] & 0x00000002u) != 0) { if (!_impl_.options_->IsInitialized()) return false; } @@ -5583,7 +5583,7 @@ void EnumDescriptorProto_EnumReservedRange::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void EnumDescriptorProto_EnumReservedRange::Clear() { +PROTOBUF_NOINLINE void EnumDescriptorProto_EnumReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -5659,16 +5659,16 @@ failure: cached_has_bits = _impl_._has_bits_[0]; // optional int32 start = 1; if (cached_has_bits & 0x00000001u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 1, this->_internal_start(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_start(), target); } // optional int32 end = 2; if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 2, this->_internal_end(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_end(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -5740,7 +5740,7 @@ void EnumDescriptorProto_EnumReservedRange::CopyFrom(const EnumDescriptorProto_E MergeFrom(from); } -bool EnumDescriptorProto_EnumReservedRange::IsInitialized() const { +PROTOBUF_NOINLINE bool EnumDescriptorProto_EnumReservedRange::IsInitialized() const { return true; } @@ -5852,7 +5852,7 @@ void EnumDescriptorProto::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void EnumDescriptorProto::Clear() { +PROTOBUF_NOINLINE void EnumDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -6114,7 +6114,7 @@ void EnumDescriptorProto::CopyFrom(const EnumDescriptorProto& from) { MergeFrom(from); } -bool EnumDescriptorProto::IsInitialized() const { +PROTOBUF_NOINLINE bool EnumDescriptorProto::IsInitialized() const { if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_value())) return false; if ((_impl_._has_bits_[0] & 0x00000002u) != 0) { @@ -6233,7 +6233,7 @@ void EnumValueDescriptorProto::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void EnumValueDescriptorProto::Clear() { +PROTOBUF_NOINLINE void EnumValueDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -6334,9 +6334,9 @@ failure: // optional int32 number = 2; if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 2, this->_internal_number(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_number(), target); } // optional .google.protobuf.EnumValueOptions options = 3; @@ -6426,7 +6426,7 @@ void EnumValueDescriptorProto::CopyFrom(const EnumValueDescriptorProto& from) { MergeFrom(from); } -bool EnumValueDescriptorProto::IsInitialized() const { +PROTOBUF_NOINLINE bool EnumValueDescriptorProto::IsInitialized() const { if ((_impl_._has_bits_[0] & 0x00000002u) != 0) { if (!_impl_.options_->IsInitialized()) return false; } @@ -6539,7 +6539,7 @@ void ServiceDescriptorProto::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void ServiceDescriptorProto::Clear() { +PROTOBUF_NOINLINE void ServiceDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -6735,7 +6735,7 @@ void ServiceDescriptorProto::CopyFrom(const ServiceDescriptorProto& from) { MergeFrom(from); } -bool ServiceDescriptorProto::IsInitialized() const { +PROTOBUF_NOINLINE bool ServiceDescriptorProto::IsInitialized() const { if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_method())) return false; if ((_impl_._has_bits_[0] & 0x00000002u) != 0) { @@ -6898,7 +6898,7 @@ void MethodDescriptorProto::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void MethodDescriptorProto::Clear() { +PROTOBUF_NOINLINE void MethodDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -7183,7 +7183,7 @@ void MethodDescriptorProto::CopyFrom(const MethodDescriptorProto& from) { MergeFrom(from); } -bool MethodDescriptorProto::IsInitialized() const { +PROTOBUF_NOINLINE bool MethodDescriptorProto::IsInitialized() const { if ((_impl_._has_bits_[0] & 0x00000008u) != 0) { if (!_impl_.options_->IsInitialized()) return false; } @@ -7535,7 +7535,7 @@ void FileOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void FileOptions::Clear() { +PROTOBUF_NOINLINE void FileOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -8289,7 +8289,7 @@ void FileOptions::CopyFrom(const FileOptions& from) { MergeFrom(from); } -bool FileOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool FileOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -8435,7 +8435,7 @@ void MessageOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void MessageOptions::Clear() { +PROTOBUF_NOINLINE void MessageOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -8709,7 +8709,7 @@ void MessageOptions::CopyFrom(const MessageOptions& from) { MergeFrom(from); } -bool MessageOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool MessageOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -8873,7 +8873,7 @@ void FieldOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void FieldOptions::Clear() { +PROTOBUF_NOINLINE void FieldOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -9347,7 +9347,7 @@ void FieldOptions::CopyFrom(const FieldOptions& from) { MergeFrom(from); } -bool FieldOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool FieldOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -9430,7 +9430,7 @@ void OneofOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void OneofOptions::Clear() { +PROTOBUF_NOINLINE void OneofOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -9562,7 +9562,7 @@ void OneofOptions::CopyFrom(const OneofOptions& from) { MergeFrom(from); } -bool OneofOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool OneofOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -9665,7 +9665,7 @@ void EnumOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void EnumOptions::Clear() { +PROTOBUF_NOINLINE void EnumOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -9886,7 +9886,7 @@ void EnumOptions::CopyFrom(const EnumOptions& from) { MergeFrom(from); } -bool EnumOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool EnumOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -9980,7 +9980,7 @@ void EnumValueOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void EnumValueOptions::Clear() { +PROTOBUF_NOINLINE void EnumValueOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -10143,7 +10143,7 @@ void EnumValueOptions::CopyFrom(const EnumValueOptions& from) { MergeFrom(from); } -bool EnumValueOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool EnumValueOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -10232,7 +10232,7 @@ void ServiceOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void ServiceOptions::Clear() { +PROTOBUF_NOINLINE void ServiceOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -10395,7 +10395,7 @@ void ServiceOptions::CopyFrom(const ServiceOptions& from) { MergeFrom(from); } -bool ServiceOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool ServiceOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -10493,7 +10493,7 @@ void MethodOptions::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void MethodOptions::Clear() { +PROTOBUF_NOINLINE void MethodOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -10697,7 +10697,7 @@ void MethodOptions::CopyFrom(const MethodOptions& from) { MergeFrom(from); } -bool MethodOptions::IsInitialized() const { +PROTOBUF_NOINLINE bool MethodOptions::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } @@ -10806,7 +10806,7 @@ void UninterpretedOption_NamePart::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void UninterpretedOption_NamePart::Clear() { +PROTOBUF_NOINLINE void UninterpretedOption_NamePart::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -10979,7 +10979,7 @@ void UninterpretedOption_NamePart::CopyFrom(const UninterpretedOption_NamePart& MergeFrom(from); } -bool UninterpretedOption_NamePart::IsInitialized() const { +PROTOBUF_NOINLINE bool UninterpretedOption_NamePart::IsInitialized() const { if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; return true; } @@ -11134,7 +11134,7 @@ void UninterpretedOption::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void UninterpretedOption::Clear() { +PROTOBUF_NOINLINE void UninterpretedOption::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -11305,9 +11305,9 @@ failure: // optional int64 negative_int_value = 5; if (cached_has_bits & 0x00000010u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt64ToArray( - 5, this->_internal_negative_int_value(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt64ToArrayWithField<5>( + stream, this->_internal_negative_int_value(), target); } // optional double double_value = 6; @@ -11443,7 +11443,7 @@ void UninterpretedOption::CopyFrom(const UninterpretedOption& from) { MergeFrom(from); } -bool UninterpretedOption::IsInitialized() const { +PROTOBUF_NOINLINE bool UninterpretedOption::IsInitialized() const { if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_internal_name())) return false; return true; @@ -11580,7 +11580,7 @@ void SourceCodeInfo_Location::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void SourceCodeInfo_Location::Clear() { +PROTOBUF_NOINLINE void SourceCodeInfo_Location::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -11856,7 +11856,7 @@ void SourceCodeInfo_Location::CopyFrom(const SourceCodeInfo_Location& from) { MergeFrom(from); } -bool SourceCodeInfo_Location::IsInitialized() const { +PROTOBUF_NOINLINE bool SourceCodeInfo_Location::IsInitialized() const { return true; } @@ -11929,7 +11929,7 @@ void SourceCodeInfo::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void SourceCodeInfo::Clear() { +PROTOBUF_NOINLINE void SourceCodeInfo::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -12048,7 +12048,7 @@ void SourceCodeInfo::CopyFrom(const SourceCodeInfo& from) { MergeFrom(from); } -bool SourceCodeInfo::IsInitialized() const { +PROTOBUF_NOINLINE bool SourceCodeInfo::IsInitialized() const { return true; } @@ -12163,7 +12163,7 @@ void GeneratedCodeInfo_Annotation::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void GeneratedCodeInfo_Annotation::Clear() { +PROTOBUF_NOINLINE void GeneratedCodeInfo_Annotation::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo.Annotation) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -12299,16 +12299,16 @@ failure: // optional int32 begin = 3; if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 3, this->_internal_begin(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<3>( + stream, this->_internal_begin(), target); } // optional int32 end = 4; if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 4, this->_internal_end(), target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + WriteInt32ToArrayWithField<4>( + stream, this->_internal_end(), target); } // optional .google.protobuf.GeneratedCodeInfo.Annotation.Semantic semantic = 5; @@ -12420,7 +12420,7 @@ void GeneratedCodeInfo_Annotation::CopyFrom(const GeneratedCodeInfo_Annotation& MergeFrom(from); } -bool GeneratedCodeInfo_Annotation::IsInitialized() const { +PROTOBUF_NOINLINE bool GeneratedCodeInfo_Annotation::IsInitialized() const { return true; } @@ -12494,7 +12494,7 @@ void GeneratedCodeInfo::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); } -void GeneratedCodeInfo::Clear() { +PROTOBUF_NOINLINE void GeneratedCodeInfo::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo) ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused @@ -12613,7 +12613,7 @@ void GeneratedCodeInfo::CopyFrom(const GeneratedCodeInfo& from) { MergeFrom(from); } -bool GeneratedCodeInfo::IsInitialized() const { +PROTOBUF_NOINLINE bool GeneratedCodeInfo::IsInitialized() const { return true; } diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index 194c2b2f73..d7c1e715ab 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h @@ -545,6 +545,30 @@ class PROTOBUF_EXPORT WireFormatLite { const RepeatedField& value, uint8_t* output); // Write fields, including tags. + template + PROTOBUF_NOINLINE static uint8_t* WriteInt32ToArrayWithField( + ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream, int32_t value, + uint8_t* target) { + target = stream->EnsureSpace(target); + return WriteInt32ToArray(field_number, value, target); + } + + template + PROTOBUF_NOINLINE static uint8_t* WriteInt64ToArrayWithField( + ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream, int64_t value, + uint8_t* target) { + target = stream->EnsureSpace(target); + return WriteInt64ToArray(field_number, value, target); + } + + template + PROTOBUF_NOINLINE static uint8_t* WriteEnumToArrayWithField( + ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream, int value, + uint8_t* target) { + target = stream->EnsureSpace(target); + return WriteEnumToArray(field_number, value, target); + } + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32ToArray(int field_number, int32_t value, uint8_t* target);