Clean up a fraction of message.cc to use Emit().

PiperOrigin-RevId: 495646298
pull/11276/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 31c3aeeb52
commit 1b64b75716
  1. 2
      .github/workflows/codespell.yml
  2. 4
      .github/workflows/generate_files.yml
  3. 3
      .github/workflows/objc_cocoapods.yml
  4. 3
      .github/workflows/php-ext.yml
  5. 3
      .github/workflows/update_php_repo.yml
  6. 2
      src/file_lists.cmake
  7. 3
      src/google/protobuf/compiler/cpp/generator.cc
  8. 494
      src/google/protobuf/compiler/cpp/message.cc
  9. 48
      src/google/protobuf/compiler/plugin.pb.h
  10. 1908
      src/google/protobuf/descriptor.pb.h

@ -3,8 +3,6 @@
# https://github.com/codespell-project/codespell
name: codespell
on: [push, pull_request]
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
codespell:
name: Check for spelling errors

@ -9,12 +9,8 @@ on:
# to exclude it.
- '!21.x'
permissions: {}
jobs:
cmake:
permissions:
contents: write # for git push
if: github.repository == 'protocolbuffers/protobuf'
runs-on: ubuntu-latest

@ -18,9 +18,6 @@ on:
- '!objectivec/ProtocolBuffers_*.xcodeproj/**'
- '!objectivec/Tests/**'
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
pod-lib-lint:
runs-on: macos-latest

@ -4,9 +4,6 @@ on:
- push
- pull_request
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build-php:
name: Build PHP extension

@ -6,9 +6,6 @@ on:
- v[0-9]+.[0-9]+
- v[0-9]+.[0-9]+-rc[0-9]+
permissions:
contents: read # to fetch code in 'Clone protobuf' (actions/checkout)
jobs:
update-repo:
name: Update PHP Repo

@ -168,8 +168,8 @@ set(libprotobuf_hdrs
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h
${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h
${protobuf_SOURCE_DIR}/src/google/protobuf/service.h
${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h

@ -61,6 +61,9 @@ absl::flat_hash_map<absl::string_view, std::string> CommonVars(
bool is_oss = options.opensource_runtime;
return {
{"proto_ns", ProtobufNamespace(options)},
{"pb", absl::StrCat("::", ProtobufNamespace(options))},
{"pbi", absl::StrCat("::", ProtobufNamespace(options), "::internal")},
{"string", "std::string"},
{"int8", "::int8_t"},
{"int32", "::int32_t"},

@ -79,13 +79,12 @@ namespace google {
namespace protobuf {
namespace compiler {
namespace cpp {
using internal::WireFormat;
using internal::WireFormatLite;
using internal::cpp::HasHasbit;
using internal::cpp::Utf8CheckMode;
namespace {
using ::google::protobuf::internal::WireFormat;
using ::google::protobuf::internal::WireFormatLite;
using ::google::protobuf::internal::cpp::HasHasbit;
using ::google::protobuf::internal::cpp::Utf8CheckMode;
using Sub = ::google::protobuf::io::Printer::Sub;
static constexpr int kNoHasbit = -1;
@ -509,6 +508,13 @@ void AnnotationVar(const Descriptor* desc, const Options& options,
absl::flat_hash_map<absl::string_view, std::string> ClassVars(
const Descriptor* desc, Options opts) {
absl::flat_hash_map<absl::string_view, std::string> vars = MessageVars(desc);
vars.emplace("Msg", ClassName(desc, false));
vars.emplace("pkg::Msg", QualifiedClassName(desc, opts));
vars.emplace("pkg.Msg", desc->full_name());
// Old-style names, to be removed once all usages are gone in this and other
// files.
vars.emplace("classname", ClassName(desc, false));
vars.emplace("classtype", QualifiedClassName(desc, opts));
vars.emplace("full_name", desc->full_name());
@ -749,7 +755,9 @@ void MessageGenerator::AddGenerators(
}
void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* p) {
auto v = p->WithVars(MessageVars(descriptor_));
Formatter format(p);
// optimized_fields_ does not contain fields where
// field->real_containing_oneof()
// so we need to iterate over those as well.
@ -759,9 +767,9 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* p) {
// able to infer these indices from the k[FIELDNAME]FieldNumber order.
std::vector<const FieldDescriptor*> ordered_fields;
ordered_fields.reserve(descriptor_->field_count());
ordered_fields.insert(ordered_fields.begin(), optimized_order_.begin(),
optimized_order_.end());
for (auto field : FieldRange(descriptor_)) {
if (!field->real_containing_oneof() && !field->options().weak() &&
!IsFieldStripped(field, options_)) {
@ -771,51 +779,101 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* p) {
}
if (!ordered_fields.empty()) {
format("enum : int {\n");
for (auto field : ordered_fields) {
Formatter::SaveState save(&format);
absl::flat_hash_map<absl::string_view, std::string> vars;
SetCommonFieldVariables(field, &vars, options_);
auto v = p->WithVars(std::move(vars));
format(" ${1$$2$$}$ = $number$,\n", field, FieldConstantName(field));
}
format("};\n");
p->Emit({{
"kFields",
[&] {
for (auto field : ordered_fields) {
auto v = p->WithVars(FieldVars(field, options_));
p->Emit({Sub("kField", FieldConstantName(field))
.AnnotatedAs(field)},
R"cc(
$kField$ = $number$,
)cc");
}
},
}},
R"cc(
enum : int {
$kFields$,
};
)cc");
}
for (auto field : ordered_fields) {
PrintFieldComment(format, field);
bool stripped = IsFieldStripped(field, options_);
auto name = FieldName(field);
auto v = p->WithVars(FieldVars(field, options_));
if (field->is_repeated()) {
format("$deprecated_attr$int ${1$$name$_size$}$() const$2$\n", field,
!IsFieldStripped(field, options_) ? ";" : " {__builtin_trap();}");
if (!IsFieldStripped(field, options_)) {
format(
"private:\n"
"int ${1$_internal_$name$_size$}$() const;\n"
"public:\n",
field);
}
} else {
if (HasHasMethod(field)) {
format(
"$deprecated_attr$bool ${1$has_$name$$}$() const$2$\n", field,
!IsFieldStripped(field, options_) ? ";" : " {__builtin_trap();}");
}
if (HasInternalHasMethod(field) && !IsFieldStripped(field, options_)) {
format(
"private:\n"
"bool ${1$_internal_has_$name$$}$() const;\n"
"public:\n",
field);
}
}
format("$deprecated_attr$void ${1$clear_$name$$}$()$2$\n", field,
!IsFieldStripped(field, options_) ? ";" : "{__builtin_trap();}");
// Generate type-specific accessor declarations.
field_generators_.get(field).GenerateAccessorDeclarations(p);
format("\n");
p->Emit(
{{"field_comment", FieldComment(field)},
Sub("const_impl", !stripped ? "const;" : "const { __builtin_trap(); }")
.WithSuffix(";"),
Sub("impl", !stripped ? ";" : " { __builtin_trap(); }")
.WithSuffix(";"),
{"sizer",
[&] {
if (!field->is_repeated()) return;
p->Emit({Sub("name_size", absl::StrCat(name, "_size"))
.AnnotatedAs(field)},
R"cc(
$deprecated_attr $int $name_size$() $const_impl$;
)cc");
if (stripped) return;
p->Emit({Sub("_internal_name_size",
absl::StrCat("_internal_", name, "_size"))
.AnnotatedAs(field)},
R"cc(
private:
int $_internal_name_size$() const;
public:
)cc");
}},
{"hazzer",
[&] {
if (!field->has_presence()) return;
p->Emit({Sub("has_name", absl::StrCat("has_", name))
.AnnotatedAs(field)},
R"cc(
$deprecated_attr $bool $has_name$() $const_impl$;
)cc");
}},
{"internal_hazzer",
[&] {
if (field->is_repeated() || !HasInternalHasMethod(field) ||
stripped) {
return;
}
p->Emit(
{Sub("_internal_has_name", absl::StrCat("_internal_has_", name))
.AnnotatedAs(field)},
R"cc(
private:
bool $_internal_has_name$() const;
public:
)cc");
}},
{"clearer",
[&] {
p->Emit({Sub("clear_name", absl::StrCat("clear_", name))
.AnnotatedAs(field)},
R"cc(
$deprecated_attr $void $clear_name$() $impl$;
)cc");
}},
{"accessors",
[&] {
field_generators_.get(field).GenerateAccessorDeclarations(p);
}}},
R"cc(
// $field_comment$
$sizer$;
$hazzer$;
$internal_hazzer$;
$clearer$;
$accessors$;
)cc");
}
if (descriptor_->extension_range_count() > 0) {
@ -828,204 +886,186 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* p) {
// For similar reason, we use "_field_type" and "_is_packed" as parameter
// names below, so that "field_type" and "is_packed" can be used as field
// names.
format(R"(
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline bool HasExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const {
$annotate_extension_has$
return $extensions$.Has(id.number());
}
p->Emit(R"cc(
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline bool HasExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) const {
$annotate_extension_has$;
return $extensions$.Has(id.number());
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline void ClearExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) {
$extensions$.ClearExtension(id.number());
$annotate_extension_clear$
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline void ClearExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) {
$extensions$.ClearExtension(id.number());
$annotate_extension_clear$;
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline int ExtensionSize(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const {
$annotate_extension_repeated_size$
return $extensions$.ExtensionSize(id.number());
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline int ExtensionSize(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) const {
$annotate_extension_repeated_size$;
return $extensions$.ExtensionSize(id.number());
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Singular::ConstType GetExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const {
$annotate_extension_get$
return _proto_TypeTraits::Get(id.number(), $extensions$,
id.default_value());
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Singular::ConstType GetExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) const {
$annotate_extension_get$;
return _proto_TypeTraits::Get(id.number(), $extensions$, id.default_value());
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Singular::MutableType MutableExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) {
$annotate_extension_mutable$
return _proto_TypeTraits::Mutable(id.number(), _field_type,
&$extensions$);
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Singular::MutableType MutableExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) {
$annotate_extension_mutable$;
return _proto_TypeTraits::Mutable(id.number(), _field_type, &$extensions$);
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline void SetExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id,
typename _proto_TypeTraits::Singular::ConstType value) {
_proto_TypeTraits::Set(id.number(), _field_type, value, &$extensions$);
$annotate_extension_set$
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline void SetExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id,
typename _proto_TypeTraits::Singular::ConstType value) {
_proto_TypeTraits::Set(id.number(), _field_type, value, &$extensions$);
$annotate_extension_set$;
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline void SetAllocatedExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id,
typename _proto_TypeTraits::Singular::MutableType value) {
_proto_TypeTraits::SetAllocated(id.number(), _field_type, value,
&$extensions$);
$annotate_extension_set$
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline void UnsafeArenaSetAllocatedExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id,
typename _proto_TypeTraits::Singular::MutableType value) {
_proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type,
value, &$extensions$);
$annotate_extension_set$
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
PROTOBUF_NODISCARD inline
typename _proto_TypeTraits::Singular::MutableType
ReleaseExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) {
$annotate_extension_release$
return _proto_TypeTraits::Release(id.number(), _field_type,
&$extensions$);
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Singular::MutableType
UnsafeArenaReleaseExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) {
$annotate_extension_release$
return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type,
&$extensions$);
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline void SetAllocatedExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id,
typename _proto_TypeTraits::Singular::MutableType value) {
_proto_TypeTraits::SetAllocated(id.number(), _field_type, value,
&$extensions$);
$annotate_extension_set$;
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline void UnsafeArenaSetAllocatedExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id,
typename _proto_TypeTraits::Singular::MutableType value) {
_proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type,
value, &$extensions$);
$annotate_extension_set$;
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
PROTOBUF_NODISCARD inline
typename _proto_TypeTraits::Singular::MutableType
ReleaseExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) {
$annotate_extension_release$;
return _proto_TypeTraits::Release(id.number(), _field_type, &$extensions$);
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Singular::MutableType
UnsafeArenaReleaseExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) {
$annotate_extension_release$;
return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type,
&$extensions$);
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Repeated::ConstType GetExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id,
int index) const {
$annotate_repeated_extension_get$
return _proto_TypeTraits::Get(id.number(), $extensions$, index);
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Repeated::ConstType GetExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id,
int index) const {
$annotate_repeated_extension_get$;
return _proto_TypeTraits::Get(id.number(), $extensions$, index);
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id,
int index) {
$annotate_repeated_extension_mutable$
return _proto_TypeTraits::Mutable(id.number(), index, &$extensions$);
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id,
int index) {
$annotate_repeated_extension_mutable$;
return _proto_TypeTraits::Mutable(id.number(), index, &$extensions$);
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline void SetExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id,
int index, typename _proto_TypeTraits::Repeated::ConstType value) {
_proto_TypeTraits::Set(id.number(), index, value, &$extensions$);
$annotate_repeated_extension_set$
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline void SetExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id,
int index, typename _proto_TypeTraits::Repeated::ConstType value) {
_proto_TypeTraits::Set(id.number(), index, value, &$extensions$);
$annotate_repeated_extension_set$;
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Repeated::MutableType AddExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) {
typename _proto_TypeTraits::Repeated::MutableType to_add =
_proto_TypeTraits::Add(id.number(), _field_type, &$extensions$);
$annotate_repeated_extension_add_mutable$
return to_add;
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Repeated::MutableType AddExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) {
typename _proto_TypeTraits::Repeated::MutableType to_add =
_proto_TypeTraits::Add(id.number(), _field_type, &$extensions$);
$annotate_repeated_extension_add_mutable$;
return to_add;
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline void AddExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id,
typename _proto_TypeTraits::Repeated::ConstType value) {
_proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value,
&$extensions$);
$annotate_repeated_extension_add$
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline void AddExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id,
typename _proto_TypeTraits::Repeated::ConstType value) {
_proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value,
&$extensions$);
$annotate_repeated_extension_add$;
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType&
GetRepeatedExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const {
$annotate_repeated_extension_list$
return _proto_TypeTraits::GetRepeated(id.number(), $extensions$);
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType&
GetRepeatedExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) const {
$annotate_repeated_extension_list$;
return _proto_TypeTraits::GetRepeated(id.number(), $extensions$);
}
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Repeated::RepeatedFieldType*
MutableRepeatedExtension(
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
$classname$, _proto_TypeTraits, _field_type, _is_packed>& id) {
$annotate_repeated_extension_list_mutable$
return _proto_TypeTraits::MutableRepeated(id.number(), _field_type,
_is_packed, &$extensions$);
}
template <typename _proto_TypeTraits, $pbi$::FieldType _field_type,
bool _is_packed>
inline typename _proto_TypeTraits::Repeated::RepeatedFieldType*
MutableRepeatedExtension(
const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits,
_field_type, _is_packed>& id) {
$annotate_repeated_extension_list_mutable$;
return _proto_TypeTraits::MutableRepeated(id.number(), _field_type,
_is_packed, &$extensions$);
}
)cc");
)");
// Generate MessageSet specific APIs for proto2 MessageSet.
// For testing purposes we don't check for bridge.MessageSet, so
// we don't use IsProto2MessageSet
if (descriptor_->options().message_set_wire_format() &&
!options_.opensource_runtime && !options_.lite_implicit_weak_fields) {
// Special-case MessageSet
format("GOOGLE_PROTOBUF_EXTENSION_MESSAGE_SET_ACCESSORS($classname$)\n");
// Special-case MessageSet.
p->Emit(R"cc(
GOOGLE_PROTOBUF_EXTENSION_MESSAGE_SET_ACCESSORS($Msg$);
)cc");
}
}

@ -253,7 +253,7 @@ class PROTOC_EXPORT Version final :
};
// optional string suffix = 4;
bool has_suffix() const;
void clear_suffix();
void clear_suffix() ;
const std::string& suffix() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_suffix(ArgT0&& arg0, ArgT... args);
@ -265,37 +265,33 @@ class PROTOC_EXPORT Version final :
inline PROTOBUF_ALWAYS_INLINE void _internal_set_suffix(const std::string& value);
std::string* _internal_mutable_suffix();
public:
// optional int32 major = 1;
bool has_major() const;
void clear_major();
void clear_major() ;
::int32_t major() const;
void set_major(::int32_t value);
private:
::int32_t _internal_major() const;
void _internal_set_major(::int32_t value);
public:
// optional int32 minor = 2;
bool has_minor() const;
void clear_minor();
void clear_minor() ;
::int32_t minor() const;
void set_minor(::int32_t value);
private:
::int32_t _internal_minor() const;
void _internal_set_minor(::int32_t value);
public:
// optional int32 patch = 3;
bool has_patch() const;
void clear_patch();
void clear_patch() ;
::int32_t patch() const;
void set_patch(::int32_t value);
private:
::int32_t _internal_patch() const;
void _internal_set_patch(::int32_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.Version)
private:
class _Internal;
@ -451,8 +447,9 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
int file_to_generate_size() const;
private:
int _internal_file_to_generate_size() const;
public:
void clear_file_to_generate();
void clear_file_to_generate() ;
const std::string& file_to_generate(int index) const;
std::string* mutable_file_to_generate(int index);
void set_file_to_generate(int index, const std::string& value);
@ -470,13 +467,13 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
const std::string& _internal_file_to_generate(int index) const;
std::string* _internal_add_file_to_generate();
public:
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
int proto_file_size() const;
private:
int _internal_proto_file_size() const;
public:
void clear_proto_file();
void clear_proto_file() ;
::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >*
mutable_proto_file();
@ -488,10 +485,9 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >&
proto_file() const;
// optional string parameter = 2;
bool has_parameter() const;
void clear_parameter();
void clear_parameter() ;
const std::string& parameter() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_parameter(ArgT0&& arg0, ArgT... args);
@ -503,10 +499,9 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
inline PROTOBUF_ALWAYS_INLINE void _internal_set_parameter(const std::string& value);
std::string* _internal_mutable_parameter();
public:
// optional .google.protobuf.compiler.Version compiler_version = 3;
bool has_compiler_version() const;
void clear_compiler_version();
void clear_compiler_version() ;
const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const;
PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version();
::PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version();
@ -518,7 +513,6 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
void unsafe_arena_set_allocated_compiler_version(
::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version);
::PROTOBUF_NAMESPACE_ID::compiler::Version* unsafe_arena_release_compiler_version();
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest)
private:
class _Internal;
@ -672,7 +666,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
};
// optional string name = 1;
bool has_name() const;
void clear_name();
void clear_name() ;
const std::string& name() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
@ -684,10 +678,9 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
// optional string insertion_point = 2;
bool has_insertion_point() const;
void clear_insertion_point();
void clear_insertion_point() ;
const std::string& insertion_point() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_insertion_point(ArgT0&& arg0, ArgT... args);
@ -699,10 +692,9 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
inline PROTOBUF_ALWAYS_INLINE void _internal_set_insertion_point(const std::string& value);
std::string* _internal_mutable_insertion_point();
public:
// optional string content = 15;
bool has_content() const;
void clear_content();
void clear_content() ;
const std::string& content() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_content(ArgT0&& arg0, ArgT... args);
@ -714,10 +706,9 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
inline PROTOBUF_ALWAYS_INLINE void _internal_set_content(const std::string& value);
std::string* _internal_mutable_content();
public:
// optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16;
bool has_generated_code_info() const;
void clear_generated_code_info();
void clear_generated_code_info() ;
const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const;
PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info();
::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info();
@ -729,7 +720,6 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
void unsafe_arena_set_allocated_generated_code_info(
::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info);
::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* unsafe_arena_release_generated_code_info();
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File)
private:
class _Internal;
@ -906,8 +896,9 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
int file_size() const;
private:
int _internal_file_size() const;
public:
void clear_file();
void clear_file() ;
::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >*
mutable_file();
@ -919,10 +910,9 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >&
file() const;
// optional string error = 1;
bool has_error() const;
void clear_error();
void clear_error() ;
const std::string& error() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_error(ArgT0&& arg0, ArgT... args);
@ -934,17 +924,15 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
inline PROTOBUF_ALWAYS_INLINE void _internal_set_error(const std::string& value);
std::string* _internal_mutable_error();
public:
// optional uint64 supported_features = 2;
bool has_supported_features() const;
void clear_supported_features();
void clear_supported_features() ;
::uint64_t supported_features() const;
void set_supported_features(::uint64_t value);
private:
::uint64_t _internal_supported_features() const;
void _internal_set_supported_features(::uint64_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse)
private:
class _Internal;

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