Change TSan validation to run in phases to reduce risks of roll backs.

TSan validation is currently disabled so this should be a no-op.

PiperOrigin-RevId: 542354883
pull/13111/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent a44fc2b063
commit c76644863a
  1. 17
      src/google/protobuf/compiler/cpp/field.cc
  2. 146
      src/google/protobuf/compiler/plugin.pb.h
  3. 1132
      src/google/protobuf/descriptor.pb.h
  4. 14
      src/google/protobuf/port_def.inc
  5. 8
      src/google/protobuf/port_undef.inc

@ -62,6 +62,17 @@ using Sub = ::google::protobuf::io::Printer::Sub;
std::vector<Sub> FieldVars(const FieldDescriptor* field, const Options& opts) {
bool split = ShouldSplit(field, opts);
// TODO(b/280674214): get rid of phase logic after TSan validation rolls out.
std::string tsan_validation_phase;
if (field->is_repeated()) {
tsan_validation_phase = "REPEATED";
} else if (field->cpp_type() < FieldDescriptor::CPPTYPE_STRING) {
tsan_validation_phase = "PRIMITIVE";
} else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) {
tsan_validation_phase = "STRING";
} else { // message fields
tsan_validation_phase = "MESSAGE";
}
std::vector<Sub> vars = {
// This will eventually be renamed to "field", once the existing "field"
// variable is replaced with "field_" everywhere.
@ -88,9 +99,11 @@ std::vector<Sub> FieldVars(const FieldDescriptor* field, const Options& opts) {
// For TSan validation.
{"TsanDetectConcurrentMutation",
"PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race)"},
absl::StrCat("PROTOBUF_TSAN_WRITE_", tsan_validation_phase,
"(&_impl_._tsan_detect_race)")},
{"TsanDetectConcurrentRead",
"PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race)"},
absl::StrCat("PROTOBUF_TSAN_READ_", tsan_validation_phase,
"(&_impl_._tsan_detect_race)")},
// Old-style names.
{"field", FieldMemberName(field, split)},

@ -1039,11 +1039,11 @@ inline void Version::set_major(::int32_t value) {
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major)
}
inline ::int32_t Version::_internal_major() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_PRIMITIVE(&_impl_._tsan_detect_race);
return _impl_.major_;
}
inline void Version::_internal_set_major(::int32_t value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_PRIMITIVE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
_impl_.major_ = value;
}
@ -1066,11 +1066,11 @@ inline void Version::set_minor(::int32_t value) {
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor)
}
inline ::int32_t Version::_internal_minor() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_PRIMITIVE(&_impl_._tsan_detect_race);
return _impl_.minor_;
}
inline void Version::_internal_set_minor(::int32_t value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_PRIMITIVE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000004u;
_impl_.minor_ = value;
}
@ -1093,11 +1093,11 @@ inline void Version::set_patch(::int32_t value) {
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch)
}
inline ::int32_t Version::_internal_patch() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_PRIMITIVE(&_impl_._tsan_detect_race);
return _impl_.patch_;
}
inline void Version::_internal_set_patch(::int32_t value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_PRIMITIVE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000008u;
_impl_.patch_ = value;
}
@ -1118,7 +1118,7 @@ inline const std::string& Version::suffix() const {
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void Version::set_suffix(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
_impl_.suffix_.Set(static_cast<Arg_&&>(arg), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix)
@ -1129,21 +1129,21 @@ inline std::string* Version::mutable_suffix() {
return _s;
}
inline const std::string& Version::_internal_suffix() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_STRING(&_impl_._tsan_detect_race);
return _impl_.suffix_.Get();
}
inline void Version::_internal_set_suffix(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
_impl_.suffix_.Set(value, GetArenaForAllocation());
}
inline std::string* Version::_internal_mutable_suffix() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
return _impl_.suffix_.Mutable( GetArenaForAllocation());
}
inline std::string* Version::release_suffix() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix)
if ((_impl_._has_bits_[0] & 0x00000001u) == 0) {
return nullptr;
@ -1156,7 +1156,7 @@ inline std::string* Version::release_suffix() {
return released;
}
inline void Version::set_allocated_suffix(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
if (value != nullptr) {
_impl_._has_bits_[0] |= 0x00000001u;
} else {
@ -1186,7 +1186,7 @@ inline void CodeGeneratorRequest::clear_file_to_generate() {
_internal_mutable_file_to_generate()->Clear();
}
inline std::string* CodeGeneratorRequest::add_file_to_generate() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
std::string* _s = _internal_mutable_file_to_generate()->Add();
// @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
return _s;
@ -1224,29 +1224,29 @@ inline void CodeGeneratorRequest::set_file_to_generate(int index, absl::string_v
// @@protoc_insertion_point(field_set_string_piece:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
}
inline void CodeGeneratorRequest::add_file_to_generate(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
_internal_mutable_file_to_generate()->Add()->assign(value);
// @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
}
inline void CodeGeneratorRequest::add_file_to_generate(std::string&& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
_internal_mutable_file_to_generate()->Add(std::move(value));
// @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
}
inline void CodeGeneratorRequest::add_file_to_generate(const char* value) {
ABSL_DCHECK(value != nullptr);
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
_internal_mutable_file_to_generate()->Add()->assign(value);
// @@protoc_insertion_point(field_add_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
}
inline void CodeGeneratorRequest::add_file_to_generate(const char* value, std::size_t size) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
_internal_mutable_file_to_generate()->Add()->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
}
inline void CodeGeneratorRequest::add_file_to_generate(absl::string_view value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
_internal_mutable_file_to_generate()->Add()->assign(value.data(), value.size());
// @@protoc_insertion_point(field_add_string_piece:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
}
@ -1257,17 +1257,17 @@ CodeGeneratorRequest::file_to_generate() const {
}
inline ::google::protobuf::RepeatedPtrField<std::string>* CodeGeneratorRequest::mutable_file_to_generate() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
return _internal_mutable_file_to_generate();
}
inline const ::google::protobuf::RepeatedPtrField<std::string>&
CodeGeneratorRequest::_internal_file_to_generate() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_REPEATED(&_impl_._tsan_detect_race);
return _impl_.file_to_generate_;
}
inline ::google::protobuf::RepeatedPtrField<std::string>*
CodeGeneratorRequest::_internal_mutable_file_to_generate() {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_REPEATED(&_impl_._tsan_detect_race);
return &_impl_.file_to_generate_;
}
@ -1287,7 +1287,7 @@ inline const std::string& CodeGeneratorRequest::parameter() const {
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorRequest::set_parameter(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
_impl_.parameter_.Set(static_cast<Arg_&&>(arg), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter)
@ -1298,21 +1298,21 @@ inline std::string* CodeGeneratorRequest::mutable_parameter() {
return _s;
}
inline const std::string& CodeGeneratorRequest::_internal_parameter() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_STRING(&_impl_._tsan_detect_race);
return _impl_.parameter_.Get();
}
inline void CodeGeneratorRequest::_internal_set_parameter(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
_impl_.parameter_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
return _impl_.parameter_.Mutable( GetArenaForAllocation());
}
inline std::string* CodeGeneratorRequest::release_parameter() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter)
if ((_impl_._has_bits_[0] & 0x00000001u) == 0) {
return nullptr;
@ -1325,7 +1325,7 @@ inline std::string* CodeGeneratorRequest::release_parameter() {
return released;
}
inline void CodeGeneratorRequest::set_allocated_parameter(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
if (value != nullptr) {
_impl_._has_bits_[0] |= 0x00000001u;
} else {
@ -1354,7 +1354,7 @@ inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_pr
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
CodeGeneratorRequest::mutable_proto_file() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
return _internal_mutable_proto_file();
}
inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const {
@ -1362,7 +1362,7 @@ inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::prot
return _internal_proto_file().Get(index);
}
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_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;
@ -1374,12 +1374,12 @@ CodeGeneratorRequest::proto_file() const {
}
inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>&
CodeGeneratorRequest::_internal_proto_file() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_REPEATED(&_impl_._tsan_detect_race);
return _impl_.proto_file_;
}
inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>*
CodeGeneratorRequest::_internal_mutable_proto_file() {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_REPEATED(&_impl_._tsan_detect_race);
return &_impl_.proto_file_;
}
@ -1394,7 +1394,7 @@ inline void CodeGeneratorRequest::clear_compiler_version() {
_impl_._has_bits_[0] &= ~0x00000002u;
}
inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_MESSAGE(&_impl_._tsan_detect_race);
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_);
}
@ -1403,7 +1403,7 @@ inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compil
return _internal_compiler_version();
}
inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version(::google::protobuf::compiler::Version* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.compiler_version_);
}
@ -1416,7 +1416,7 @@ inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version(::
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
}
inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_compiler_version() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] &= ~0x00000002u;
::google::protobuf::compiler::Version* released = _impl_.compiler_version_;
@ -1435,7 +1435,7 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_comp
return released;
}
inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::unsafe_arena_release_compiler_version() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
_impl_._has_bits_[0] &= ~0x00000002u;
@ -1444,7 +1444,7 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::unsafe_arena
return temp;
}
inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
if (_impl_.compiler_version_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::compiler::Version>(GetArenaForAllocation());
@ -1459,7 +1459,7 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_comp
}
inline void CodeGeneratorRequest::set_allocated_compiler_version(::google::protobuf::compiler::Version* value) {
::google::protobuf::Arena* message_arena = GetArenaForAllocation();
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
if (message_arena == nullptr) {
delete reinterpret_cast<::google::protobuf::compiler::Version*>(_impl_.compiler_version_);
}
@ -1499,7 +1499,7 @@ inline const std::string& CodeGeneratorResponse_File::name() const {
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_name(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
_impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name)
@ -1510,21 +1510,21 @@ inline std::string* CodeGeneratorResponse_File::mutable_name() {
return _s;
}
inline const std::string& CodeGeneratorResponse_File::_internal_name() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_STRING(&_impl_._tsan_detect_race);
return _impl_.name_.Get();
}
inline void CodeGeneratorResponse_File::_internal_set_name(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
_impl_.name_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
return _impl_.name_.Mutable( GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_name() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name)
if ((_impl_._has_bits_[0] & 0x00000001u) == 0) {
return nullptr;
@ -1537,7 +1537,7 @@ inline std::string* CodeGeneratorResponse_File::release_name() {
return released;
}
inline void CodeGeneratorResponse_File::set_allocated_name(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
if (value != nullptr) {
_impl_._has_bits_[0] |= 0x00000001u;
} else {
@ -1568,7 +1568,7 @@ inline const std::string& CodeGeneratorResponse_File::insertion_point() const {
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_insertion_point(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
_impl_.insertion_point_.Set(static_cast<Arg_&&>(arg), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
@ -1579,21 +1579,21 @@ inline std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
return _s;
}
inline const std::string& CodeGeneratorResponse_File::_internal_insertion_point() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_STRING(&_impl_._tsan_detect_race);
return _impl_.insertion_point_.Get();
}
inline void CodeGeneratorResponse_File::_internal_set_insertion_point(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
_impl_.insertion_point_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_point() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
return _impl_.insertion_point_.Mutable( GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_insertion_point() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
if ((_impl_._has_bits_[0] & 0x00000002u) == 0) {
return nullptr;
@ -1606,7 +1606,7 @@ inline std::string* CodeGeneratorResponse_File::release_insertion_point() {
return released;
}
inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
if (value != nullptr) {
_impl_._has_bits_[0] |= 0x00000002u;
} else {
@ -1637,7 +1637,7 @@ inline const std::string& CodeGeneratorResponse_File::content() const {
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_content(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000004u;
_impl_.content_.Set(static_cast<Arg_&&>(arg), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content)
@ -1648,21 +1648,21 @@ inline std::string* CodeGeneratorResponse_File::mutable_content() {
return _s;
}
inline const std::string& CodeGeneratorResponse_File::_internal_content() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_STRING(&_impl_._tsan_detect_race);
return _impl_.content_.Get();
}
inline void CodeGeneratorResponse_File::_internal_set_content(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000004u;
_impl_.content_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000004u;
return _impl_.content_.Mutable( GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_content() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content)
if ((_impl_._has_bits_[0] & 0x00000004u) == 0) {
return nullptr;
@ -1675,7 +1675,7 @@ inline std::string* CodeGeneratorResponse_File::release_content() {
return released;
}
inline void CodeGeneratorResponse_File::set_allocated_content(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
if (value != nullptr) {
_impl_._has_bits_[0] |= 0x00000004u;
} else {
@ -1697,7 +1697,7 @@ inline bool CodeGeneratorResponse_File::has_generated_code_info() const {
return value;
}
inline const ::google::protobuf::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_MESSAGE(&_impl_._tsan_detect_race);
const ::google::protobuf::GeneratedCodeInfo* p = _impl_.generated_code_info_;
return p != nullptr ? *p : reinterpret_cast<const ::google::protobuf::GeneratedCodeInfo&>(::google::protobuf::_GeneratedCodeInfo_default_instance_);
}
@ -1706,7 +1706,7 @@ inline const ::google::protobuf::GeneratedCodeInfo& CodeGeneratorResponse_File::
return _internal_generated_code_info();
}
inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.generated_code_info_);
}
@ -1719,7 +1719,7 @@ inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_cod
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info)
}
inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::release_generated_code_info() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] &= ~0x00000008u;
::google::protobuf::GeneratedCodeInfo* released = _impl_.generated_code_info_;
@ -1738,7 +1738,7 @@ inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::releas
return released;
}
inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe_arena_release_generated_code_info() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info)
_impl_._has_bits_[0] &= ~0x00000008u;
@ -1747,7 +1747,7 @@ inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe
return temp;
}
inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000008u;
if (_impl_.generated_code_info_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo>(GetArenaForAllocation());
@ -1762,7 +1762,7 @@ inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::mutabl
}
inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* value) {
::google::protobuf::Arena* message_arena = GetArenaForAllocation();
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_MESSAGE(&_impl_._tsan_detect_race);
if (message_arena == nullptr) {
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.generated_code_info_);
}
@ -1802,7 +1802,7 @@ inline const std::string& CodeGeneratorResponse::error() const {
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse::set_error(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
_impl_.error_.Set(static_cast<Arg_&&>(arg), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error)
@ -1813,21 +1813,21 @@ inline std::string* CodeGeneratorResponse::mutable_error() {
return _s;
}
inline const std::string& CodeGeneratorResponse::_internal_error() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_STRING(&_impl_._tsan_detect_race);
return _impl_.error_.Get();
}
inline void CodeGeneratorResponse::_internal_set_error(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
_impl_.error_.Set(value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse::_internal_mutable_error() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
return _impl_.error_.Mutable( GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse::release_error() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error)
if ((_impl_._has_bits_[0] & 0x00000001u) == 0) {
return nullptr;
@ -1840,7 +1840,7 @@ inline std::string* CodeGeneratorResponse::release_error() {
return released;
}
inline void CodeGeneratorResponse::set_allocated_error(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_STRING(&_impl_._tsan_detect_race);
if (value != nullptr) {
_impl_._has_bits_[0] |= 0x00000001u;
} else {
@ -1873,11 +1873,11 @@ inline void CodeGeneratorResponse::set_supported_features(::uint64_t value) {
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.supported_features)
}
inline ::uint64_t CodeGeneratorResponse::_internal_supported_features() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_PRIMITIVE(&_impl_._tsan_detect_race);
return _impl_.supported_features_;
}
inline void CodeGeneratorResponse::_internal_set_supported_features(::uint64_t value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_PRIMITIVE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
_impl_.supported_features_ = value;
}
@ -1899,7 +1899,7 @@ inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorRe
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >*
CodeGeneratorResponse::mutable_file() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file)
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_impl_._tsan_detect_race);
return _internal_mutable_file();
}
inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const {
@ -1907,7 +1907,7 @@ inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGener
return _internal_file().Get(index);
}
inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_WRITE_REPEATED(&_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;
@ -1919,12 +1919,12 @@ CodeGeneratorResponse::file() const {
}
inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>&
CodeGeneratorResponse::_internal_file() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_REPEATED(&_impl_._tsan_detect_race);
return _impl_.file_;
}
inline ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>*
CodeGeneratorResponse::_internal_mutable_file() {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
PROTOBUF_TSAN_READ_REPEATED(&_impl_._tsan_detect_race);
return &_impl_.file_;
}

File diff suppressed because it is too large Load Diff

@ -835,8 +835,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#ifdef PROTOBUF_TSAN_WRITE
#error PROTOBUF_TSAN_WRITE was previously defined
#endif
// TODO(b/280674214): re-enable these macros once failing tests are fixed.
#if defined(PROTOBUF_TSAN) && false
#ifdef PROTOBUF_TSAN
// TODO(b/285620714): it would be preferable to use __tsan_external_read/
// __tsan_external_write, but they can cause dlopen issues.
#define PROTOBUF_TSAN_READ(addr) \
@ -861,6 +860,17 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#define PROTOBUF_TSAN_DECLARE_MEMBER
#endif
// TODO(b/280674214): enable these macros in phases. The phases are: repeated
// fields/maps, enum/primitive fields, string fields, message fields.
#define PROTOBUF_TSAN_READ_REPEATED(addr)
#define PROTOBUF_TSAN_READ_PRIMITIVE(addr)
#define PROTOBUF_TSAN_READ_STRING(addr)
#define PROTOBUF_TSAN_READ_MESSAGE(addr)
#define PROTOBUF_TSAN_WRITE_REPEATED(addr)
#define PROTOBUF_TSAN_WRITE_PRIMITIVE(addr)
#define PROTOBUF_TSAN_WRITE_STRING(addr)
#define PROTOBUF_TSAN_WRITE_MESSAGE(addr)
#ifdef PROTOBUF_USE_TABLE_PARSER_ON_REFLECTION
#error PROTOBUF_USE_TABLE_PARSER_ON_REFLECTION was previously defined
#endif

@ -106,6 +106,14 @@
#undef PROTOBUF_TSAN_DECLARE_MEMBER
#undef PROTOBUF_TSAN_READ
#undef PROTOBUF_TSAN_WRITE
#undef PROTOBUF_TSAN_READ_REPEATED
#undef PROTOBUF_TSAN_READ_PRIMITIVE
#undef PROTOBUF_TSAN_READ_STRING
#undef PROTOBUF_TSAN_READ_MESSAGE
#undef PROTOBUF_TSAN_WRITE_REPEATED
#undef PROTOBUF_TSAN_WRITE_PRIMITIVE
#undef PROTOBUF_TSAN_WRITE_STRING
#undef PROTOBUF_TSAN_WRITE_MESSAGE
#undef PROTOBUF_USE_TABLE_PARSER_ON_REFLECTION
#undef PROTOBUF_TC_PARAM_DECL
#undef PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED

Loading…
Cancel
Save