| Index: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc
|
| index e5e2f07dd4e13ebdb6df4ebd78566c9c87a27284..f585c31b4bf8ebfb9a2bb5d96968bf63f9c6d470 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc
|
| @@ -49,10 +49,11 @@ void SetMessageVariables(const FieldDescriptor* descriptor,
|
| const Options& options) {
|
| SetCommonFieldVariables(descriptor, variables, options);
|
| (*variables)["type"] = FieldMessageTypeName(descriptor);
|
| - (*variables)["stream_writer"] = (*variables)["declared_type"] +
|
| - (HasFastArraySerialization(descriptor->message_type()->file()) ?
|
| - "MaybeToArray" :
|
| - "");
|
| + (*variables)["stream_writer"] =
|
| + (*variables)["declared_type"] +
|
| + (HasFastArraySerialization(descriptor->message_type()->file(), options)
|
| + ? "MaybeToArray"
|
| + : "");
|
| (*variables)["full_name"] = descriptor->full_name();
|
|
|
| const FieldDescriptor* key =
|
| @@ -83,7 +84,7 @@ void SetMessageVariables(const FieldDescriptor* descriptor,
|
| (*variables)["number"] = SimpleItoa(descriptor->number());
|
| (*variables)["tag"] = SimpleItoa(internal::WireFormat::MakeTag(descriptor));
|
|
|
| - if (HasDescriptorMethods(descriptor->file())) {
|
| + if (HasDescriptorMethods(descriptor->file(), options)) {
|
| (*variables)["lite"] = "";
|
| } else {
|
| (*variables)["lite"] = "Lite";
|
| @@ -98,10 +99,10 @@ void SetMessageVariables(const FieldDescriptor* descriptor,
|
| }
|
| }
|
|
|
| -MapFieldGenerator::
|
| -MapFieldGenerator(const FieldDescriptor* descriptor,
|
| - const Options& options)
|
| - : descriptor_(descriptor),
|
| +MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor,
|
| + const Options& options)
|
| + : FieldGenerator(options),
|
| + descriptor_(descriptor),
|
| dependent_field_(options.proto_h && IsFieldDependent(descriptor)) {
|
| SetMessageVariables(descriptor, &variables_, options);
|
| }
|
| @@ -127,10 +128,10 @@ GeneratePrivateMembers(io::Printer* printer) const {
|
| void MapFieldGenerator::
|
| GenerateAccessorDeclarations(io::Printer* printer) const {
|
| printer->Print(variables_,
|
| - "const ::google::protobuf::Map< $key_cpp$, $val_cpp$ >&\n"
|
| - " $name$() const$deprecation$;\n"
|
| - "::google::protobuf::Map< $key_cpp$, $val_cpp$ >*\n"
|
| - " mutable_$name$()$deprecation$;\n");
|
| + "$deprecated_attr$const ::google::protobuf::Map< $key_cpp$, $val_cpp$ >&\n"
|
| + " $name$() const;\n"
|
| + "$deprecated_attr$::google::protobuf::Map< $key_cpp$, $val_cpp$ >*\n"
|
| + " mutable_$name$();\n");
|
| }
|
|
|
| void MapFieldGenerator::
|
| @@ -170,7 +171,7 @@ GenerateSwappingCode(io::Printer* printer) const {
|
|
|
| void MapFieldGenerator::
|
| GenerateConstructorCode(io::Printer* printer) const {
|
| - if (HasDescriptorMethods(descriptor_->file())) {
|
| + if (HasDescriptorMethods(descriptor_->file(), options_)) {
|
| printer->Print(variables_,
|
| "$name$_.SetAssignDescriptorCallback(\n"
|
| " protobuf_AssignDescriptorsOnce);\n"
|
| @@ -217,7 +218,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
|
| " (*mutable_$name$())[entry->key()] =\n"
|
| " static_cast< $val_cpp$ >(*entry->mutable_value());\n"
|
| " } else {\n");
|
| - if (HasDescriptorMethods(descriptor_->file())) {
|
| + if (HasDescriptorMethods(descriptor_->file(), options_)) {
|
| printer->Print(variables_,
|
| " mutable_unknown_fields()"
|
| "->AddLengthDelimited($number$, data);\n");
|
| @@ -238,14 +239,14 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
|
| descriptor_->message_type()->FindFieldByName("key");
|
| if (key_field->type() == FieldDescriptor::TYPE_STRING) {
|
| GenerateUtf8CheckCodeForString(
|
| - key_field, true, variables_,
|
| + key_field, options_, true, variables_,
|
| "entry->key().data(), entry->key().length(),\n", printer);
|
| }
|
| if (value_field->type() == FieldDescriptor::TYPE_STRING) {
|
| - GenerateUtf8CheckCodeForString(
|
| - value_field, true, variables_,
|
| - "entry->mutable_value()->data(),\n"
|
| - "entry->mutable_value()->length(),\n", printer);
|
| + GenerateUtf8CheckCodeForString(value_field, options_, true, variables_,
|
| + "entry->mutable_value()->data(),\n"
|
| + "entry->mutable_value()->length(),\n",
|
| + printer);
|
| }
|
|
|
| // If entry is allocated by arena, its desctructor should be avoided.
|
| @@ -285,14 +286,14 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
|
| const FieldDescriptor* value_field =
|
| descriptor_->message_type()->FindFieldByName("value");
|
| if (key_field->type() == FieldDescriptor::TYPE_STRING) {
|
| - GenerateUtf8CheckCodeForString(
|
| - key_field, false, variables_,
|
| - "it->first.data(), it->first.length(),\n", printer);
|
| + GenerateUtf8CheckCodeForString(key_field, options_, false, variables_,
|
| + "it->first.data(), it->first.length(),\n",
|
| + printer);
|
| }
|
| if (value_field->type() == FieldDescriptor::TYPE_STRING) {
|
| - GenerateUtf8CheckCodeForString(
|
| - value_field, false, variables_,
|
| - "it->second.data(), it->second.length(),\n", printer);
|
| + GenerateUtf8CheckCodeForString(value_field, options_, false, variables_,
|
| + "it->second.data(), it->second.length(),\n",
|
| + printer);
|
| }
|
|
|
| printer->Outdent();
|
| @@ -343,14 +344,14 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
|
| const FieldDescriptor* value_field =
|
| descriptor_->message_type()->FindFieldByName("value");
|
| if (key_field->type() == FieldDescriptor::TYPE_STRING) {
|
| - GenerateUtf8CheckCodeForString(
|
| - key_field, false, variables_,
|
| - "it->first.data(), it->first.length(),\n", printer);
|
| + GenerateUtf8CheckCodeForString(key_field, options_, false, variables_,
|
| + "it->first.data(), it->first.length(),\n",
|
| + printer);
|
| }
|
| if (value_field->type() == FieldDescriptor::TYPE_STRING) {
|
| - GenerateUtf8CheckCodeForString(
|
| - value_field, false, variables_,
|
| - "it->second.data(), it->second.length(),\n", printer);
|
| + GenerateUtf8CheckCodeForString(value_field, options_, false, variables_,
|
| + "it->second.data(), it->second.length(),\n",
|
| + printer);
|
| }
|
|
|
| printer->Outdent();
|
|
|