From 5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Thu, 17 Nov 2016 16:48:38 -0800 Subject: Integrated internal changes from Google --- src/google/protobuf/struct.pb.cc | 527 ++++++++++++++++++--------------------- 1 file changed, 236 insertions(+), 291 deletions(-) (limited to 'src/google/protobuf/struct.pb.cc') diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index c8f5af90..82f5fb28 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -19,16 +19,17 @@ namespace google { namespace protobuf { +class StructDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed {}; +StructDefaultTypeInternal _Struct_default_instance_; +class ValueDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed {}; +ValueDefaultTypeInternal _Value_default_instance_; +class ListValueDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed {}; +ListValueDefaultTypeInternal _ListValue_default_instance_; namespace { -const ::google::protobuf::Descriptor* Struct_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Struct_reflection_ = NULL; -const ::google::protobuf::Descriptor* Struct_FieldsEntry_descriptor_ = NULL; -const ::google::protobuf::Descriptor* Value_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Value_reflection_ = NULL; +::google::protobuf::Metadata file_level_metadata[4]; +const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1]; struct ValueOneofInstance { int null_value_; double number_value_; @@ -36,157 +37,138 @@ struct ValueOneofInstance { bool bool_value_; const ::google::protobuf::Struct* struct_value_; const ::google::protobuf::ListValue* list_value_; -}* Value_default_oneof_instance_ = NULL; -const ::google::protobuf::Descriptor* ListValue_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - ListValue_reflection_ = NULL; -const ::google::protobuf::EnumDescriptor* NullValue_descriptor_ = NULL; +} Value_default_oneof_instance_; } // namespace -void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto() GOOGLE_ATTRIBUTE_COLD; -void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto() { - protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); - const ::google::protobuf::FileDescriptor* file = - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( - "google/protobuf/struct.proto"); - GOOGLE_CHECK(file != NULL); - Struct_descriptor_ = file->message_type(0); - static const int Struct_offsets_[1] = { +const ::google::protobuf::uint32* protobuf_Offsets_google_2fprotobuf_2fstruct_2eproto() GOOGLE_ATTRIBUTE_COLD; +const ::google::protobuf::uint32* protobuf_Offsets_google_2fprotobuf_2fstruct_2eproto() { + static const ::google::protobuf::uint32 offsets[] = { + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, fields_), - }; - Struct_reflection_ = - ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - Struct_descriptor_, - Struct::internal_default_instance(), - Struct_offsets_, - -1, - -1, - -1, - sizeof(Struct), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, _internal_metadata_)); - Struct_FieldsEntry_descriptor_ = Struct_descriptor_->nested_type(0); - Value_descriptor_ = file->message_type(1); - static const int Value_offsets_[7] = { - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, null_value_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, number_value_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, string_value_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, bool_value_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, struct_value_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, list_value_), + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _internal_metadata_), + ~0u, // no _extensions_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _oneof_case_[0]), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&Value_default_oneof_instance_), null_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&Value_default_oneof_instance_), number_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&Value_default_oneof_instance_), string_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&Value_default_oneof_instance_), bool_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&Value_default_oneof_instance_), struct_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&Value_default_oneof_instance_), list_value_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, kind_), - }; - Value_reflection_ = - ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - Value_descriptor_, - Value::internal_default_instance(), - Value_offsets_, - -1, - -1, - -1, - Value_default_oneof_instance_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _oneof_case_[0]), - sizeof(Value), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _internal_metadata_)); - ListValue_descriptor_ = file->message_type(2); - static const int ListValue_offsets_[1] = { + ~0u, // no _has_bits_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, values_), }; - ListValue_reflection_ = - ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - ListValue_descriptor_, - ListValue::internal_default_instance(), - ListValue_offsets_, - -1, - -1, - -1, - sizeof(ListValue), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, _internal_metadata_)); - NullValue_descriptor_ = file->enum_type(0); + return offsets; } +static const ::google::protobuf::internal::MigrationSchema schemas[] = { + { 0, -1, sizeof(Struct)}, + { 5, -1, sizeof(Value)}, + { 16, -1, sizeof(ListValue)}, +}; + +static const ::google::protobuf::internal::DefaultInstanceData file_default_instances[] = { + {reinterpret_cast(&_Struct_default_instance_), NULL}, + {reinterpret_cast(&_Value_default_instance_), &Value_default_oneof_instance_}, + {reinterpret_cast(&_ListValue_default_instance_), NULL}, +}; + namespace { -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +void protobuf_AssignDescriptors() { + protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + ::google::protobuf::MessageFactory* factory = NULL; + AssignDescriptors( + "google/protobuf/struct.proto", schemas, file_default_instances, protobuf_Offsets_google_2fprotobuf_2fstruct_2eproto(), factory, + file_level_metadata, file_level_enum_descriptors, NULL); +} + void protobuf_AssignDescriptorsOnce() { - ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, - &protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto); + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); + ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 4); + const ::google::protobuf::Descriptor* Struct_FieldsEntry_descriptor = file_level_metadata[0].descriptor; ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Struct_descriptor_, Struct::internal_default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Struct_FieldsEntry_descriptor_, + Struct_FieldsEntry_descriptor, ::google::protobuf::internal::MapEntry< ::std::string, ::google::protobuf::Value, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, 0>::CreateDefaultInstance( - Struct_FieldsEntry_descriptor_)); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Value_descriptor_, Value::internal_default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ListValue_descriptor_, ListValue::internal_default_instance()); + Struct_FieldsEntry_descriptor)); } } // namespace void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto() { - Struct_default_instance_.Shutdown(); - delete Struct_reflection_; - Value_default_instance_.Shutdown(); - delete Value_default_oneof_instance_; - delete Value_reflection_; - ListValue_default_instance_.Shutdown(); - delete ListValue_reflection_; + _Struct_default_instance_.Shutdown(); + delete file_level_metadata[1].reflection; + _Value_default_instance_.Shutdown(); + delete file_level_metadata[2].reflection; + _ListValue_default_instance_.Shutdown(); + delete file_level_metadata[3].reflection; } void protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto_impl() { GOOGLE_PROTOBUF_VERIFY_VERSION; - ::google::protobuf::internal::GetEmptyString(); - Struct_default_instance_.DefaultConstruct(); - ::google::protobuf::internal::GetEmptyString(); - Value_default_instance_.DefaultConstruct(); - Value_default_oneof_instance_ = new ValueOneofInstance(); - ListValue_default_instance_.DefaultConstruct(); - Struct_default_instance_.get_mutable()->InitAsDefaultInstance(); - Value_default_instance_.get_mutable()->InitAsDefaultInstance(); - ListValue_default_instance_.get_mutable()->InitAsDefaultInstance(); + ::google::protobuf::internal::InitProtobufDefaults(); + _Struct_default_instance_.DefaultConstruct(); + _Value_default_instance_.DefaultConstruct(); + _ListValue_default_instance_.DefaultConstruct(); + Value_default_oneof_instance_.null_value_ = 0; + Value_default_oneof_instance_.number_value_ = 0; + Value_default_oneof_instance_.string_value_.UnsafeSetDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + Value_default_oneof_instance_.bool_value_ = false; + Value_default_oneof_instance_.struct_value_ = const_cast< ::google::protobuf::Struct*>( + ::google::protobuf::Struct::internal_default_instance()); + Value_default_oneof_instance_.list_value_ = const_cast< ::google::protobuf::ListValue*>( + ::google::protobuf::ListValue::internal_default_instance()); } -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto_once_); void protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto() { - ::google::protobuf::GoogleOnceInit(&protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto_once_, - &protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto_impl); + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto_impl); } void protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto_impl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto(); + static const char descriptor[] = { + "\n\034google/protobuf/struct.proto\022\017google.p" + "rotobuf\"\204\001\n\006Struct\0223\n\006fields\030\001 \003(\0132#.goo" + "gle.protobuf.Struct.FieldsEntry\032E\n\013Field" + "sEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.goo" + "gle.protobuf.Value:\0028\001\"\352\001\n\005Value\0220\n\nnull" + "_value\030\001 \001(\0162\032.google.protobuf.NullValue" + "H\000\022\026\n\014number_value\030\002 \001(\001H\000\022\026\n\014string_val" + "ue\030\003 \001(\tH\000\022\024\n\nbool_value\030\004 \001(\010H\000\022/\n\014stru" + "ct_value\030\005 \001(\0132\027.google.protobuf.StructH" + "\000\0220\n\nlist_value\030\006 \001(\0132\032.google.protobuf." + "ListValueH\000B\006\n\004kind\"3\n\tListValue\022&\n\006valu" + "es\030\001 \003(\0132\026.google.protobuf.Value*\033\n\tNull" + "Value\022\016\n\nNULL_VALUE\020\000B\201\001\n\023com.google.pro" + "tobufB\013StructProtoP\001Z1github.com/golang/" + "protobuf/ptypes/struct;structpb\370\001\001\242\002\003GPB" + "\252\002\036Google.Protobuf.WellKnownTypesb\006proto" + "3" + }; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\034google/protobuf/struct.proto\022\017google.p" - "rotobuf\"\204\001\n\006Struct\0223\n\006fields\030\001 \003(\0132#.goo" - "gle.protobuf.Struct.FieldsEntry\032E\n\013Field" - "sEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.goo" - "gle.protobuf.Value:\0028\001\"\352\001\n\005Value\0220\n\nnull" - "_value\030\001 \001(\0162\032.google.protobuf.NullValue" - "H\000\022\026\n\014number_value\030\002 \001(\001H\000\022\026\n\014string_val" - "ue\030\003 \001(\tH\000\022\024\n\nbool_value\030\004 \001(\010H\000\022/\n\014stru" - "ct_value\030\005 \001(\0132\027.google.protobuf.StructH" - "\000\0220\n\nlist_value\030\006 \001(\0132\032.google.protobuf." - "ListValueH\000B\006\n\004kind\"3\n\tListValue\022&\n\006valu" - "es\030\001 \003(\0132\026.google.protobuf.Value*\033\n\tNull" - "Value\022\016\n\nNULL_VALUE\020\000B\201\001\n\023com.google.pro" - "tobufB\013StructProtoP\001Z1github.com/golang/" - "protobuf/ptypes/struct;structpb\370\001\001\242\002\003GPB" - "\252\002\036Google.Protobuf.WellKnownTypesb\006proto" - "3", 641); + descriptor, 641); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/struct.proto", &protobuf_RegisterTypes); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto); @@ -205,7 +187,7 @@ struct StaticDescriptorInitializer_google_2fprotobuf_2fstruct_2eproto { } static_descriptor_initializer_google_2fprotobuf_2fstruct_2eproto_; const ::google::protobuf::EnumDescriptor* NullValue_descriptor() { protobuf_AssignDescriptorsOnce(); - return NullValue_descriptor_; + return file_level_enum_descriptors[0]; } bool NullValue_IsValid(int value) { switch (value) { @@ -217,15 +199,10 @@ bool NullValue_IsValid(int value) { } -namespace { - -static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD GOOGLE_ATTRIBUTE_NORETURN; -static void MergeFromFail(int line) { - ::google::protobuf::internal::MergeFromFail(__FILE__, line); -} - -} // namespace +// =================================================================== +#if PROTOBUF_INLINE_NOT_IN_HEADERS +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -235,7 +212,9 @@ const int Struct::kFieldsFieldNumber; Struct::Struct() : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (this != internal_default_instance()) protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto(); + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto(); + } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Struct) } @@ -250,23 +229,26 @@ Struct::Struct(::google::protobuf::Arena* arena) RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Struct) } - -void Struct::InitAsDefaultInstance() { -} - Struct::Struct(const Struct& from) : ::google::protobuf::Message(), - _internal_metadata_(NULL) { - SharedCtor(); - UnsafeMergeFrom(from); + _internal_metadata_(NULL), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + const ::google::protobuf::Descriptor*& Struct_FieldsEntry_descriptor = file_level_metadata[0].descriptor; + fields_.SetAssignDescriptorCallback( + protobuf_AssignDescriptorsOnce); + fields_.SetEntryDescriptor( + &Struct_FieldsEntry_descriptor); + fields_.MergeFrom(from.fields_); // @@protoc_insertion_point(copy_constructor:google.protobuf.Struct) } void Struct::SharedCtor() { + const ::google::protobuf::Descriptor*& Struct_FieldsEntry_descriptor = file_level_metadata[0].descriptor; fields_.SetAssignDescriptorCallback( protobuf_AssignDescriptorsOnce); fields_.SetEntryDescriptor( - &::google::protobuf::Struct_FieldsEntry_descriptor_); + &Struct_FieldsEntry_descriptor); _cached_size_ = 0; } @@ -296,7 +278,7 @@ void Struct::SetCachedSize(int size) const { } const ::google::protobuf::Descriptor* Struct::descriptor() { protobuf_AssignDescriptorsOnce(); - return Struct_descriptor_; + return file_level_metadata[1].descriptor; } const Struct& Struct::default_instance() { @@ -304,8 +286,6 @@ const Struct& Struct::default_instance() { return *internal_default_instance(); } -::google::protobuf::internal::ExplicitlyConstructed Struct_default_instance_; - Struct* Struct::New(::google::protobuf::Arena* arena) const { return ::google::protobuf::Arena::CreateMessage(arena); } @@ -321,7 +301,7 @@ bool Struct::MergePartialFromCodedStream( ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.Struct) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127); tag = p.first; if (!p.second) goto handle_unusual; switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { @@ -329,7 +309,6 @@ bool Struct::MergePartialFromCodedStream( case 1: { if (tag == 10) { DO_(input->IncrementRecursionDepth()); - parse_loop_fields: Struct_FieldsEntry::Parser< ::google::protobuf::internal::MapField< ::std::string, ::google::protobuf::Value, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, @@ -345,9 +324,7 @@ bool Struct::MergePartialFromCodedStream( } else { goto handle_unusual; } - if (input->ExpectTag(10)) goto parse_loop_fields; input->UnsafeDecrementRecursionDepth(); - if (input->ExpectAtEnd()) goto success; break; } @@ -390,7 +367,7 @@ void Struct::SerializeWithCachedSizes( } }; - if (output->IsSerializationDeterminstic() && + if (output->IsSerializationDeterministic() && this->fields().size() > 1) { ::google::protobuf::scoped_array items( new SortItem[this->fields().size()]); @@ -533,7 +510,7 @@ size_t Struct::ByteSizeLong() const { void Struct::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Struct) - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + GOOGLE_DCHECK_NE(&from, this); const Struct* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); @@ -542,21 +519,14 @@ void Struct::MergeFrom(const ::google::protobuf::Message& from) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Struct) - UnsafeMergeFrom(*source); + MergeFrom(*source); } } void Struct::MergeFrom(const Struct& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Struct) - if (GOOGLE_PREDICT_TRUE(&from != this)) { - UnsafeMergeFrom(from); - } else { - MergeFromFail(__LINE__); - } -} - -void Struct::UnsafeMergeFrom(const Struct& from) { - GOOGLE_DCHECK(&from != this); + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); fields_.MergeFrom(from.fields_); } @@ -571,11 +541,10 @@ void Struct::CopyFrom(const Struct& from) { // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Struct) if (&from == this) return; Clear(); - UnsafeMergeFrom(from); + MergeFrom(from); } bool Struct::IsInitialized() const { - return true; } @@ -584,10 +553,13 @@ void Struct::Swap(Struct* other) { if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { InternalSwap(other); } else { - Struct temp; - temp.UnsafeMergeFrom(*this); - CopyFrom(*other); - other->CopyFrom(temp); + Struct* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } } } void Struct::UnsafeArenaSwap(Struct* other) { @@ -597,16 +569,12 @@ void Struct::UnsafeArenaSwap(Struct* other) { } void Struct::InternalSwap(Struct* other) { fields_.Swap(&other->fields_); - _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); } ::google::protobuf::Metadata Struct::GetMetadata() const { protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Struct_descriptor_; - metadata.reflection = Struct_reflection_; - return metadata; + return file_level_metadata[1]; } #if PROTOBUF_INLINE_NOT_IN_HEADERS @@ -630,9 +598,6 @@ Struct::mutable_fields() { return fields_.MutableMap(); } -inline const Struct* Struct::internal_default_instance() { - return &Struct_default_instance_.get(); -} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -648,7 +613,9 @@ const int Value::kListValueFieldNumber; Value::Value() : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (this != internal_default_instance()) protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto(); + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto(); + } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Value) } @@ -662,23 +629,41 @@ Value::Value(::google::protobuf::Arena* arena) RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Value) } - -void Value::InitAsDefaultInstance() { - Value_default_oneof_instance_->null_value_ = 0; - Value_default_oneof_instance_->number_value_ = 0; - Value_default_oneof_instance_->string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - Value_default_oneof_instance_->bool_value_ = false; - Value_default_oneof_instance_->struct_value_ = const_cast< ::google::protobuf::Struct*>( - ::google::protobuf::Struct::internal_default_instance()); - Value_default_oneof_instance_->list_value_ = const_cast< ::google::protobuf::ListValue*>( - ::google::protobuf::ListValue::internal_default_instance()); -} - Value::Value(const Value& from) : ::google::protobuf::Message(), - _internal_metadata_(NULL) { - SharedCtor(); - UnsafeMergeFrom(from); + _internal_metadata_(NULL), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + clear_has_kind(); + switch (from.kind_case()) { + case kNullValue: { + set_null_value(from.null_value()); + break; + } + case kNumberValue: { + set_number_value(from.number_value()); + break; + } + case kStringValue: { + set_string_value(from.string_value()); + break; + } + case kBoolValue: { + set_bool_value(from.bool_value()); + break; + } + case kStructValue: { + mutable_struct_value()->::google::protobuf::Struct::MergeFrom(from.struct_value()); + break; + } + case kListValue: { + mutable_list_value()->::google::protobuf::ListValue::MergeFrom(from.list_value()); + break; + } + case KIND_NOT_SET: { + break; + } + } // @@protoc_insertion_point(copy_constructor:google.protobuf.Value) } @@ -716,7 +701,7 @@ void Value::SetCachedSize(int size) const { } const ::google::protobuf::Descriptor* Value::descriptor() { protobuf_AssignDescriptorsOnce(); - return Value_descriptor_; + return file_level_metadata[2].descriptor; } const Value& Value::default_instance() { @@ -724,8 +709,6 @@ const Value& Value::default_instance() { return *internal_default_instance(); } -::google::protobuf::internal::ExplicitlyConstructed Value_default_instance_; - Value* Value::New(::google::protobuf::Arena* arena) const { return ::google::protobuf::Arena::CreateMessage(arena); } @@ -781,11 +764,11 @@ bool Value::MergePartialFromCodedStream( ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.Value) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127); tag = p.first; if (!p.second) goto handle_unusual; switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional .google.protobuf.NullValue null_value = 1; + // .google.protobuf.NullValue null_value = 1; case 1: { if (tag == 8) { int value; @@ -796,11 +779,10 @@ bool Value::MergePartialFromCodedStream( } else { goto handle_unusual; } - goto after_list_value; break; } - // optional double number_value = 2; + // double number_value = 2; case 2: { if (tag == 17) { clear_kind(); @@ -811,11 +793,10 @@ bool Value::MergePartialFromCodedStream( } else { goto handle_unusual; } - goto after_list_value; break; } - // optional string string_value = 3; + // string string_value = 3; case 3: { if (tag == 26) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( @@ -827,11 +808,10 @@ bool Value::MergePartialFromCodedStream( } else { goto handle_unusual; } - goto after_list_value; break; } - // optional bool bool_value = 4; + // bool bool_value = 4; case 4: { if (tag == 32) { clear_kind(); @@ -842,11 +822,10 @@ bool Value::MergePartialFromCodedStream( } else { goto handle_unusual; } - goto after_list_value; break; } - // optional .google.protobuf.Struct struct_value = 5; + // .google.protobuf.Struct struct_value = 5; case 5: { if (tag == 42) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( @@ -854,21 +833,17 @@ bool Value::MergePartialFromCodedStream( } else { goto handle_unusual; } - if (input->ExpectTag(50)) goto parse_list_value; break; } - // optional .google.protobuf.ListValue list_value = 6; + // .google.protobuf.ListValue list_value = 6; case 6: { if (tag == 50) { - parse_list_value: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_list_value())); } else { goto handle_unusual; } - after_list_value: - if (input->ExpectAtEnd()) goto success; break; } @@ -896,18 +871,18 @@ failure: void Value::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:google.protobuf.Value) - // optional .google.protobuf.NullValue null_value = 1; + // .google.protobuf.NullValue null_value = 1; if (has_null_value()) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 1, this->null_value(), output); } - // optional double number_value = 2; + // double number_value = 2; if (has_number_value()) { ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->number_value(), output); } - // optional string string_value = 3; + // string string_value = 3; if (has_string_value()) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->string_value().data(), this->string_value().length(), @@ -917,18 +892,18 @@ void Value::SerializeWithCachedSizes( 3, this->string_value(), output); } - // optional bool bool_value = 4; + // bool bool_value = 4; if (has_bool_value()) { ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->bool_value(), output); } - // optional .google.protobuf.Struct struct_value = 5; + // .google.protobuf.Struct struct_value = 5; if (has_struct_value()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 5, *kind_.struct_value_, output); } - // optional .google.protobuf.ListValue list_value = 6; + // .google.protobuf.ListValue list_value = 6; if (has_list_value()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 6, *kind_.list_value_, output); @@ -941,18 +916,18 @@ void Value::SerializeWithCachedSizes( bool deterministic, ::google::protobuf::uint8* target) const { (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value) - // optional .google.protobuf.NullValue null_value = 1; + // .google.protobuf.NullValue null_value = 1; if (has_null_value()) { target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 1, this->null_value(), target); } - // optional double number_value = 2; + // double number_value = 2; if (has_number_value()) { target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->number_value(), target); } - // optional string string_value = 3; + // string string_value = 3; if (has_string_value()) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->string_value().data(), this->string_value().length(), @@ -963,19 +938,19 @@ void Value::SerializeWithCachedSizes( 3, this->string_value(), target); } - // optional bool bool_value = 4; + // bool bool_value = 4; if (has_bool_value()) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->bool_value(), target); } - // optional .google.protobuf.Struct struct_value = 5; + // .google.protobuf.Struct struct_value = 5; if (has_struct_value()) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( 5, *kind_.struct_value_, false, target); } - // optional .google.protobuf.ListValue list_value = 6; + // .google.protobuf.ListValue list_value = 6; if (has_list_value()) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageNoVirtualToArray( @@ -991,37 +966,37 @@ size_t Value::ByteSizeLong() const { size_t total_size = 0; switch (kind_case()) { - // optional .google.protobuf.NullValue null_value = 1; + // .google.protobuf.NullValue null_value = 1; case kNullValue: { total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize(this->null_value()); break; } - // optional double number_value = 2; + // double number_value = 2; case kNumberValue: { total_size += 1 + 8; break; } - // optional string string_value = 3; + // string string_value = 3; case kStringValue: { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->string_value()); break; } - // optional bool bool_value = 4; + // bool bool_value = 4; case kBoolValue: { total_size += 1 + 1; break; } - // optional .google.protobuf.Struct struct_value = 5; + // .google.protobuf.Struct struct_value = 5; case kStructValue: { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( *kind_.struct_value_); break; } - // optional .google.protobuf.ListValue list_value = 6; + // .google.protobuf.ListValue list_value = 6; case kListValue: { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( @@ -1041,7 +1016,7 @@ size_t Value::ByteSizeLong() const { void Value::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Value) - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + GOOGLE_DCHECK_NE(&from, this); const Value* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); @@ -1050,21 +1025,14 @@ void Value::MergeFrom(const ::google::protobuf::Message& from) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Value) - UnsafeMergeFrom(*source); + MergeFrom(*source); } } void Value::MergeFrom(const Value& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Value) - if (GOOGLE_PREDICT_TRUE(&from != this)) { - UnsafeMergeFrom(from); - } else { - MergeFromFail(__LINE__); - } -} - -void Value::UnsafeMergeFrom(const Value& from) { - GOOGLE_DCHECK(&from != this); + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); switch (from.kind_case()) { case kNullValue: { set_null_value(from.null_value()); @@ -1107,11 +1075,10 @@ void Value::CopyFrom(const Value& from) { // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Value) if (&from == this) return; Clear(); - UnsafeMergeFrom(from); + MergeFrom(from); } bool Value::IsInitialized() const { - return true; } @@ -1120,10 +1087,13 @@ void Value::Swap(Value* other) { if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { InternalSwap(other); } else { - Value temp; - temp.UnsafeMergeFrom(*this); - CopyFrom(*other); - other->CopyFrom(temp); + Value* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } } } void Value::UnsafeArenaSwap(Value* other) { @@ -1134,22 +1104,18 @@ void Value::UnsafeArenaSwap(Value* other) { void Value::InternalSwap(Value* other) { std::swap(kind_, other->kind_); std::swap(_oneof_case_[0], other->_oneof_case_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); } ::google::protobuf::Metadata Value::GetMetadata() const { protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Value_descriptor_; - metadata.reflection = Value_reflection_; - return metadata; + return file_level_metadata[2]; } #if PROTOBUF_INLINE_NOT_IN_HEADERS // Value -// optional .google.protobuf.NullValue null_value = 1; +// .google.protobuf.NullValue null_value = 1; bool Value::has_null_value() const { return kind_case() == kNullValue; } @@ -1178,7 +1144,7 @@ void Value::set_null_value(::google::protobuf::NullValue value) { // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value) } -// optional double number_value = 2; +// double number_value = 2; bool Value::has_number_value() const { return kind_case() == kNumberValue; } @@ -1207,7 +1173,7 @@ void Value::set_number_value(double value) { // @@protoc_insertion_point(field_set:google.protobuf.Value.number_value) } -// optional string string_value = 3; +// string string_value = 3; bool Value::has_string_value() const { return kind_case() == kStringValue; } @@ -1224,7 +1190,7 @@ void Value::clear_string_value() { const ::std::string& Value::string_value() const { // @@protoc_insertion_point(field_get:google.protobuf.Value.string_value) if (has_string_value()) { - return kind_.string_value_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return kind_.string_value_.Get(); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } @@ -1316,7 +1282,7 @@ void Value::unsafe_arena_set_allocated_string_value(::std::string* string_value) // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.string_value) } -// optional bool bool_value = 4; +// bool bool_value = 4; bool Value::has_bool_value() const { return kind_case() == kBoolValue; } @@ -1345,7 +1311,7 @@ void Value::set_bool_value(bool value) { // @@protoc_insertion_point(field_set:google.protobuf.Value.bool_value) } -// optional .google.protobuf.Struct struct_value = 5; +// .google.protobuf.Struct struct_value = 5; bool Value::has_struct_value() const { return kind_case() == kStructValue; } @@ -1433,7 +1399,7 @@ void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value) } -// optional .google.protobuf.ListValue list_value = 6; +// .google.protobuf.ListValue list_value = 6; bool Value::has_list_value() const { return kind_case() == kListValue; } @@ -1530,9 +1496,6 @@ void Value::clear_has_kind() { Value::KindCase Value::kind_case() const { return Value::KindCase(_oneof_case_[0]); } -inline const Value* Value::internal_default_instance() { - return &Value_default_instance_.get(); -} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -1543,7 +1506,9 @@ const int ListValue::kValuesFieldNumber; ListValue::ListValue() : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (this != internal_default_instance()) protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto(); + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_InitDefaults_google_2fprotobuf_2fstruct_2eproto(); + } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.ListValue) } @@ -1558,15 +1523,12 @@ ListValue::ListValue(::google::protobuf::Arena* arena) RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.ListValue) } - -void ListValue::InitAsDefaultInstance() { -} - ListValue::ListValue(const ListValue& from) : ::google::protobuf::Message(), - _internal_metadata_(NULL) { - SharedCtor(); - UnsafeMergeFrom(from); + _internal_metadata_(NULL), + values_(from.values_), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); // @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue) } @@ -1600,7 +1562,7 @@ void ListValue::SetCachedSize(int size) const { } const ::google::protobuf::Descriptor* ListValue::descriptor() { protobuf_AssignDescriptorsOnce(); - return ListValue_descriptor_; + return file_level_metadata[3].descriptor; } const ListValue& ListValue::default_instance() { @@ -1608,8 +1570,6 @@ const ListValue& ListValue::default_instance() { return *internal_default_instance(); } -::google::protobuf::internal::ExplicitlyConstructed ListValue_default_instance_; - ListValue* ListValue::New(::google::protobuf::Arena* arena) const { return ::google::protobuf::Arena::CreateMessage(arena); } @@ -1625,7 +1585,7 @@ bool ListValue::MergePartialFromCodedStream( ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.ListValue) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127); tag = p.first; if (!p.second) goto handle_unusual; switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { @@ -1633,15 +1593,12 @@ bool ListValue::MergePartialFromCodedStream( case 1: { if (tag == 10) { DO_(input->IncrementRecursionDepth()); - parse_loop_values: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_values())); } else { goto handle_unusual; } - if (input->ExpectTag(10)) goto parse_loop_values; input->UnsafeDecrementRecursionDepth(); - if (input->ExpectAtEnd()) goto success; break; } @@ -1717,7 +1674,7 @@ size_t ListValue::ByteSizeLong() const { void ListValue::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.ListValue) - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + GOOGLE_DCHECK_NE(&from, this); const ListValue* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); @@ -1726,21 +1683,14 @@ void ListValue::MergeFrom(const ::google::protobuf::Message& from) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.ListValue) - UnsafeMergeFrom(*source); + MergeFrom(*source); } } void ListValue::MergeFrom(const ListValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ListValue) - if (GOOGLE_PREDICT_TRUE(&from != this)) { - UnsafeMergeFrom(from); - } else { - MergeFromFail(__LINE__); - } -} - -void ListValue::UnsafeMergeFrom(const ListValue& from) { - GOOGLE_DCHECK(&from != this); + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); values_.MergeFrom(from.values_); } @@ -1755,11 +1705,10 @@ void ListValue::CopyFrom(const ListValue& from) { // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.ListValue) if (&from == this) return; Clear(); - UnsafeMergeFrom(from); + MergeFrom(from); } bool ListValue::IsInitialized() const { - return true; } @@ -1768,10 +1717,13 @@ void ListValue::Swap(ListValue* other) { if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { InternalSwap(other); } else { - ListValue temp; - temp.UnsafeMergeFrom(*this); - CopyFrom(*other); - other->CopyFrom(temp); + ListValue* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } } } void ListValue::UnsafeArenaSwap(ListValue* other) { @@ -1781,16 +1733,12 @@ void ListValue::UnsafeArenaSwap(ListValue* other) { } void ListValue::InternalSwap(ListValue* other) { values_.UnsafeArenaSwap(&other->values_); - _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); } ::google::protobuf::Metadata ListValue::GetMetadata() const { protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = ListValue_descriptor_; - metadata.reflection = ListValue_reflection_; - return metadata; + return file_level_metadata[3]; } #if PROTOBUF_INLINE_NOT_IN_HEADERS @@ -1826,9 +1774,6 @@ ListValue::values() const { return values_; } -inline const ListValue* ListValue::internal_default_instance() { - return &ListValue_default_instance_.get(); -} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) -- cgit v1.2.3