// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/protobuf/unittest_mset.proto

#include <google/protobuf/unittest_mset.pb.h>

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// This is a temporary google only hack
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
#include "third_party/protobuf/version.h"
#endif
// @@protoc_insertion_point(includes)

namespace protobuf_google_2fprotobuf_2funittest_5fmset_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2funittest_5fmset_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_RawMessageSet_Item;
extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2funittest_5fmset_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_TestMessageSetExtension1;
extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2funittest_5fmset_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_TestMessageSetExtension2;
}  // namespace protobuf_google_2fprotobuf_2funittest_5fmset_2eproto
namespace protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_TestMessageSet;
}  // namespace protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto
namespace protobuf_unittest {
class TestMessageSetContainerDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<TestMessageSetContainer>
      _instance;
} _TestMessageSetContainer_default_instance_;
class TestMessageSetExtension1DefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<TestMessageSetExtension1>
      _instance;
} _TestMessageSetExtension1_default_instance_;
class TestMessageSetExtension2DefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<TestMessageSetExtension2>
      _instance;
} _TestMessageSetExtension2_default_instance_;
class RawMessageSet_ItemDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<RawMessageSet_Item>
      _instance;
} _RawMessageSet_Item_default_instance_;
class RawMessageSetDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<RawMessageSet>
      _instance;
} _RawMessageSet_default_instance_;
}  // namespace protobuf_unittest
namespace protobuf_google_2fprotobuf_2funittest_5fmset_2eproto {
static void InitDefaultsTestMessageSetContainer() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_TestMessageSetContainer_default_instance_;
    new (ptr) ::protobuf_unittest::TestMessageSetContainer();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::TestMessageSetContainer::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<1> scc_info_TestMessageSetContainer =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTestMessageSetContainer}, {
      &protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::scc_info_TestMessageSet.base,}};

static void InitDefaultsTestMessageSetExtension1() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_TestMessageSetExtension1_default_instance_;
    new (ptr) ::protobuf_unittest::TestMessageSetExtension1();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::TestMessageSetExtension1::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<0> scc_info_TestMessageSetExtension1 =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsTestMessageSetExtension1}, {}};

static void InitDefaultsTestMessageSetExtension2() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_TestMessageSetExtension2_default_instance_;
    new (ptr) ::protobuf_unittest::TestMessageSetExtension2();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::TestMessageSetExtension2::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<0> scc_info_TestMessageSetExtension2 =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsTestMessageSetExtension2}, {}};

static void InitDefaultsRawMessageSet_Item() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_RawMessageSet_Item_default_instance_;
    new (ptr) ::protobuf_unittest::RawMessageSet_Item();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::RawMessageSet_Item::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<0> scc_info_RawMessageSet_Item =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsRawMessageSet_Item}, {}};

static void InitDefaultsRawMessageSet() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_RawMessageSet_default_instance_;
    new (ptr) ::protobuf_unittest::RawMessageSet();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::RawMessageSet::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<1> scc_info_RawMessageSet =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsRawMessageSet}, {
      &protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_RawMessageSet_Item.base,}};

void InitDefaults() {
  ::google::protobuf::internal::InitSCC(&scc_info_TestMessageSetContainer.base);
  ::google::protobuf::internal::InitSCC(&scc_info_TestMessageSetExtension1.base);
  ::google::protobuf::internal::InitSCC(&scc_info_TestMessageSetExtension2.base);
  ::google::protobuf::internal::InitSCC(&scc_info_RawMessageSet_Item.base);
  ::google::protobuf::internal::InitSCC(&scc_info_RawMessageSet.base);
}

::google::protobuf::Metadata file_level_metadata[5];

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetContainer, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetContainer, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetContainer, message_set_),
  0,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetExtension1, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetExtension1, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetExtension1, i_),
  0,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetExtension2, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetExtension2, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestMessageSetExtension2, str_),
  0,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::RawMessageSet_Item, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::RawMessageSet_Item, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::RawMessageSet_Item, type_id_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::RawMessageSet_Item, message_),
  1,
  0,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::RawMessageSet, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::RawMessageSet, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::RawMessageSet, item_),
  ~0u,
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 6, sizeof(::protobuf_unittest::TestMessageSetContainer)},
  { 7, 13, sizeof(::protobuf_unittest::TestMessageSetExtension1)},
  { 14, 20, sizeof(::protobuf_unittest::TestMessageSetExtension2)},
  { 21, 28, sizeof(::protobuf_unittest::RawMessageSet_Item)},
  { 30, 36, sizeof(::protobuf_unittest::RawMessageSet)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestMessageSetContainer_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestMessageSetExtension1_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestMessageSetExtension2_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_RawMessageSet_Item_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_RawMessageSet_default_instance_),
};

void protobuf_AssignDescriptors() {
  AddDescriptors();
  AssignDescriptors(
      "google/protobuf/unittest_mset.proto", schemas, file_default_instances, TableStruct::offsets,
      file_level_metadata, NULL, NULL);
}

void protobuf_AssignDescriptorsOnce() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
}

void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 5);
}

void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n#google/protobuf/unittest_mset.proto\022\021p"
      "rotobuf_unittest\032/google/protobuf/unitte"
      "st_mset_wire_format.proto\"Z\n\027TestMessage"
      "SetContainer\022\?\n\013message_set\030\001 \001(\0132*.prot"
      "o2_wireformat_unittest.TestMessageSet\"\237\001"
      "\n\030TestMessageSetExtension1\022\t\n\001i\030\017 \001(\0052x\n"
      "\025message_set_extension\022*.proto2_wireform"
      "at_unittest.TestMessageSet\030\260\246^ \001(\0132+.pro"
      "tobuf_unittest.TestMessageSetExtension1\""
      "\241\001\n\030TestMessageSetExtension2\022\013\n\003str\030\031 \001("
      "\t2x\n\025message_set_extension\022*.proto2_wire"
      "format_unittest.TestMessageSet\030\371\273^ \001(\0132+"
      ".protobuf_unittest.TestMessageSetExtensi"
      "on2\"n\n\rRawMessageSet\0223\n\004item\030\001 \003(\n2%.pro"
      "tobuf_unittest.RawMessageSet.Item\032(\n\004Ite"
      "m\022\017\n\007type_id\030\002 \002(\005\022\017\n\007message\030\003 \002(\014B\005H\001\370"
      "\001\001"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 642);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "google/protobuf/unittest_mset.proto", &protobuf_RegisterTypes);
  ::protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::AddDescriptors();
}

void AddDescriptors() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
  StaticDescriptorInitializer() {
    AddDescriptors();
  }
} static_descriptor_initializer;
}  // namespace protobuf_google_2fprotobuf_2funittest_5fmset_2eproto
namespace protobuf_unittest {

// ===================================================================

void TestMessageSetContainer::InitAsDefaultInstance() {
  ::protobuf_unittest::_TestMessageSetContainer_default_instance_._instance.get_mutable()->message_set_ = const_cast< ::proto2_wireformat_unittest::TestMessageSet*>(
      ::proto2_wireformat_unittest::TestMessageSet::internal_default_instance());
}
void TestMessageSetContainer::unsafe_arena_set_allocated_message_set(
    ::proto2_wireformat_unittest::TestMessageSet* message_set) {
  if (GetArenaNoVirtual() == NULL) {
    delete message_set_;
  }
  message_set_ = message_set;
  if (message_set) {
    set_has_message_set();
  } else {
    clear_has_message_set();
  }
  // @@protoc_insertion_point(field_unsafe_arena_set_allocated:protobuf_unittest.TestMessageSetContainer.message_set)
}
void TestMessageSetContainer::clear_message_set() {
  if (message_set_ != NULL) message_set_->Clear();
  clear_has_message_set();
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestMessageSetContainer::kMessageSetFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

TestMessageSetContainer::TestMessageSetContainer()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetContainer.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.TestMessageSetContainer)
}
TestMessageSetContainer::TestMessageSetContainer(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetContainer.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:protobuf_unittest.TestMessageSetContainer)
}
TestMessageSetContainer::TestMessageSetContainer(const TestMessageSetContainer& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  if (from.has_message_set()) {
    message_set_ = new ::proto2_wireformat_unittest::TestMessageSet(*from.message_set_);
  } else {
    message_set_ = NULL;
  }
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestMessageSetContainer)
}

void TestMessageSetContainer::SharedCtor() {
  message_set_ = NULL;
}

TestMessageSetContainer::~TestMessageSetContainer() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.TestMessageSetContainer)
  SharedDtor();
}

void TestMessageSetContainer::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  if (this != internal_default_instance()) delete message_set_;
}

void TestMessageSetContainer::ArenaDtor(void* object) {
  TestMessageSetContainer* _this = reinterpret_cast< TestMessageSetContainer* >(object);
  (void)_this;
}
void TestMessageSetContainer::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void TestMessageSetContainer::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* TestMessageSetContainer::descriptor() {
  ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const TestMessageSetContainer& TestMessageSetContainer::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetContainer.base);
  return *internal_default_instance();
}


void TestMessageSetContainer::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.TestMessageSetContainer)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    GOOGLE_DCHECK(message_set_ != NULL);
    message_set_->Clear();
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool TestMessageSetContainer::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.TestMessageSetContainer)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional .proto2_wireformat_unittest.TestMessageSet message_set = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_message_set()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.TestMessageSetContainer)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.TestMessageSetContainer)
  return false;
#undef DO_
}

void TestMessageSetContainer::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.TestMessageSetContainer)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional .proto2_wireformat_unittest.TestMessageSet message_set = 1;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1, this->_internal_message_set(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.TestMessageSetContainer)
}

::google::protobuf::uint8* TestMessageSetContainer::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.TestMessageSetContainer)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional .proto2_wireformat_unittest.TestMessageSet message_set = 1;
  if (cached_has_bits & 0x00000001u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, this->_internal_message_set(), deterministic, target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.TestMessageSetContainer)
  return target;
}

size_t TestMessageSetContainer::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.TestMessageSetContainer)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // optional .proto2_wireformat_unittest.TestMessageSet message_set = 1;
  if (has_message_set()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::MessageSize(
        *message_set_);
  }

  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TestMessageSetContainer::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.TestMessageSetContainer)
  GOOGLE_DCHECK_NE(&from, this);
  const TestMessageSetContainer* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const TestMessageSetContainer>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.TestMessageSetContainer)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.TestMessageSetContainer)
    MergeFrom(*source);
  }
}

void TestMessageSetContainer::MergeFrom(const TestMessageSetContainer& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.TestMessageSetContainer)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  if (from.has_message_set()) {
    mutable_message_set()->::proto2_wireformat_unittest::TestMessageSet::MergeFrom(from.message_set());
  }
}

void TestMessageSetContainer::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.TestMessageSetContainer)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void TestMessageSetContainer::CopyFrom(const TestMessageSetContainer& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.TestMessageSetContainer)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool TestMessageSetContainer::IsInitialized() const {
  if (has_message_set()) {
    if (!this->message_set_->IsInitialized()) return false;
  }
  return true;
}

void TestMessageSetContainer::Swap(TestMessageSetContainer* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    TestMessageSetContainer* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void TestMessageSetContainer::UnsafeArenaSwap(TestMessageSetContainer* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void TestMessageSetContainer::InternalSwap(TestMessageSetContainer* other) {
  using std::swap;
  swap(message_set_, other->message_set_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata TestMessageSetContainer::GetMetadata() const {
  protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void TestMessageSetExtension1::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestMessageSetExtension1::kIFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

TestMessageSetExtension1::TestMessageSetExtension1()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetExtension1.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.TestMessageSetExtension1)
}
TestMessageSetExtension1::TestMessageSetExtension1(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetExtension1.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:protobuf_unittest.TestMessageSetExtension1)
}
TestMessageSetExtension1::TestMessageSetExtension1(const TestMessageSetExtension1& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  i_ = from.i_;
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestMessageSetExtension1)
}

void TestMessageSetExtension1::SharedCtor() {
  i_ = 0;
}

TestMessageSetExtension1::~TestMessageSetExtension1() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.TestMessageSetExtension1)
  SharedDtor();
}

void TestMessageSetExtension1::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}

void TestMessageSetExtension1::ArenaDtor(void* object) {
  TestMessageSetExtension1* _this = reinterpret_cast< TestMessageSetExtension1* >(object);
  (void)_this;
}
void TestMessageSetExtension1::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void TestMessageSetExtension1::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* TestMessageSetExtension1::descriptor() {
  ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const TestMessageSetExtension1& TestMessageSetExtension1::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetExtension1.base);
  return *internal_default_instance();
}


void TestMessageSetExtension1::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.TestMessageSetExtension1)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  i_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool TestMessageSetExtension1::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.TestMessageSetExtension1)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional int32 i = 15;
      case 15: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(120u /* 120 & 0xFF */)) {
          set_has_i();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &i_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.TestMessageSetExtension1)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.TestMessageSetExtension1)
  return false;
#undef DO_
}

void TestMessageSetExtension1::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.TestMessageSetExtension1)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 i = 15;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(15, this->i(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.TestMessageSetExtension1)
}

::google::protobuf::uint8* TestMessageSetExtension1::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.TestMessageSetExtension1)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 i = 15;
  if (cached_has_bits & 0x00000001u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(15, this->i(), target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.TestMessageSetExtension1)
  return target;
}

size_t TestMessageSetExtension1::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.TestMessageSetExtension1)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // optional int32 i = 15;
  if (has_i()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::Int32Size(
        this->i());
  }

  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TestMessageSetExtension1::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.TestMessageSetExtension1)
  GOOGLE_DCHECK_NE(&from, this);
  const TestMessageSetExtension1* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const TestMessageSetExtension1>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.TestMessageSetExtension1)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.TestMessageSetExtension1)
    MergeFrom(*source);
  }
}

void TestMessageSetExtension1::MergeFrom(const TestMessageSetExtension1& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.TestMessageSetExtension1)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  if (from.has_i()) {
    set_i(from.i());
  }
}

void TestMessageSetExtension1::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.TestMessageSetExtension1)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void TestMessageSetExtension1::CopyFrom(const TestMessageSetExtension1& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.TestMessageSetExtension1)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool TestMessageSetExtension1::IsInitialized() const {
  return true;
}

void TestMessageSetExtension1::Swap(TestMessageSetExtension1* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    TestMessageSetExtension1* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void TestMessageSetExtension1::UnsafeArenaSwap(TestMessageSetExtension1* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void TestMessageSetExtension1::InternalSwap(TestMessageSetExtension1* other) {
  using std::swap;
  swap(i_, other->i_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata TestMessageSetExtension1::GetMetadata() const {
  protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void TestMessageSetExtension2::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestMessageSetExtension2::kStrFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

TestMessageSetExtension2::TestMessageSetExtension2()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetExtension2.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.TestMessageSetExtension2)
}
TestMessageSetExtension2::TestMessageSetExtension2(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetExtension2.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:protobuf_unittest.TestMessageSetExtension2)
}
TestMessageSetExtension2::TestMessageSetExtension2(const TestMessageSetExtension2& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  str_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_str()) {
    str_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.str(),
      GetArenaNoVirtual());
  }
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestMessageSetExtension2)
}

void TestMessageSetExtension2::SharedCtor() {
  str_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

TestMessageSetExtension2::~TestMessageSetExtension2() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.TestMessageSetExtension2)
  SharedDtor();
}

void TestMessageSetExtension2::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  str_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void TestMessageSetExtension2::ArenaDtor(void* object) {
  TestMessageSetExtension2* _this = reinterpret_cast< TestMessageSetExtension2* >(object);
  (void)_this;
}
void TestMessageSetExtension2::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void TestMessageSetExtension2::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* TestMessageSetExtension2::descriptor() {
  ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const TestMessageSetExtension2& TestMessageSetExtension2::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_TestMessageSetExtension2.base);
  return *internal_default_instance();
}


void TestMessageSetExtension2::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.TestMessageSetExtension2)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    str_.ClearNonDefaultToEmpty();
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool TestMessageSetExtension2::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.TestMessageSetExtension2)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional string str = 25;
      case 25: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(202u /* 202 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_str()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->str().data(), static_cast<int>(this->str().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "protobuf_unittest.TestMessageSetExtension2.str");
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.TestMessageSetExtension2)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.TestMessageSetExtension2)
  return false;
#undef DO_
}

void TestMessageSetExtension2::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.TestMessageSetExtension2)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional string str = 25;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->str().data(), static_cast<int>(this->str().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestMessageSetExtension2.str");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      25, this->str(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.TestMessageSetExtension2)
}

::google::protobuf::uint8* TestMessageSetExtension2::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.TestMessageSetExtension2)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional string str = 25;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->str().data(), static_cast<int>(this->str().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "protobuf_unittest.TestMessageSetExtension2.str");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        25, this->str(), target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.TestMessageSetExtension2)
  return target;
}

size_t TestMessageSetExtension2::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.TestMessageSetExtension2)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // optional string str = 25;
  if (has_str()) {
    total_size += 2 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->str());
  }

  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TestMessageSetExtension2::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.TestMessageSetExtension2)
  GOOGLE_DCHECK_NE(&from, this);
  const TestMessageSetExtension2* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const TestMessageSetExtension2>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.TestMessageSetExtension2)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.TestMessageSetExtension2)
    MergeFrom(*source);
  }
}

void TestMessageSetExtension2::MergeFrom(const TestMessageSetExtension2& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.TestMessageSetExtension2)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  if (from.has_str()) {
    set_str(from.str());
  }
}

void TestMessageSetExtension2::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.TestMessageSetExtension2)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void TestMessageSetExtension2::CopyFrom(const TestMessageSetExtension2& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.TestMessageSetExtension2)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool TestMessageSetExtension2::IsInitialized() const {
  return true;
}

void TestMessageSetExtension2::Swap(TestMessageSetExtension2* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    TestMessageSetExtension2* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void TestMessageSetExtension2::UnsafeArenaSwap(TestMessageSetExtension2* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void TestMessageSetExtension2::InternalSwap(TestMessageSetExtension2* other) {
  using std::swap;
  str_.Swap(&other->str_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata TestMessageSetExtension2::GetMetadata() const {
  protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void RawMessageSet_Item::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int RawMessageSet_Item::kTypeIdFieldNumber;
const int RawMessageSet_Item::kMessageFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

RawMessageSet_Item::RawMessageSet_Item()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_RawMessageSet_Item.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.RawMessageSet.Item)
}
RawMessageSet_Item::RawMessageSet_Item(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_RawMessageSet_Item.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:protobuf_unittest.RawMessageSet.Item)
}
RawMessageSet_Item::RawMessageSet_Item(const RawMessageSet_Item& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_message()) {
    message_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message(),
      GetArenaNoVirtual());
  }
  type_id_ = from.type_id_;
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.RawMessageSet.Item)
}

void RawMessageSet_Item::SharedCtor() {
  message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  type_id_ = 0;
}

RawMessageSet_Item::~RawMessageSet_Item() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.RawMessageSet.Item)
  SharedDtor();
}

void RawMessageSet_Item::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void RawMessageSet_Item::ArenaDtor(void* object) {
  RawMessageSet_Item* _this = reinterpret_cast< RawMessageSet_Item* >(object);
  (void)_this;
}
void RawMessageSet_Item::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void RawMessageSet_Item::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* RawMessageSet_Item::descriptor() {
  ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const RawMessageSet_Item& RawMessageSet_Item::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_RawMessageSet_Item.base);
  return *internal_default_instance();
}


void RawMessageSet_Item::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.RawMessageSet.Item)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    message_.ClearNonDefaultToEmpty();
  }
  type_id_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool RawMessageSet_Item::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.RawMessageSet.Item)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // required int32 type_id = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
          set_has_type_id();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &type_id_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // required bytes message = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
                input, this->mutable_message()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0 ||
            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
          input->SetLastTag(tag);
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.RawMessageSet.Item)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.RawMessageSet.Item)
  return false;
#undef DO_
}

void RawMessageSet_Item::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.RawMessageSet.Item)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // required int32 type_id = 2;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->type_id(), output);
  }

  // required bytes message = 3;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
      3, this->message(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.RawMessageSet.Item)
}

::google::protobuf::uint8* RawMessageSet_Item::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.RawMessageSet.Item)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // required int32 type_id = 2;
  if (cached_has_bits & 0x00000002u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->type_id(), target);
  }

  // required bytes message = 3;
  if (cached_has_bits & 0x00000001u) {
    target =
      ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
        3, this->message(), target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.RawMessageSet.Item)
  return target;
}

size_t RawMessageSet_Item::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:protobuf_unittest.RawMessageSet.Item)
  size_t total_size = 0;

  if (has_message()) {
    // required bytes message = 3;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::BytesSize(
        this->message());
  }

  if (has_type_id()) {
    // required int32 type_id = 2;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::Int32Size(
        this->type_id());
  }

  return total_size;
}
size_t RawMessageSet_Item::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.RawMessageSet.Item)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) {  // All required fields are present.
    // required bytes message = 3;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::BytesSize(
        this->message());

    // required int32 type_id = 2;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::Int32Size(
        this->type_id());

  } else {
    total_size += RequiredFieldsByteSizeFallback();
  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void RawMessageSet_Item::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.RawMessageSet.Item)
  GOOGLE_DCHECK_NE(&from, this);
  const RawMessageSet_Item* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const RawMessageSet_Item>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.RawMessageSet.Item)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.RawMessageSet.Item)
    MergeFrom(*source);
  }
}

void RawMessageSet_Item::MergeFrom(const RawMessageSet_Item& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.RawMessageSet.Item)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 3u) {
    if (cached_has_bits & 0x00000001u) {
      set_message(from.message());
    }
    if (cached_has_bits & 0x00000002u) {
      type_id_ = from.type_id_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void RawMessageSet_Item::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.RawMessageSet.Item)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void RawMessageSet_Item::CopyFrom(const RawMessageSet_Item& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.RawMessageSet.Item)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool RawMessageSet_Item::IsInitialized() const {
  if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
  return true;
}

void RawMessageSet_Item::Swap(RawMessageSet_Item* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    RawMessageSet_Item* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void RawMessageSet_Item::UnsafeArenaSwap(RawMessageSet_Item* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void RawMessageSet_Item::InternalSwap(RawMessageSet_Item* other) {
  using std::swap;
  message_.Swap(&other->message_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(type_id_, other->type_id_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata RawMessageSet_Item::GetMetadata() const {
  protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void RawMessageSet::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int RawMessageSet::kItemFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

RawMessageSet::RawMessageSet()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_RawMessageSet.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.RawMessageSet)
}
RawMessageSet::RawMessageSet(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena),
  item_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_RawMessageSet.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:protobuf_unittest.RawMessageSet)
}
RawMessageSet::RawMessageSet(const RawMessageSet& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_),
      item_(from.item_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.RawMessageSet)
}

void RawMessageSet::SharedCtor() {
}

RawMessageSet::~RawMessageSet() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.RawMessageSet)
  SharedDtor();
}

void RawMessageSet::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}

void RawMessageSet::ArenaDtor(void* object) {
  RawMessageSet* _this = reinterpret_cast< RawMessageSet* >(object);
  (void)_this;
}
void RawMessageSet::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void RawMessageSet::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* RawMessageSet::descriptor() {
  ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const RawMessageSet& RawMessageSet::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::scc_info_RawMessageSet.base);
  return *internal_default_instance();
}


void RawMessageSet::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.RawMessageSet)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  item_.Clear();
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool RawMessageSet::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.RawMessageSet)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // repeated group Item = 1 { ... };
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(11u /* 11 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadGroup(1, input, add_item()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.RawMessageSet)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.RawMessageSet)
  return false;
#undef DO_
}

void RawMessageSet::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.RawMessageSet)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated group Item = 1 { ... };
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->item_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteGroupMaybeToArray(
      1,
      this->item(static_cast<int>(i)),
      output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.RawMessageSet)
}

::google::protobuf::uint8* RawMessageSet::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.RawMessageSet)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated group Item = 1 { ... };
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->item_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteGroupToArray(
        1, this->item(static_cast<int>(i)), deterministic, target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.RawMessageSet)
  return target;
}

size_t RawMessageSet::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.RawMessageSet)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // repeated group Item = 1 { ... };
  {
    unsigned int count = static_cast<unsigned int>(this->item_size());
    total_size += 2UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::GroupSize(
          this->item(static_cast<int>(i)));
    }
  }

  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void RawMessageSet::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.RawMessageSet)
  GOOGLE_DCHECK_NE(&from, this);
  const RawMessageSet* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const RawMessageSet>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.RawMessageSet)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.RawMessageSet)
    MergeFrom(*source);
  }
}

void RawMessageSet::MergeFrom(const RawMessageSet& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.RawMessageSet)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  item_.MergeFrom(from.item_);
}

void RawMessageSet::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.RawMessageSet)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void RawMessageSet::CopyFrom(const RawMessageSet& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.RawMessageSet)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool RawMessageSet::IsInitialized() const {
  if (!::google::protobuf::internal::AllAreInitialized(this->item())) return false;
  return true;
}

void RawMessageSet::Swap(RawMessageSet* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    RawMessageSet* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void RawMessageSet::UnsafeArenaSwap(RawMessageSet* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void RawMessageSet::InternalSwap(RawMessageSet* other) {
  using std::swap;
  CastToBase(&item_)->InternalSwap(CastToBase(&other->item_));
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata RawMessageSet::GetMetadata() const {
  protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fmset_2eproto::file_level_metadata[kIndexInFileMessages];
}

#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestMessageSetExtension1::kMessageSetExtensionFieldNumber;
#endif
::google::protobuf::internal::ExtensionIdentifier< ::proto2_wireformat_unittest::TestMessageSet,
    ::google::protobuf::internal::MessageTypeTraits< ::protobuf_unittest::TestMessageSetExtension1 >, 11, false >
  TestMessageSetExtension1::message_set_extension(kMessageSetExtensionFieldNumber, *::protobuf_unittest::TestMessageSetExtension1::internal_default_instance());
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestMessageSetExtension2::kMessageSetExtensionFieldNumber;
#endif
::google::protobuf::internal::ExtensionIdentifier< ::proto2_wireformat_unittest::TestMessageSet,
    ::google::protobuf::internal::MessageTypeTraits< ::protobuf_unittest::TestMessageSetExtension2 >, 11, false >
  TestMessageSetExtension2::message_set_extension(kMessageSetExtensionFieldNumber, *::protobuf_unittest::TestMessageSetExtension2::internal_default_instance());

// @@protoc_insertion_point(namespace_scope)
}  // namespace protobuf_unittest
namespace google {
namespace protobuf {
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestMessageSetContainer* Arena::CreateMaybeMessage< ::protobuf_unittest::TestMessageSetContainer >(Arena* arena) {
  return Arena::CreateMessageInternal< ::protobuf_unittest::TestMessageSetContainer >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestMessageSetExtension1* Arena::CreateMaybeMessage< ::protobuf_unittest::TestMessageSetExtension1 >(Arena* arena) {
  return Arena::CreateMessageInternal< ::protobuf_unittest::TestMessageSetExtension1 >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestMessageSetExtension2* Arena::CreateMaybeMessage< ::protobuf_unittest::TestMessageSetExtension2 >(Arena* arena) {
  return Arena::CreateMessageInternal< ::protobuf_unittest::TestMessageSetExtension2 >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::RawMessageSet_Item* Arena::CreateMaybeMessage< ::protobuf_unittest::RawMessageSet_Item >(Arena* arena) {
  return Arena::CreateMessageInternal< ::protobuf_unittest::RawMessageSet_Item >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::RawMessageSet* Arena::CreateMaybeMessage< ::protobuf_unittest::RawMessageSet >(Arena* arena) {
  return Arena::CreateMessageInternal< ::protobuf_unittest::RawMessageSet >(arena);
}
}  // namespace protobuf
}  // namespace google

// @@protoc_insertion_point(global_scope)
