Add `ABSL_ATTRIBUTE_LIFETIME_BOUND` attribute on generated message field accessors.

This allows the compiler to statically detect use-after-free bugs.

This change touches a subset of field types. More changes to follow.

PiperOrigin-RevId: 558180721
pull/13601/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent a2f3fd0367
commit 064035c097
  1. 297
      src/google/protobuf/compiler/cpp/field_generators/message_field.cc
  2. 6
      src/google/protobuf/compiler/cpp/message.cc
  3. 86
      src/google/protobuf/compiler/plugin.pb.h
  4. 6
      src/google/protobuf/cpp_features.pb.h
  5. 778
      src/google/protobuf/descriptor.pb.h

@ -201,7 +201,7 @@ void SingularMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
const $Submsg$* p = $cast_field_$;
return p != nullptr ? *p : reinterpret_cast<const $Submsg$&>($kDefault$);
}
inline const $Submsg$& $Msg$::$name$() const {
inline const $Submsg$& $Msg$::$name$() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
$annotate_get$;
// @@protoc_insertion_point(field_get:$pkg.Msg.field$)
return _internal_$name$();
@ -263,7 +263,7 @@ void SingularMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
}
return $cast_field_$;
}
inline $Submsg$* $Msg$::mutable_$name$() {
inline $Submsg$* $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND {
//~ TODO(b/122856539): add tests to make sure all write accessors are
//~ able to prepare split message allocation.
$PrepareSplitMessageForWrite$;
@ -579,96 +579,112 @@ void OneofMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
p->WithVars({{"release_name", SafeFunctionName(field_->containing_type(),
field_, "release_")}});
p->Emit(R"cc(
inline $Submsg$* $Msg$::$release_name$() {
$annotate_release$;
// @@protoc_insertion_point(field_release:$pkg.Msg.field$)
$StrongRef$;
if ($has_field$) {
clear_has_$oneof_name$();
$Submsg$* temp = $cast_field_$;
if (GetArenaForAllocation() != nullptr) {
temp = $pbi$::DuplicateIfNonNull(temp);
}
$field_$ = nullptr;
return temp;
} else {
return nullptr;
}
}
)cc");
p->Emit(R"cc(
inline const $Submsg$& $Msg$::_internal_$name$() const {
$StrongRef$;
return $has_field$ ? *$cast_field_$ : reinterpret_cast<$Submsg$&>($kDefault$);
}
)cc");
p->Emit(R"cc(
inline const $Submsg$& $Msg$::$name$() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
$annotate_get$;
// @@protoc_insertion_point(field_get:$pkg.Msg.field$)
return _internal_$name$();
}
)cc");
p->Emit(R"cc(
inline $Submsg$* $Msg$::unsafe_arena_release_$name$() {
$annotate_release$;
// @@protoc_insertion_point(field_unsafe_arena_release:$pkg.Msg.field$)
$StrongRef$;
if ($has_field$) {
clear_has_$oneof_name$();
$Submsg$* temp = $cast_field_$;
$field_$ = nullptr;
return temp;
} else {
return nullptr;
}
}
)cc");
p->Emit(
"inline $Submsg$* $Msg$::$release_name$() {\n"
"$annotate_release$"
" // @@protoc_insertion_point(field_release:$pkg.Msg.field$)\n"
"$StrongRef$;"
" if ($has_field$) {\n"
" clear_has_$oneof_name$();\n"
" $Submsg$* temp = $cast_field_$;\n"
" if (GetArenaForAllocation() != nullptr) {\n"
" temp = $pbi$::DuplicateIfNonNull(temp);\n"
" }\n"
" $field_$ = nullptr;\n"
" return temp;\n"
" } else {\n"
" return nullptr;\n"
" }\n"
"}\n");
p->Emit(
"inline const $Submsg$& $Msg$::_internal_$name$() const {\n"
"$StrongRef$;"
" return $has_field$\n"
" ? *$cast_field_$\n"
" : reinterpret_cast<$Submsg$&>($kDefault$);\n"
"}\n"
"inline const $Submsg$& $Msg$::$name$() const {\n"
"$annotate_get$"
" // @@protoc_insertion_point(field_get:$pkg.Msg.field$)\n"
" return _internal_$name$();\n"
"}\n"
"inline $Submsg$* $Msg$::unsafe_arena_release_$name$() {\n"
"$annotate_release$"
" // @@protoc_insertion_point(field_unsafe_arena_release"
":$pkg.Msg.field$)\n"
"$StrongRef$;"
" if ($has_field$) {\n"
" clear_has_$oneof_name$();\n"
" $Submsg$* temp = $cast_field_$;\n"
" $field_$ = nullptr;\n"
" return temp;\n"
" } else {\n"
" return nullptr;\n"
" }\n"
"}\n"
"inline void $Msg$::unsafe_arena_set_allocated_$name$"
"($Submsg$* $name$) {\n"
// We rely on the oneof clear method to free the earlier contents of
// this oneof. We can directly use the pointer we're given to set the
// new value.
" clear_$oneof_name$();\n"
" if ($name$) {\n"
" set_has_$name$();\n");
if (is_weak()) {
p->Emit(
" $field_$ = "
"reinterpret_cast<$pb$::MessageLite*>($name$);\n");
} else {
p->Emit(" $field_$ = $name$;\n");
}
p->Emit(
" }\n"
"$annotate_set$"
" // @@protoc_insertion_point(field_unsafe_arena_set_allocated:"
"$pkg.Msg.field$)\n"
"}\n"
"inline $Submsg$* $Msg$::_internal_mutable_$name$() {\n"
"$StrongRef$;"
" if ($not_has_field$) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n");
if (is_weak()) {
p->Emit(
" $field_$ = "
"reinterpret_cast<$pb$::MessageLite*>(CreateMaybeMessage< "
"$Submsg$ >(GetArenaForAllocation()));\n");
} else {
p->Emit(
" $field_$ = CreateMaybeMessage< $Submsg$ "
">(GetArenaForAllocation());\n");
}
{
{"maybe_cast_weak_input",
[&] {
if (is_weak()) {
p->Emit("reinterpret_cast<$pb$::MessageLite*>($name$);");
} else {
p->Emit("$name$;");
}
}},
},
R"cc(
inline void $Msg$::unsafe_arena_set_allocated_$name$($Submsg$* $name$) {
// We rely on the oneof clear method to free the earlier contents
// of this oneof. We can directly use the pointer we're given to
// set the new value.
clear_$oneof_name$();
if ($name$) {
set_has_$name$();
$field_$ = $maybe_cast_weak_input$;
}
$annotate_set$;
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:$pkg.Msg.field$)
}
)cc");
p->Emit(
" }\n"
" return $cast_field_$;\n"
"}\n"
"inline $Submsg$* $Msg$::mutable_$name$() {\n"
" $Submsg$* _msg = _internal_mutable_$name$();\n"
"$annotate_mutable$"
" // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$)\n"
" return _msg;\n"
"}\n");
{
{"maybe_cast_weak_new",
[&] {
if (is_weak()) {
p->Emit(R"cc(
reinterpret_cast<$pb$::MessageLite*>(
CreateMaybeMessage<$Submsg$>(GetArenaForAllocation()));
)cc");
} else {
p->Emit(R"cc(
CreateMaybeMessage<$Submsg$>(GetArenaForAllocation());
)cc");
}
}},
},
R"cc(
inline $Submsg$* $Msg$::_internal_mutable_$name$() {
$StrongRef$;
if ($not_has_field$) {
clear_$oneof_name$();
set_has_$name$();
$field_$ = $maybe_cast_weak_new$;
}
return $cast_field_$;
}
)cc");
p->Emit(R"cc(
inline $Submsg$* $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND {
$Submsg$* _msg = _internal_mutable_$name$();
$annotate_mutable$;
// @@protoc_insertion_point(field_mutable:$pkg.Msg.field$)
return _msg;
}
)cc");
}
void OneofMessage::GenerateClearingCode(io::Printer* p) const {
@ -781,52 +797,63 @@ void RepeatedMessage::GenerateAccessorDeclarations(io::Printer* p) const {
}
void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
// TODO(dlj): move insertion points
p->Emit(R"cc(
inline $Submsg$* $Msg$::mutable_$name$(int index)
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$annotate_mutable$;
// @@protoc_insertion_point(field_mutable:$pkg.Msg.field$)
$StrongRef$;
return _internal_mutable_$name$()->Mutable(index);
}
)cc");
p->Emit(R"cc(
inline $pb$::RepeatedPtrField<$Submsg$>* $Msg$::mutable_$name$()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$annotate_mutable_list$;
// @@protoc_insertion_point(field_mutable_list:$pkg.Msg.field$)
$StrongRef$;
$TsanDetectConcurrentMutation$;
return _internal_mutable_$name$();
}
)cc");
p->Emit(
"inline $Submsg$* $Msg$::mutable_$name$(int index) {\n"
"$annotate_mutable$"
// TODO(dlj): move insertion points
" // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$)\n"
"$StrongRef$;"
" return _internal_mutable_$name$()->Mutable(index);\n"
"}\n"
"inline $pb$::RepeatedPtrField< $Submsg$ >*\n"
"$Msg$::mutable_$name$() {\n"
"$annotate_mutable_list$"
" // @@protoc_insertion_point(field_mutable_list:$pkg.Msg.field$)\n"
"$StrongRef$;"
" $TsanDetectConcurrentMutation$;\n"
" return _internal_mutable_$name$();\n"
"}\n");
p->Emit({{"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"},
{"GetExtraArg",
[&] {
p->Emit(opts_->safe_boundary_check
? ", reinterpret_cast<const $Submsg$&>($kDefault$)"
: "");
}}},
"inline const $Submsg$& $Msg$::$name$(int index) const {\n"
"$annotate_get$"
" // @@protoc_insertion_point(field_get:$pkg.Msg.field$)\n"
" $StrongRef$;"
" return _internal_$name$().$Get$(index$GetExtraArg$);\n"
"}\n"
"inline $Submsg$* $Msg$::add_$name$() {\n"
" $TsanDetectConcurrentMutation$;\n"
" $Submsg$* _add = _internal_mutable_$name$()->Add();\n"
"$annotate_add_mutable$"
" // @@protoc_insertion_point(field_add:$pkg.Msg.field$)\n"
" return _add;\n"
"}\n");
p->Emit(
"inline const $pb$::RepeatedPtrField< $Submsg$ >&\n"
"$Msg$::$name$() const {\n"
"$annotate_list$"
" // @@protoc_insertion_point(field_list:$pkg.Msg.field$)\n"
"$StrongRef$;"
" return _internal_$name$();\n"
"}\n");
{
{"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"},
{"GetExtraArg",
[&] {
p->Emit(opts_->safe_boundary_check
? ", reinterpret_cast<const $Submsg$&>($kDefault$)"
: "");
}},
},
R"cc(
inline const $Submsg$& $Msg$::$name$(int index) const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$annotate_get$;
// @@protoc_insertion_point(field_get:$pkg.Msg.field$)
$StrongRef$;
return _internal_$name$().$Get$(index$GetExtraArg$);
}
)cc");
p->Emit(R"cc(
inline $Submsg$* $Msg$::add_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND {
$TsanDetectConcurrentMutation$;
$Submsg$* _add = _internal_mutable_$name$()->Add();
$annotate_add_mutable$;
// @@protoc_insertion_point(field_add:$pkg.Msg.field$)
return _add;
}
)cc");
p->Emit(R"cc(
inline const $pb$::RepeatedPtrField<$Submsg$>& $Msg$::$name$() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$annotate_list$;
// @@protoc_insertion_point(field_list:$pkg.Msg.field$)
$StrongRef$;
return _internal_$name$();
}
)cc");
if (should_split()) {
p->Emit(R"cc(

@ -1309,11 +1309,13 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) {
"\n");
p->Emit(R"cc(
inline const $unknown_fields_type$& unknown_fields() const {
inline const $unknown_fields_type$& unknown_fields() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$annotate_unknown_fields$;
return $unknown_fields$;
}
inline $unknown_fields_type$* mutable_unknown_fields() {
inline $unknown_fields_type$* mutable_unknown_fields()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$annotate_mutable_unknown_fields$;
return $mutable_unknown_fields$;
}

@ -154,10 +154,12 @@ class PROTOC_EXPORT Version final :
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
}
@ -366,10 +368,12 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
}
@ -594,10 +598,12 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
}
@ -823,10 +829,12 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
}
@ -1395,28 +1403,30 @@ inline int CodeGeneratorRequest::_internal_proto_file_size() const {
inline int CodeGeneratorRequest::proto_file_size() const {
return _internal_proto_file_size();
}
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) {
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index)
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return _internal_mutable_proto_file()->Mutable(index);
}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
CodeGeneratorRequest::mutable_proto_file() {
inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* CodeGeneratorRequest::mutable_proto_file()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
return _internal_mutable_proto_file();
}
inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const {
inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return _internal_proto_file().Get(index);
return _internal_proto_file().Get(index);
}
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() {
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() ABSL_ATTRIBUTE_LIFETIME_BOUND {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
::google::protobuf::FileDescriptorProto* _add = _internal_mutable_proto_file()->Add();
// @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return _add;
}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
CodeGeneratorRequest::proto_file() const {
inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>& CodeGeneratorRequest::proto_file() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return _internal_proto_file();
}
@ -1438,28 +1448,30 @@ inline int CodeGeneratorRequest::_internal_source_file_descriptors_size() const
inline int CodeGeneratorRequest::source_file_descriptors_size() const {
return _internal_source_file_descriptors_size();
}
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_source_file_descriptors(int index) {
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_source_file_descriptors(int index)
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors)
return _internal_mutable_source_file_descriptors()->Mutable(index);
}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
CodeGeneratorRequest::mutable_source_file_descriptors() {
inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* CodeGeneratorRequest::mutable_source_file_descriptors()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors)
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
return _internal_mutable_source_file_descriptors();
}
inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::source_file_descriptors(int index) const {
inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::source_file_descriptors(int index) const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors)
return _internal_source_file_descriptors().Get(index);
return _internal_source_file_descriptors().Get(index);
}
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_source_file_descriptors() {
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_source_file_descriptors() ABSL_ATTRIBUTE_LIFETIME_BOUND {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
::google::protobuf::FileDescriptorProto* _add = _internal_mutable_source_file_descriptors()->Add();
// @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors)
return _add;
}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
CodeGeneratorRequest::source_file_descriptors() const {
inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>& CodeGeneratorRequest::source_file_descriptors() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors)
return _internal_source_file_descriptors();
}
@ -1490,7 +1502,7 @@ inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::_inter
const ::google::protobuf::compiler::Version* p = _impl_.compiler_version_;
return p != nullptr ? *p : reinterpret_cast<const ::google::protobuf::compiler::Version&>(::google::protobuf::compiler::_Version_default_instance_);
}
inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compiler_version() const {
inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compiler_version() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
return _internal_compiler_version();
}
@ -1544,7 +1556,7 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::_internal_mu
}
return _impl_.compiler_version_;
}
inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() {
inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() ABSL_ATTRIBUTE_LIFETIME_BOUND {
::google::protobuf::compiler::Version* _msg = _internal_mutable_compiler_version();
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
return _msg;
@ -1796,7 +1808,7 @@ inline const ::google::protobuf::GeneratedCodeInfo& CodeGeneratorResponse_File::
const ::google::protobuf::GeneratedCodeInfo* p = _impl_.generated_code_info_;
return p != nullptr ? *p : reinterpret_cast<const ::google::protobuf::GeneratedCodeInfo&>(::google::protobuf::_GeneratedCodeInfo_default_instance_);
}
inline const ::google::protobuf::GeneratedCodeInfo& CodeGeneratorResponse_File::generated_code_info() const {
inline const ::google::protobuf::GeneratedCodeInfo& CodeGeneratorResponse_File::generated_code_info() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info)
return _internal_generated_code_info();
}
@ -1850,7 +1862,7 @@ inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::_inter
}
return _impl_.generated_code_info_;
}
inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::mutable_generated_code_info() {
inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::mutable_generated_code_info() ABSL_ATTRIBUTE_LIFETIME_BOUND {
::google::protobuf::GeneratedCodeInfo* _msg = _internal_mutable_generated_code_info();
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info)
return _msg;
@ -1990,28 +2002,30 @@ inline void CodeGeneratorResponse::clear_file() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.file_.Clear();
}
inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) {
inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index)
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file)
return _internal_mutable_file()->Mutable(index);
}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >*
CodeGeneratorResponse::mutable_file() {
inline ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* CodeGeneratorResponse::mutable_file()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file)
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
return _internal_mutable_file();
}
inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const {
inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file)
return _internal_file().Get(index);
return _internal_file().Get(index);
}
inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() {
inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() ABSL_ATTRIBUTE_LIFETIME_BOUND {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
::google::protobuf::compiler::CodeGeneratorResponse_File* _add = _internal_mutable_file()->Add();
// @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file)
return _add;
}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >&
CodeGeneratorResponse::file() const {
inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>& CodeGeneratorResponse::file() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
// @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file)
return _internal_file();
}

@ -138,10 +138,12 @@ class PROTOBUF_EXPORT CppFeatures final :
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields()
ABSL_ATTRIBUTE_LIFETIME_BOUND {
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
}

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