Remove _internal_has_XXX APIs and directly check presence (e.g. has_bits, oneof case).

PiperOrigin-RevId: 491417852
pull/11073/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 9a1ef54b47
commit 585b41a2dd
  1. 4
      src/google/protobuf/compiler/cpp/enum_field.cc
  2. 63
      src/google/protobuf/compiler/cpp/field.cc
  3. 2
      src/google/protobuf/compiler/cpp/field.h
  4. 117
      src/google/protobuf/compiler/cpp/message.cc
  5. 44
      src/google/protobuf/compiler/cpp/message_field.cc
  6. 5
      src/google/protobuf/compiler/cpp/parse_function_generator.cc
  7. 4
      src/google/protobuf/compiler/cpp/primitive_field.cc
  8. 17
      src/google/protobuf/compiler/cpp/string_field.cc
  9. 16
      src/google/protobuf/compiler/plugin.pb.cc
  10. 108
      src/google/protobuf/compiler/plugin.pb.h
  11. 114
      src/google/protobuf/descriptor.pb.cc
  12. 804
      src/google/protobuf/descriptor.pb.h

@ -198,7 +198,7 @@ void EnumOneofFieldGenerator::GenerateInlineAccessorDefinitions(
Formatter format(printer, variables_);
format(
"inline $type$ $classname$::_internal_$name$() const {\n"
" if (_internal_has_$name$()) {\n"
" if ($has_field$) {\n"
" return static_cast< $type$ >($field$);\n"
" }\n"
" return static_cast< $type$ >($default$);\n"
@ -213,7 +213,7 @@ void EnumOneofFieldGenerator::GenerateInlineAccessorDefinitions(
format(" assert($type$_IsValid(value));\n");
}
format(
" if (!_internal_has_$name$()) {\n"
" if ($not_has_field$) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" }\n"

@ -38,8 +38,10 @@
#include <memory>
#include <string>
#include "google/protobuf/descriptor.h"
#include "absl/container/flat_hash_map.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/cpp/helpers.h"
@ -84,27 +86,29 @@ std::string GenerateTemplateForOneofString(const FieldDescriptor* descriptor,
descriptor->options().ctype() == google::protobuf::FieldOptions::STRING
? "$0.UnsafeGetPointer()"
: "$0";
std::string has_field = absl::StrFormat(
"%s_case() == k%s", descriptor->containing_oneof()->name(),
UnderscoresToCamelCase(descriptor->name(), true));
if (descriptor->default_value_string().empty()) {
return absl::Substitute(absl::StrCat("_internal_has_", field_name, "() ? ",
field_pointer, ": nullptr"),
field_member);
return absl::Substitute(
absl::StrCat(has_field, " ? ", field_pointer, ": nullptr"),
field_member);
}
if (descriptor->options().ctype() == google::protobuf::FieldOptions::STRING_PIECE) {
return absl::Substitute(absl::StrCat("_internal_has_", field_name, "() ? ",
field_pointer, ": nullptr"),
field_member);
return absl::Substitute(
absl::StrCat(has_field, " ? ", field_pointer, ": nullptr"),
field_member);
}
std::string default_value_pointer =
descriptor->options().ctype() == google::protobuf::FieldOptions::STRING
? "&$1.get()"
: "&$1";
return absl::Substitute(
absl::StrCat("_internal_has_", field_name, "() ? ", field_pointer, " : ",
default_value_pointer),
field_member, MakeDefaultFieldName(descriptor));
return absl::Substitute(absl::StrCat(has_field, " ? ", field_pointer, " : ",
default_value_pointer),
field_member, MakeDefaultFieldName(descriptor));
}
std::string GenerateTemplateForSingleString(const FieldDescriptor* descriptor,
@ -289,8 +293,18 @@ absl::flat_hash_map<absl::string_view, std::string> OneofFieldVars(
if (descriptor->containing_oneof() == nullptr) {
return {};
}
return {{"oneof_name", descriptor->containing_oneof()->name()}};
std::string oneof_name = descriptor->containing_oneof()->name();
std::string field_name = UnderscoresToCamelCase(descriptor->name(), true);
return {
{"oneof_name", oneof_name},
{"field_name", field_name},
{"oneof_index", absl::StrCat(descriptor->containing_oneof()->index())},
{"has_field",
absl::StrFormat("%s_case() == k%s", oneof_name, field_name)},
{"not_has_field",
absl::StrFormat("%s_case() != k%s", oneof_name, field_name)},
};
}
void SetCommonOneofFieldVariables(
@ -306,12 +320,17 @@ void FieldGenerator::SetHasBitIndex(int32_t has_bit_index) {
GOOGLE_CHECK_EQ(has_bit_index, -1);
return;
}
variables_["set_hasbit"] = absl::StrCat(
variables_["has_bits"], "[", has_bit_index / 32, "] |= 0x",
absl::Hex(1u << (has_bit_index % 32), absl::kZeroPad8), "u;");
variables_["clear_hasbit"] = absl::StrCat(
variables_["has_bits"], "[", has_bit_index / 32, "] &= ~0x",
absl::Hex(1u << (has_bit_index % 32), absl::kZeroPad8), "u;");
int32_t index = has_bit_index / 32;
std::string mask =
absl::StrCat(absl::Hex(1u << (has_bit_index % 32), absl::kZeroPad8));
const std::string& has_bits = variables_["has_bits"];
variables_["has_hasbit"] =
absl::StrFormat("%s[%d] & 0x%su", has_bits, index, mask);
variables_["set_hasbit"] =
absl::StrFormat("%s[%d] |= 0x%su;", has_bits, index, mask);
variables_["clear_hasbit"] =
absl::StrFormat("%s[%d] &= ~0x%su;", has_bits, index, mask);
}
void FieldGenerator::SetInlinedStringIndex(int32_t inlined_string_index) {
@ -365,6 +384,14 @@ void FieldGenerator::GenerateCopyConstructorCode(io::Printer* printer) const {
}
}
void FieldGenerator::GenerateIfHasField(io::Printer* printer) const {
GOOGLE_CHECK(internal::cpp::HasHasbit(descriptor_));
GOOGLE_CHECK(variables_.find("has_hasbit") != variables_.end());
Formatter format(printer, variables_);
format("if (($has_hasbit$) != 0) {\n");
}
FieldGenerator::~FieldGenerator() {}
FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor,

@ -215,6 +215,8 @@ class FieldGenerator {
// message fields won't need to override this function.
virtual void GenerateIsInitialized(io::Printer* printer) const {}
virtual void GenerateIfHasField(io::Printer* printer) const;
virtual bool IsInlined() const { return false; }
virtual ArenaDtorNeeds NeedsArenaDestructor() const {

@ -242,7 +242,8 @@ bool EmitFieldNonDefaultCondition(io::Printer* p, const std::string& prefix,
format.Indent();
return true;
} else if (field->real_containing_oneof()) {
format("if (_internal_has_$name$()) {\n");
auto v = p->WithVars(OneofFieldVars(field));
format("if ($has_field$) {\n");
format.Indent();
return true;
}
@ -261,6 +262,11 @@ bool HasHasMethod(const FieldDescriptor* field) {
field->has_optional_keyword() || field->real_containing_oneof();
}
bool HasInternalHasMethod(const FieldDescriptor* field) {
return !HasHasbit(field) &&
field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE;
}
// Collects map entry message type information.
void CollectMapInfo(
const Options& options, const Descriptor* descriptor,
@ -286,14 +292,6 @@ void CollectMapInfo(
"TYPE_" + absl::AsciiStrToUpper(DeclaredTypeMethodName(val->type()));
}
// Does the given field have a private (internal helper only) has_$name$()
// method?
bool HasPrivateHasMethod(const FieldDescriptor* field) {
// Only for oneofs in message types with no field presence. has_$name$(),
// based on the oneof case, is still useful internally for generated code.
return IsProto3(field->file()) && field->real_containing_oneof();
}
// Returns true to make the message serialize in order, decided by the following
// factors in the order of precedence.
@ -622,6 +620,16 @@ absl::flat_hash_map<absl::string_view, std::string> ClassVars(
return vars;
}
absl::flat_hash_map<absl::string_view, std::string> HasbitVars(
int has_bit_index) {
return {
{"has_array_index", absl::StrCat(has_bit_index / 32)},
{"has_mask",
absl::StrCat(
"0x", absl::Hex(1u << (has_bit_index % 32), absl::kZeroPad8), "u")},
};
}
} // anonymous namespace
// ===================================================================
@ -786,17 +794,13 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* p) {
"public:\n",
field);
}
} else if (HasHasMethod(field)) {
format("$deprecated_attr$bool ${1$has_$name$$}$() const$2$\n", field,
!IsFieldStripped(field, options_) ? ";" : " {__builtin_trap();}");
if (!IsFieldStripped(field, options_)) {
} else {
if (HasHasMethod(field)) {
format(
"private:\n"
"bool _internal_has_$name$() const;\n"
"public:\n");
"$deprecated_attr$bool ${1$has_$name$$}$() const$2$\n", field,
!IsFieldStripped(field, options_) ? ";" : " {__builtin_trap();}");
}
} else if (HasPrivateHasMethod(field)) {
if (!IsFieldStripped(field, options_)) {
if (HasInternalHasMethod(field) && !IsFieldStripped(field, options_)) {
format(
"private:\n"
"bool ${1$_internal_has_$name$$}$() const;\n"
@ -1057,15 +1061,11 @@ void MessageGenerator::GenerateSingularFieldHasBits(
int has_bit_index = HasBitIndex(field);
GOOGLE_CHECK_NE(has_bit_index, kNoHasbit);
auto v = p->WithVars({
{"has_array_index", has_bit_index / 32},
{"has_mask", absl::Hex(1u << (has_bit_index % 32), absl::kZeroPad8)},
});
auto v = p->WithVars(HasbitVars(has_bit_index));
format(
"inline bool $classname$::_internal_has_$name$() const {\n"
" bool value = "
"($has_bits$[$has_array_index$] & 0x$has_mask$u) != 0;\n");
"inline bool $classname$::has_$name$() const {\n"
"$annotate_has$"
" bool value = ($has_bits$[$has_array_index$] & $has_mask$) != 0;\n");
if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
!IsLazy(field, options_, scc_analyzer_)) {
@ -1077,10 +1077,6 @@ void MessageGenerator::GenerateSingularFieldHasBits(
format(
" return value;\n"
"}\n"
"inline bool $classname$::has_$name$() const {\n"
"$annotate_has$"
" return _internal_has_$name$();\n"
"}\n");
} else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
// Message fields have a has_$name$() method.
@ -1124,6 +1120,7 @@ void MessageGenerator::GenerateOneofHasBits(io::Printer* p) {
void MessageGenerator::GenerateOneofMemberHasBits(const FieldDescriptor* field,
io::Printer* p) {
auto v = p->WithVars(OneofFieldVars(field));
Formatter format(p);
if (IsFieldStripped(field, options_)) {
if (HasHasMethod(field)) {
@ -1139,25 +1136,18 @@ void MessageGenerator::GenerateOneofMemberHasBits(const FieldDescriptor* field,
// Singular field in a oneof
// N.B.: Without field presence, we do not use has-bits or generate
// has_$name$() methods, but oneofs still have set_has_$name$().
// Oneofs also have has_$name$() but only as a private helper
// method, so that generated code is slightly cleaner (vs. comparing
// _oneof_case_[index] against a constant everywhere).
//
// If has_$name$() is private, there is no need to add an internal accessor.
// Only annotate public accessors.
// Oneofs also have private _internal_has_$name$() a helper method.
if (HasHasMethod(field)) {
format(
"inline bool $classname$::_internal_has_$name$() const {\n"
" return $oneof_name$_case() == k$field_name$;\n"
"}\n"
"inline bool $classname$::has_$name$() const {\n"
"$annotate_has$"
" return _internal_has_$name$();\n"
" return $has_field$;\n"
"}\n");
} else if (HasPrivateHasMethod(field)) {
}
if (HasInternalHasMethod(field)) {
format(
"inline bool $classname$::_internal_has_$name$() const {\n"
" return $oneof_name$_case() == k$field_name$;\n"
" return $has_field$;\n"
"}\n");
}
// set_has_$name$() for oneof fields is always private; hence should not be
@ -1188,7 +1178,7 @@ void MessageGenerator::GenerateFieldClear(const FieldDescriptor* field,
// Clear this field only if it is the active field in this oneof,
// otherwise ignore
auto v = p->WithVars(OneofFieldVars(field));
format("if (_internal_has_$name$()) {\n");
format("if ($has_field$) {\n");
format.Indent();
field_generators_.get(field).GenerateClearingCode(p);
format("clear_has_$oneof_name$();\n");
@ -1201,10 +1191,8 @@ void MessageGenerator::GenerateFieldClear(const FieldDescriptor* field,
field_generators_.get(field).GenerateClearingCode(p);
if (HasHasbit(field)) {
int has_bit_index = HasBitIndex(field);
auto v = p->WithVars({{"has_array_index", has_bit_index / 32},
{"has_mask", absl::Hex(1u << (has_bit_index % 32),
absl::kZeroPad8)}});
format("$has_bits$[$has_array_index$] &= ~0x$has_mask$u;\n");
auto v = p->WithVars(HasbitVars(has_bit_index));
format("$has_bits$[$has_array_index$] &= ~$has_mask$;\n");
}
}
format("$annotate_clear$");
@ -1245,11 +1233,6 @@ void MessageGenerator::GenerateFieldAccessorDefinitions(io::Printer* p) {
: "");
}
} else if (field->real_containing_oneof()) {
auto v = p->WithVars({
{"field_name", UnderscoresToCamelCase(field->name(), true)},
{"oneof_name", field->containing_oneof()->name()},
{"oneof_index", absl::StrCat(field->containing_oneof()->index())},
});
GenerateOneofMemberHasBits(field, p);
} else {
// Singular field.
@ -3513,7 +3496,9 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
cached_has_word_index != HasWordIndex(field)) {
// Check hasbit, not using cached bits.
GOOGLE_CHECK(HasHasbit(field));
format("if (from._internal_has_$1$()) {\n", FieldName(field));
auto v = p->WithVars(HasbitVars(HasBitIndex(field)));
format(
"if ((from.$has_bits$[$has_array_index$] & $has_mask$) != 0) {\n");
format.Indent();
generator.GenerateMergingCode(p);
format.Outdent();
@ -3704,18 +3689,18 @@ void MessageGenerator::GenerateSerializeOneField(io::Printer* p,
PrintFieldComment(format, field);
}
const FieldGenerator& field_gen = field_generators_.get(field);
bool have_enclosing_if = false;
if (field->options().weak()) {
} else if (HasHasbit(field)) {
// Attempt to use the state of cached_has_bits, if possible.
int has_bit_index = HasBitIndex(field);
auto v = p->WithVars(HasbitVars(has_bit_index));
if (cached_has_bits_index == has_bit_index / 32) {
const std::string mask =
absl::StrCat(absl::Hex(1u << (has_bit_index % 32), absl::kZeroPad8));
format("if (cached_has_bits & 0x$1$u) {\n", mask);
format("if (cached_has_bits & $has_mask$) {\n");
} else {
format("if (_internal_has_$1$()) {\n", FieldName(field));
field_gen.GenerateIfHasField(p);
}
format.Indent();
@ -3724,7 +3709,7 @@ void MessageGenerator::GenerateSerializeOneField(io::Printer* p,
have_enclosing_if = EmitFieldNonDefaultCondition(p, "this->", field);
}
field_generators_.get(field).GenerateSerializeWithCachedSizesToArray(p);
field_gen.GenerateSerializeWithCachedSizesToArray(p);
if (have_enclosing_if) {
format.Outdent();
@ -4150,13 +4135,12 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) {
format("::size_t total_size = 0;\n");
for (auto field : optimized_order_) {
if (field->is_required()) {
format(
"\n"
"if (_internal_has_$1$()) {\n",
FieldName(field));
const FieldGenerator& field_gen = field_generators_.get(field);
format("\n");
field_gen.GenerateIfHasField(p);
format.Indent();
PrintFieldComment(format, field);
field_generators_.get(field).GenerateByteSize(p);
field_gen.GenerateByteSize(p);
format.Outdent();
format("}\n");
}
@ -4210,9 +4194,10 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) {
for (auto field : optimized_order_) {
if (!field->is_required()) continue;
PrintFieldComment(format, field);
format("if (_internal_has_$1$()) {\n", FieldName(field));
const FieldGenerator& field_gen = field_generators_.get(field);
field_gen.GenerateIfHasField(p);
format.Indent();
field_generators_.get(field).GenerateByteSize(p);
field_gen.GenerateByteSize(p);
format.Outdent();
format("}\n");
}

@ -363,7 +363,7 @@ void MessageFieldGenerator::GenerateInternalAccessorDefinitions(
format(" if (msg->$field$ == nullptr) {\n");
} else {
format(
" if (!msg->_internal_has_$name$()) {\n"
" if (msg->$not_has_field$) {\n"
" msg->clear_$oneof_name$();\n"
" msg->set_has_$name$();\n");
}
@ -463,15 +463,24 @@ void MessageFieldGenerator::GenerateDestructorCode(io::Printer* printer) const {
format("delete $field$;\n");
}
using internal::cpp::HasHasbit;
void MessageFieldGenerator::GenerateCopyConstructorCode(
io::Printer* printer) const {
GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
Formatter format(printer, variables_);
format(
"if (from._internal_has_$name$()) {\n"
" _this->$field$ = new $type$(*from.$field$);\n"
"}\n");
if (HasHasbit(descriptor_)) {
format(
"if ((from.$has_hasbit$) != 0) {\n"
" _this->$field$ = new $type$(*from.$field$);\n"
"}\n");
} else {
format(
"if (from._internal_has_$name$()) {\n"
" _this->$field$ = new $type$(*from.$field$);\n"
"}\n");
}
}
void MessageFieldGenerator::GenerateSerializeWithCachedSizesToArray(
@ -509,10 +518,17 @@ void MessageFieldGenerator::GenerateIsInitialized(io::Printer* printer) const {
if (!has_required_fields_) return;
Formatter format(printer, variables_);
format(
"if (_internal_has_$name$()) {\n"
" if (!$field$->IsInitialized()) return false;\n"
"}\n");
if (HasHasbit(descriptor_)) {
format(
"if (($has_hasbit$) != 0) {\n"
" if (!$field$->IsInitialized()) return false;\n"
"}\n");
} else {
format(
"if (_internal_has_$name$()) {\n"
" if (!$field$->IsInitialized()) return false;\n"
"}\n");
}
}
void MessageFieldGenerator::GenerateConstexprAggregateInitializer(
@ -590,7 +606,7 @@ void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions(
"$annotate_release$"
" // @@protoc_insertion_point(field_release:$full_name$)\n"
"$type_reference_function$"
" if (_internal_has_$name$()) {\n"
" if ($has_field$) {\n"
" clear_has_$oneof_name$();\n"
" $type$* temp = $casted_member$;\n"
" if (GetArenaForAllocation() != nullptr) {\n"
@ -606,7 +622,7 @@ void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions(
format(
"inline const $type$& $classname$::_internal_$name$() const {\n"
"$type_reference_function$"
" return _internal_has_$name$()\n"
" return $has_field$\n"
" ? $casted_member_const$\n"
" : reinterpret_cast< $type$&>($type_default_instance$);\n"
"}\n"
@ -620,7 +636,7 @@ void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions(
" // @@protoc_insertion_point(field_unsafe_arena_release"
":$full_name$)\n"
"$type_reference_function$"
" if (_internal_has_$name$()) {\n"
" if ($has_field$) {\n"
" clear_has_$oneof_name$();\n"
" $type$* temp = $casted_member$;\n"
" $field$ = nullptr;\n"
@ -652,7 +668,7 @@ void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions(
"}\n"
"inline $type$* $classname$::_internal_mutable_$name$() {\n"
"$type_reference_function$"
" if (!_internal_has_$name$()) {\n"
" if ($not_has_field$) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n");
if (implicit_weak_field_) {
@ -716,7 +732,7 @@ void MessageOneofFieldGenerator::GenerateIsInitialized(
Formatter format(printer, variables_);
format(
"if (_internal_has_$name$()) {\n"
"if ($has_field$) {\n"
" if (!$field$->IsInitialized()) return false;\n"
"}\n");
}

@ -1070,7 +1070,7 @@ void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format,
}
if (field->real_containing_oneof()) {
format(
"if (!$msg$_internal_has_$name$()) {\n"
"if ($msg$$1$_case() != k$2$) {\n"
" $msg$clear_$1$();\n"
" $msg$$field$ = ::$proto_ns$::Arena::CreateMessage<\n"
" ::$proto_ns$::internal::LazyField>("
@ -1078,7 +1078,8 @@ void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format,
" $msg$set_has_$name$();\n"
"}\n"
"auto* lazy_field = $msg$$field$;\n",
field->containing_oneof()->name());
field->containing_oneof()->name(),
UnderscoresToCamelCase(field->name(), true));
} else if (internal::cpp::HasHasbit(field)) {
format(
"_Internal::set_has_$name$(&$has_bits$);\n"

@ -270,13 +270,13 @@ void PrimitiveOneofFieldGenerator::GenerateInlineAccessorDefinitions(
Formatter format(printer, variables_);
format(
"inline $type$ $classname$::_internal_$name$() const {\n"
" if (_internal_has_$name$()) {\n"
" if ($has_field$) {\n"
" return $field$;\n"
" }\n"
" return $default$;\n"
"}\n"
"inline void $classname$::_internal_set_$name$($type$ value) {\n"
" if (!_internal_has_$name$()) {\n"
" if ($not_has_field$) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" }\n"

@ -291,7 +291,7 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions(
if (internal::cpp::HasHasbit(descriptor_)) {
format(
" if (!_internal_has_$name$()) {\n"
" if (($has_hasbit$) == 0) {\n"
" return nullptr;\n"
" }\n"
" $clear_hasbit$\n");
@ -463,7 +463,7 @@ void StringFieldGenerator::GenerateCopyConstructorCode(
}
if (internal::cpp::HasHasbit(descriptor_)) {
format("if (from._internal_has_$name$()) {\n");
format("if ((from.$has_hasbit$) != 0) {\n");
} else {
format("if (!from._internal_$name$().empty()) {\n");
}
@ -580,9 +580,6 @@ StringOneofFieldGenerator::StringOneofFieldGenerator(
const FieldDescriptor* descriptor, const Options& options)
: StringFieldGenerator(descriptor, options) {
SetCommonOneofFieldVariables(descriptor, &variables_);
variables_["field_name"] = UnderscoresToCamelCase(descriptor->name(), true);
variables_["oneof_index"] =
absl::StrCat(descriptor->containing_oneof()->index());
}
StringOneofFieldGenerator::~StringOneofFieldGenerator() {}
@ -598,7 +595,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions(
"}\n"
"template <typename ArgT0, typename... ArgT>\n"
"inline void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n"
" if (!_internal_has_$name$()) {\n"
" if ($not_has_field$) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field$.InitDefault();\n"
@ -615,14 +612,14 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions(
" return _s;\n"
"}\n"
"inline const std::string& $classname$::_internal_$name$() const {\n"
" if (_internal_has_$name$()) {\n"
" if ($has_field$) {\n"
" return $field$.Get();\n"
" }\n"
" return $default_string$;\n"
"}\n"
"inline void $classname$::_internal_set_$name$(const std::string& "
"value) {\n"
" if (!_internal_has_$name$()) {\n"
" if ($not_has_field$) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field$.InitDefault();\n"
@ -631,7 +628,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions(
"}\n");
format(
"inline std::string* $classname$::_internal_mutable_$name$() {\n"
" if (!_internal_has_$name$()) {\n"
" if ($not_has_field$) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field$.InitDefault();\n"
@ -642,7 +639,7 @@ void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions(
"inline std::string* $classname$::$release_name$() {\n"
"$annotate_release$"
" // @@protoc_insertion_point(field_release:$full_name$)\n"
" if (_internal_has_$name$()) {\n"
" if ($has_field$) {\n"
" clear_has_$oneof_name$();\n"
" return $field$.Release();\n"
" } else {\n"

@ -308,7 +308,7 @@ Version::Version(const Version& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.suffix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_suffix()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.suffix_.Set(from._internal_suffix(),
_this->GetArenaForAllocation());
}
@ -644,11 +644,11 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.parameter_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_parameter()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.parameter_.Set(from._internal_parameter(),
_this->GetArenaForAllocation());
}
if (from._internal_has_compiler_version()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.compiler_version_ = new ::PROTOBUF_NAMESPACE_ID::compiler::Version(*from._impl_.compiler_version_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest)
@ -1013,7 +1013,7 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
@ -1021,7 +1021,7 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.insertion_point_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_insertion_point()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.insertion_point_.Set(from._internal_insertion_point(),
_this->GetArenaForAllocation());
}
@ -1029,11 +1029,11 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.content_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_content()) {
if ((from._impl_._has_bits_[0] & 0x00000004u) != 0) {
_this->_impl_.content_.Set(from._internal_content(),
_this->GetArenaForAllocation());
}
if (from._internal_has_generated_code_info()) {
if ((from._impl_._has_bits_[0] & 0x00000008u) != 0) {
_this->_impl_.generated_code_info_ = new ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo(*from._impl_.generated_code_info_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File)
@ -1397,7 +1397,7 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.error_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_error()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.error_.Set(from._internal_error(),
_this->GetArenaForAllocation());
}

@ -254,9 +254,6 @@ class PROTOC_EXPORT Version final :
};
// optional string suffix = 4;
bool has_suffix() const;
private:
bool _internal_has_suffix() const;
public:
void clear_suffix();
const std::string& suffix() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
@ -272,9 +269,6 @@ class PROTOC_EXPORT Version final :
// optional int32 major = 1;
bool has_major() const;
private:
bool _internal_has_major() const;
public:
void clear_major();
::int32_t major() const;
void set_major(::int32_t value);
@ -285,9 +279,6 @@ class PROTOC_EXPORT Version final :
// optional int32 minor = 2;
bool has_minor() const;
private:
bool _internal_has_minor() const;
public:
void clear_minor();
::int32_t minor() const;
void set_minor(::int32_t value);
@ -298,9 +289,6 @@ class PROTOC_EXPORT Version final :
// optional int32 patch = 3;
bool has_patch() const;
private:
bool _internal_has_patch() const;
public:
void clear_patch();
::int32_t patch() const;
void set_patch(::int32_t value);
@ -505,9 +493,6 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
// optional string parameter = 2;
bool has_parameter() const;
private:
bool _internal_has_parameter() const;
public:
void clear_parameter();
const std::string& parameter() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
@ -523,9 +508,6 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
// optional .google.protobuf.compiler.Version compiler_version = 3;
bool has_compiler_version() const;
private:
bool _internal_has_compiler_version() const;
public:
void clear_compiler_version();
const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const;
PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version();
@ -693,9 +675,6 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
};
// optional string name = 1;
bool has_name() const;
private:
bool _internal_has_name() const;
public:
void clear_name();
const std::string& name() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
@ -711,9 +690,6 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
// optional string insertion_point = 2;
bool has_insertion_point() const;
private:
bool _internal_has_insertion_point() const;
public:
void clear_insertion_point();
const std::string& insertion_point() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
@ -729,9 +705,6 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
// optional string content = 15;
bool has_content() const;
private:
bool _internal_has_content() const;
public:
void clear_content();
const std::string& content() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
@ -747,9 +720,6 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
// optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16;
bool has_generated_code_info() const;
private:
bool _internal_has_generated_code_info() const;
public:
void clear_generated_code_info();
const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const;
PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info();
@ -956,9 +926,6 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
// optional string error = 1;
bool has_error() const;
private:
bool _internal_has_error() const;
public:
void clear_error();
const std::string& error() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
@ -974,9 +941,6 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
// optional uint64 supported_features = 2;
bool has_supported_features() const;
private:
bool _internal_has_supported_features() const;
public:
void clear_supported_features();
::uint64_t supported_features() const;
void set_supported_features(::uint64_t value);
@ -1019,13 +983,10 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
// Version
// optional int32 major = 1;
inline bool Version::_internal_has_major() const {
inline bool Version::has_major() const {
bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0;
return value;
}
inline bool Version::has_major() const {
return _internal_has_major();
}
inline void Version::clear_major() {
_impl_.major_ = 0;
_impl_._has_bits_[0] &= ~0x00000002u;
@ -1047,13 +1008,10 @@ inline void Version::set_major(::int32_t value) {
}
// optional int32 minor = 2;
inline bool Version::_internal_has_minor() const {
inline bool Version::has_minor() const {
bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0;
return value;
}
inline bool Version::has_minor() const {
return _internal_has_minor();
}
inline void Version::clear_minor() {
_impl_.minor_ = 0;
_impl_._has_bits_[0] &= ~0x00000004u;
@ -1075,13 +1033,10 @@ inline void Version::set_minor(::int32_t value) {
}
// optional int32 patch = 3;
inline bool Version::_internal_has_patch() const {
inline bool Version::has_patch() const {
bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0;
return value;
}
inline bool Version::has_patch() const {
return _internal_has_patch();
}
inline void Version::clear_patch() {
_impl_.patch_ = 0;
_impl_._has_bits_[0] &= ~0x00000008u;
@ -1103,13 +1058,10 @@ inline void Version::set_patch(::int32_t value) {
}
// optional string suffix = 4;
inline bool Version::_internal_has_suffix() const {
inline bool Version::has_suffix() const {
bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
return value;
}
inline bool Version::has_suffix() const {
return _internal_has_suffix();
}
inline void Version::clear_suffix() {
_impl_.suffix_.ClearToEmpty();
_impl_._has_bits_[0] &= ~0x00000001u;
@ -1143,7 +1095,7 @@ inline std::string* Version::_internal_mutable_suffix() {
}
inline std::string* Version::release_suffix() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix)
if (!_internal_has_suffix()) {
if ((_impl_._has_bits_[0] & 0x00000001u) == 0) {
return nullptr;
}
_impl_._has_bits_[0] &= ~0x00000001u;
@ -1246,13 +1198,10 @@ CodeGeneratorRequest::mutable_file_to_generate() {
}
// optional string parameter = 2;
inline bool CodeGeneratorRequest::_internal_has_parameter() const {
inline bool CodeGeneratorRequest::has_parameter() const {
bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
return value;
}
inline bool CodeGeneratorRequest::has_parameter() const {
return _internal_has_parameter();
}
inline void CodeGeneratorRequest::clear_parameter() {
_impl_.parameter_.ClearToEmpty();
_impl_._has_bits_[0] &= ~0x00000001u;
@ -1286,7 +1235,7 @@ inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() {
}
inline std::string* CodeGeneratorRequest::release_parameter() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter)
if (!_internal_has_parameter()) {
if ((_impl_._has_bits_[0] & 0x00000001u) == 0) {
return nullptr;
}
_impl_._has_bits_[0] &= ~0x00000001u;
@ -1349,14 +1298,11 @@ CodeGeneratorRequest::proto_file() const {
}
// optional .google.protobuf.compiler.Version compiler_version = 3;
inline bool CodeGeneratorRequest::_internal_has_compiler_version() const {
inline bool CodeGeneratorRequest::has_compiler_version() const {
bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0;
PROTOBUF_ASSUME(!value || _impl_.compiler_version_ != nullptr);
return value;
}
inline bool CodeGeneratorRequest::has_compiler_version() const {
return _internal_has_compiler_version();
}
inline void CodeGeneratorRequest::clear_compiler_version() {
if (_impl_.compiler_version_ != nullptr) _impl_.compiler_version_->Clear();
_impl_._has_bits_[0] &= ~0x00000002u;
@ -1443,13 +1389,10 @@ inline void CodeGeneratorRequest::set_allocated_compiler_version(::PROTOBUF_NAME
// CodeGeneratorResponse_File
// optional string name = 1;
inline bool CodeGeneratorResponse_File::_internal_has_name() const {
inline bool CodeGeneratorResponse_File::has_name() const {
bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
return value;
}
inline bool CodeGeneratorResponse_File::has_name() const {
return _internal_has_name();
}
inline void CodeGeneratorResponse_File::clear_name() {
_impl_.name_.ClearToEmpty();
_impl_._has_bits_[0] &= ~0x00000001u;
@ -1483,7 +1426,7 @@ inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() {
}
inline std::string* CodeGeneratorResponse_File::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name)
if (!_internal_has_name()) {
if ((_impl_._has_bits_[0] & 0x00000001u) == 0) {
return nullptr;
}
_impl_._has_bits_[0] &= ~0x00000001u;
@ -1509,13 +1452,10 @@ inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) {
}
// optional string insertion_point = 2;
inline bool CodeGeneratorResponse_File::_internal_has_insertion_point() const {
inline bool CodeGeneratorResponse_File::has_insertion_point() const {
bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0;
return value;
}
inline bool CodeGeneratorResponse_File::has_insertion_point() const {
return _internal_has_insertion_point();
}
inline void CodeGeneratorResponse_File::clear_insertion_point() {
_impl_.insertion_point_.ClearToEmpty();
_impl_._has_bits_[0] &= ~0x00000002u;
@ -1549,7 +1489,7 @@ inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_poin
}
inline std::string* CodeGeneratorResponse_File::release_insertion_point() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
if (!_internal_has_insertion_point()) {
if ((_impl_._has_bits_[0] & 0x00000002u) == 0) {
return nullptr;
}
_impl_._has_bits_[0] &= ~0x00000002u;
@ -1575,13 +1515,10 @@ inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::strin
}
// optional string content = 15;
inline bool CodeGeneratorResponse_File::_internal_has_content() const {
inline bool CodeGeneratorResponse_File::has_content() const {
bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0;
return value;
}
inline bool CodeGeneratorResponse_File::has_content() const {
return _internal_has_content();
}
inline void CodeGeneratorResponse_File::clear_content() {
_impl_.content_.ClearToEmpty();
_impl_._has_bits_[0] &= ~0x00000004u;
@ -1615,7 +1552,7 @@ inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() {
}
inline std::string* CodeGeneratorResponse_File::release_content() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content)
if (!_internal_has_content()) {
if ((_impl_._has_bits_[0] & 0x00000004u) == 0) {
return nullptr;
}
_impl_._has_bits_[0] &= ~0x00000004u;
@ -1641,14 +1578,11 @@ inline void CodeGeneratorResponse_File::set_allocated_content(std::string* conte
}
// optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16;
inline bool CodeGeneratorResponse_File::_internal_has_generated_code_info() const {
inline bool CodeGeneratorResponse_File::has_generated_code_info() const {
bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0;
PROTOBUF_ASSUME(!value || _impl_.generated_code_info_ != nullptr);
return value;
}
inline bool CodeGeneratorResponse_File::has_generated_code_info() const {
return _internal_has_generated_code_info();
}
inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const {
const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* p = _impl_.generated_code_info_;
return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo&>(
@ -1732,13 +1666,10 @@ inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(::PROT
// CodeGeneratorResponse
// optional string error = 1;
inline bool CodeGeneratorResponse::_internal_has_error() const {
inline bool CodeGeneratorResponse::has_error() const {
bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
return value;
}
inline bool CodeGeneratorResponse::has_error() const {
return _internal_has_error();
}
inline void CodeGeneratorResponse::clear_error() {
_impl_.error_.ClearToEmpty();
_impl_._has_bits_[0] &= ~0x00000001u;
@ -1772,7 +1703,7 @@ inline std::string* CodeGeneratorResponse::_internal_mutable_error() {
}
inline std::string* CodeGeneratorResponse::release_error() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error)
if (!_internal_has_error()) {
if ((_impl_._has_bits_[0] & 0x00000001u) == 0) {
return nullptr;
}
_impl_._has_bits_[0] &= ~0x00000001u;
@ -1798,13 +1729,10 @@ inline void CodeGeneratorResponse::set_allocated_error(std::string* error) {
}
// optional uint64 supported_features = 2;
inline bool CodeGeneratorResponse::_internal_has_supported_features() const {
inline bool CodeGeneratorResponse::has_supported_features() const {
bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0;
return value;
}
inline bool CodeGeneratorResponse::has_supported_features() const {
return _internal_has_supported_features();
}
inline void CodeGeneratorResponse::clear_supported_features() {
_impl_.supported_features_ = ::uint64_t{0u};
_impl_._has_bits_[0] &= ~0x00000002u;

@ -1735,7 +1735,7 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
@ -1743,7 +1743,7 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_package()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.package_.Set(from._internal_package(),
_this->GetArenaForAllocation());
}
@ -1751,7 +1751,7 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.syntax_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_syntax()) {
if ((from._impl_._has_bits_[0] & 0x00000004u) != 0) {
_this->_impl_.syntax_.Set(from._internal_syntax(),
_this->GetArenaForAllocation());
}
@ -1759,14 +1759,14 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.edition_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_edition()) {
if ((from._impl_._has_bits_[0] & 0x00000008u) != 0) {
_this->_impl_.edition_.Set(from._internal_edition(),
_this->GetArenaForAllocation());
}
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000010u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::FileOptions(*from._impl_.options_);
}
if (from._internal_has_source_code_info()) {
if ((from._impl_._has_bits_[0] & 0x00000020u) != 0) {
_this->_impl_.source_code_info_ = new ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo(*from._impl_.source_code_info_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorProto)
@ -2391,7 +2391,7 @@ bool FileDescriptorProto::IsInitialized() const {
return false;
if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_impl_.extension_))
return false;
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000010u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -2480,7 +2480,7 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP
, decltype(_impl_.end_){}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions(*from._impl_.options_);
}
::memcpy(&_impl_.start_, &from._impl_.start_,
@ -2709,7 +2709,7 @@ void DescriptorProto_ExtensionRange::CopyFrom(const DescriptorProto_ExtensionRan
}
bool DescriptorProto_ExtensionRange::IsInitialized() const {
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000001u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -3017,11 +3017,11 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::MessageOptions(*from._impl_.options_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto)
@ -3518,7 +3518,7 @@ bool DescriptorProto::IsInitialized() const {
return false;
if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_impl_.oneof_decl_))
return false;
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000002u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -3841,7 +3841,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
@ -3849,7 +3849,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.extendee_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_extendee()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.extendee_.Set(from._internal_extendee(),
_this->GetArenaForAllocation());
}
@ -3857,7 +3857,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.type_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_type_name()) {
if ((from._impl_._has_bits_[0] & 0x00000004u) != 0) {
_this->_impl_.type_name_.Set(from._internal_type_name(),
_this->GetArenaForAllocation());
}
@ -3865,7 +3865,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.default_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_default_value()) {
if ((from._impl_._has_bits_[0] & 0x00000008u) != 0) {
_this->_impl_.default_value_.Set(from._internal_default_value(),
_this->GetArenaForAllocation());
}
@ -3873,11 +3873,11 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.json_name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_json_name()) {
if ((from._impl_._has_bits_[0] & 0x00000010u) != 0) {
_this->_impl_.json_name_.Set(from._internal_json_name(),
_this->GetArenaForAllocation());
}
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000020u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::FieldOptions(*from._impl_.options_);
}
::memcpy(&_impl_.number_, &from._impl_.number_,
@ -4415,7 +4415,7 @@ void FieldDescriptorProto::CopyFrom(const FieldDescriptorProto& from) {
}
bool FieldDescriptorProto::IsInitialized() const {
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000020u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -4501,11 +4501,11 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::OneofOptions(*from._impl_.options_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.OneofDescriptorProto)
@ -4719,7 +4719,7 @@ void OneofDescriptorProto::CopyFrom(const OneofDescriptorProto& from) {
}
bool OneofDescriptorProto::IsInitialized() const {
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000002u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -5023,11 +5023,11 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::EnumOptions(*from._impl_.options_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto)
@ -5349,7 +5349,7 @@ void EnumDescriptorProto::CopyFrom(const EnumDescriptorProto& from) {
bool EnumDescriptorProto::IsInitialized() const {
if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_impl_.value_))
return false;
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000002u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -5421,11 +5421,11 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::EnumValueOptions(*from._impl_.options_);
}
_this->_impl_.number_ = from._impl_.number_;
@ -5667,7 +5667,7 @@ void EnumValueDescriptorProto::CopyFrom(const EnumValueDescriptorProto& from) {
}
bool EnumValueDescriptorProto::IsInitialized() const {
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000002u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -5738,11 +5738,11 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::ServiceOptions(*from._impl_.options_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceDescriptorProto)
@ -5991,7 +5991,7 @@ void ServiceDescriptorProto::CopyFrom(const ServiceDescriptorProto& from) {
bool ServiceDescriptorProto::IsInitialized() const {
if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_impl_.method_))
return false;
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000002u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -6073,7 +6073,7 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
@ -6081,7 +6081,7 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.input_type_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_input_type()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.input_type_.Set(from._internal_input_type(),
_this->GetArenaForAllocation());
}
@ -6089,11 +6089,11 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.output_type_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_output_type()) {
if ((from._impl_._has_bits_[0] & 0x00000004u) != 0) {
_this->_impl_.output_type_.Set(from._internal_output_type(),
_this->GetArenaForAllocation());
}
if (from._internal_has_options()) {
if ((from._impl_._has_bits_[0] & 0x00000008u) != 0) {
_this->_impl_.options_ = new ::PROTOBUF_NAMESPACE_ID::MethodOptions(*from._impl_.options_);
}
::memcpy(&_impl_.client_streaming_, &from._impl_.client_streaming_,
@ -6448,7 +6448,7 @@ void MethodDescriptorProto::CopyFrom(const MethodDescriptorProto& from) {
}
bool MethodDescriptorProto::IsInitialized() const {
if (_internal_has_options()) {
if ((_impl_._has_bits_[0] & 0x00000008u) != 0) {
if (!_impl_.options_->IsInitialized()) return false;
}
return true;
@ -6596,7 +6596,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.java_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_java_package()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.java_package_.Set(from._internal_java_package(),
_this->GetArenaForAllocation());
}
@ -6604,7 +6604,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.java_outer_classname_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_java_outer_classname()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.java_outer_classname_.Set(from._internal_java_outer_classname(),
_this->GetArenaForAllocation());
}
@ -6612,7 +6612,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.go_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_go_package()) {
if ((from._impl_._has_bits_[0] & 0x00000004u) != 0) {
_this->_impl_.go_package_.Set(from._internal_go_package(),
_this->GetArenaForAllocation());
}
@ -6620,7 +6620,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.objc_class_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_objc_class_prefix()) {
if ((from._impl_._has_bits_[0] & 0x00000008u) != 0) {
_this->_impl_.objc_class_prefix_.Set(from._internal_objc_class_prefix(),
_this->GetArenaForAllocation());
}
@ -6628,7 +6628,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.csharp_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_csharp_namespace()) {
if ((from._impl_._has_bits_[0] & 0x00000010u) != 0) {
_this->_impl_.csharp_namespace_.Set(from._internal_csharp_namespace(),
_this->GetArenaForAllocation());
}
@ -6636,7 +6636,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.swift_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_swift_prefix()) {
if ((from._impl_._has_bits_[0] & 0x00000020u) != 0) {
_this->_impl_.swift_prefix_.Set(from._internal_swift_prefix(),
_this->GetArenaForAllocation());
}
@ -6644,7 +6644,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.php_class_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_class_prefix()) {
if ((from._impl_._has_bits_[0] & 0x00000040u) != 0) {
_this->_impl_.php_class_prefix_.Set(from._internal_php_class_prefix(),
_this->GetArenaForAllocation());
}
@ -6652,7 +6652,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.php_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_namespace()) {
if ((from._impl_._has_bits_[0] & 0x00000080u) != 0) {
_this->_impl_.php_namespace_.Set(from._internal_php_namespace(),
_this->GetArenaForAllocation());
}
@ -6660,7 +6660,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.php_metadata_namespace_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_metadata_namespace()) {
if ((from._impl_._has_bits_[0] & 0x00000100u) != 0) {
_this->_impl_.php_metadata_namespace_.Set(from._internal_php_metadata_namespace(),
_this->GetArenaForAllocation());
}
@ -6668,7 +6668,7 @@ FileOptions::FileOptions(const FileOptions& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.ruby_package_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_ruby_package()) {
if ((from._impl_._has_bits_[0] & 0x00000200u) != 0) {
_this->_impl_.ruby_package_.Set(from._internal_ruby_package(),
_this->GetArenaForAllocation());
}
@ -9183,7 +9183,7 @@ void EnumValueOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const
(void) cached_has_bits;
_this->_impl_.uninterpreted_option_.MergeFrom(from._impl_.uninterpreted_option_);
if (from._internal_has_deprecated()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_internal_set_deprecated(from._internal_deprecated());
}
_this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_);
@ -9440,7 +9440,7 @@ void ServiceOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const :
(void) cached_has_bits;
_this->_impl_.uninterpreted_option_.MergeFrom(from._impl_.uninterpreted_option_);
if (from._internal_has_deprecated()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_internal_set_deprecated(from._internal_deprecated());
}
_this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_);
@ -9827,7 +9827,7 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOp
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_part_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name_part()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.name_part_.Set(from._internal_name_part(),
_this->GetArenaForAllocation());
}
@ -9975,14 +9975,14 @@ failure:
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:google.protobuf.UninterpretedOption.NamePart)
::size_t total_size = 0;
if (_internal_has_name_part()) {
if ((_impl_._has_bits_[0] & 0x00000001u) != 0) {
// required string name_part = 1;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name_part());
}
if (_internal_has_is_extension()) {
if ((_impl_._has_bits_[0] & 0x00000002u) != 0) {
// required bool is_extension = 2;
total_size += 1 + 1;
}
@ -10125,7 +10125,7 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.identifier_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_identifier_value()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.identifier_value_.Set(from._internal_identifier_value(),
_this->GetArenaForAllocation());
}
@ -10133,7 +10133,7 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.string_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_string_value()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.string_value_.Set(from._internal_string_value(),
_this->GetArenaForAllocation());
}
@ -10141,7 +10141,7 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.aggregate_value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_aggregate_value()) {
if ((from._impl_._has_bits_[0] & 0x00000004u) != 0) {
_this->_impl_.aggregate_value_.Set(from._internal_aggregate_value(),
_this->GetArenaForAllocation());
}
@ -10595,7 +10595,7 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location&
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.leading_comments_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_leading_comments()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.leading_comments_.Set(from._internal_leading_comments(),
_this->GetArenaForAllocation());
}
@ -10603,7 +10603,7 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location&
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.trailing_comments_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_trailing_comments()) {
if ((from._impl_._has_bits_[0] & 0x00000002u) != 0) {
_this->_impl_.trailing_comments_.Set(from._internal_trailing_comments(),
_this->GetArenaForAllocation());
}
@ -11208,7 +11208,7 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.source_file_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_source_file()) {
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_impl_.source_file_.Set(from._internal_source_file(),
_this->GetArenaForAllocation());
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save