1515#include < atomic>
1616#include < cstdint>
1717#include < cstring>
18+ #include < new> // IWYU pragma: keep for operator delete
1819#include < string>
1920#include < type_traits>
21+ #include < utility>
22+ #include < vector>
2023
24+ #include " absl/base/attributes.h"
2125#include " absl/base/call_once.h"
22- #include " absl/base/casts.h"
23- #include " absl/container/flat_hash_map.h"
26+ #include " absl/base/const_init.h"
2427#include " absl/container/flat_hash_set.h"
2528#include " absl/log/absl_check.h"
2629#include " absl/log/absl_log.h"
27- #include " absl/strings/match.h"
2830#include " absl/strings/str_format.h"
2931#include " absl/strings/string_view.h"
3032#include " absl/synchronization/mutex.h"
3739#include " google/protobuf/generated_message_util.h"
3840#include " google/protobuf/inlined_string_field.h"
3941#include " google/protobuf/map_field.h"
40- #include " google/protobuf/map_field_inl.h"
4142#include " google/protobuf/message.h"
43+ #include " google/protobuf/message_lite.h"
4244#include " google/protobuf/raw_ptr.h"
4345#include " google/protobuf/repeated_field.h"
46+ #include " google/protobuf/repeated_ptr_field.h"
4447#include " google/protobuf/unknown_field_set.h"
4548
4649
@@ -636,7 +639,7 @@ void SwapFieldHelper::SwapInlinedStrings(const Reflection* r, Message* lhs,
636639 auto* lhs_string = r->MutableRaw<InlinedStringField>(lhs, field);
637640 auto* rhs_string = r->MutableRaw<InlinedStringField>(rhs, field);
638641 uint32_t index = r->schema_.InlinedStringIndex(field);
639- ABSL_DCHECK_GT(index, 0 );
642+ ABSL_DCHECK_GT(index, 0u );
640643 uint32_t* lhs_array = r->MutableInlinedStringDonatedArray(lhs);
641644 uint32_t* rhs_array = r->MutableInlinedStringDonatedArray(rhs);
642645 uint32_t* lhs_state = &lhs_array[index / 32];
@@ -1889,7 +1892,7 @@ void Reflection::SetString(Message* message, const FieldDescriptor* field,
18891892 case FieldOptions::STRING: {
18901893 if (IsInlined (field)) {
18911894 const uint32_t index = schema_.InlinedStringIndex (field);
1892- ABSL_DCHECK_GT (index, 0 );
1895+ ABSL_DCHECK_GT (index, 0u );
18931896 uint32_t * states =
18941897 &MutableInlinedStringDonatedArray (message)[index / 32 ];
18951898 uint32_t mask = ~(static_cast <uint32_t >(1 ) << (index % 32 ));
@@ -1950,7 +1953,7 @@ void Reflection::SetString(Message* message, const FieldDescriptor* field,
19501953 if (IsInlined (field)) {
19511954 auto * str = MutableField<InlinedStringField>(message, field);
19521955 const uint32_t index = schema_.InlinedStringIndex (field);
1953- ABSL_DCHECK_GT (index, 0 );
1956+ ABSL_DCHECK_GT (index, 0u );
19541957 uint32_t * states =
19551958 &MutableInlinedStringDonatedArray (message)[index / 32 ];
19561959 uint32_t mask = ~(static_cast <uint32_t >(1 ) << (index % 32 ));
@@ -2791,7 +2794,7 @@ uint32_t* Reflection::MutableInlinedStringDonatedArray(Message* message) const {
27912794bool Reflection::IsInlinedStringDonated (const Message& message,
27922795 const FieldDescriptor* field) const {
27932796 uint32_t index = schema_.InlinedStringIndex (field);
2794- ABSL_DCHECK_GT (index, 0 );
2797+ ABSL_DCHECK_GT (index, 0u );
27952798 return IsIndexInHasBitSet (GetInlinedStringDonatedArray (message), index);
27962799}
27972800
@@ -2824,7 +2827,7 @@ void Reflection::SwapInlinedStringDonated(Message* lhs, Message* rhs,
28242827 ABSL_CHECK_EQ (rhs_array[0 ] & 0x1u , 0u );
28252828 // Swap donation status bit.
28262829 uint32_t index = schema_.InlinedStringIndex (field);
2827- ABSL_DCHECK_GT (index, 0 );
2830+ ABSL_DCHECK_GT (index, 0u );
28282831 if (rhs_donated) {
28292832 SetInlinedStringDonated (index, lhs_array);
28302833 ClearInlinedStringDonated (index, rhs_array);
@@ -3580,17 +3583,17 @@ namespace {
35803583// all the allocated reflection instances.
35813584struct MetadataOwner {
35823585 ~MetadataOwner () {
3583- for (auto range : metadata_arrays_ ) {
3586+ for (auto range : metadata_arrays ) {
35843587 for (const Metadata* m = range.first ; m < range.second ; m++) {
35853588 delete m->reflection ;
35863589 }
35873590 }
35883591 }
35893592
35903593 void AddArray (const Metadata* begin, const Metadata* end) {
3591- mu_ .Lock ();
3592- metadata_arrays_ .push_back (std::make_pair (begin, end));
3593- mu_ .Unlock ();
3594+ mu .Lock ();
3595+ metadata_arrays .push_back (std::make_pair (begin, end));
3596+ mu .Unlock ();
35943597 }
35953598
35963599 static MetadataOwner* Instance () {
@@ -3601,8 +3604,8 @@ struct MetadataOwner {
36013604 private:
36023605 MetadataOwner () = default ; // private because singleton
36033606
3604- absl::Mutex mu_ ;
3605- std::vector<std::pair<const Metadata*, const Metadata*> > metadata_arrays_ ;
3607+ absl::Mutex mu ;
3608+ std::vector<std::pair<const Metadata*, const Metadata*>> metadata_arrays ;
36063609};
36073610
36083611void AssignDescriptorsImpl (const DescriptorTable* table, bool eager) {
0 commit comments