Skip to content

Commit 5d8a95b

Browse files
ClaytonKnittelcopybara-github
authored andcommitted
Move string field hasbit setter to public mutable_* method.
The _internal_set_ method is used internally in CopyFrom/MergeFrom, which already handle hasbits, making the hasbit setters here redundant. PiperOrigin-RevId: 792909628
1 parent 75afd7f commit 5d8a95b

File tree

3 files changed

+44
-88
lines changed

3 files changed

+44
-88
lines changed

src/google/protobuf/compiler/cpp/field_generators/string_field.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ void SingularString::GenerateInlineAccessorDefinitions(io::Printer* p) const {
463463
ABSL_ATTRIBUTE_LIFETIME_BOUND {
464464
$WeakDescriptorSelfPin$;
465465
$PrepareSplitMessageForWrite$;
466+
$update_hasbit$;
466467
::std::string* _s = _internal_mutable_$name_internal$();
467468
$annotate_mutable$;
468469
// @@protoc_insertion_point(field_mutable:$pkg.Msg.field$)
@@ -475,14 +476,12 @@ void SingularString::GenerateInlineAccessorDefinitions(io::Printer* p) const {
475476
}
476477
inline void $Msg$::_internal_set_$name_internal$(const ::std::string& value) {
477478
$TsanDetectConcurrentMutation$;
478-
$update_hasbit$;
479479
//~ Don't use $Set$ here; we always want the std::string variant
480480
//~ regardless of whether this is a `bytes` field.
481481
$field_$.Set(value, $set_args$);
482482
}
483483
inline ::std::string* $nonnull$ $Msg$::_internal_mutable_$name_internal$() {
484484
$TsanDetectConcurrentMutation$;
485-
$update_hasbit$;
486485
return $field_$.Mutable($lazy_args$, $set_args$);
487486
}
488487
inline ::std::string* $nullable$ $Msg$::$release_name$() {

src/google/protobuf/compiler/plugin.pb.h

Lines changed: 6 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)