google-protobuf 4.26.1 → 4.27.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of google-protobuf might be problematic. Click here for more details.

@@ -1,5 +1,5 @@
1
1
  // Ruby is still using proto3 enum semantics for proto2
2
- #define UPB_DISABLE_PROTO2_ENUM_CHECKING
2
+ #define UPB_DISABLE_CLOSED_ENUM_CHECKING
3
3
  /* Amalgamated source file */
4
4
 
5
5
  /*
@@ -114,17 +114,17 @@ Error, UINTPTR_MAX is undefined
114
114
 
115
115
  // Macros for function attributes on compilers that support them.
116
116
  #ifdef __GNUC__
117
- #define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
117
+ #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static
118
118
  #define UPB_NOINLINE __attribute__((noinline))
119
119
  #define UPB_NORETURN __attribute__((__noreturn__))
120
120
  #define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg)))
121
121
  #elif defined(_MSC_VER)
122
122
  #define UPB_NOINLINE
123
- #define UPB_FORCEINLINE
123
+ #define UPB_FORCEINLINE static
124
124
  #define UPB_NORETURN __declspec(noreturn)
125
125
  #define UPB_PRINTF(str, first_vararg)
126
126
  #else /* !defined(__GNUC__) */
127
- #define UPB_FORCEINLINE
127
+ #define UPB_FORCEINLINE static
128
128
  #define UPB_NOINLINE
129
129
  #define UPB_NORETURN
130
130
  #define UPB_PRINTF(str, first_vararg)
@@ -306,10 +306,10 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
306
306
 
307
307
  /* Disable proto2 arena behavior (TEMPORARY) **********************************/
308
308
 
309
- #ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING
310
- #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1
309
+ #ifdef UPB_DISABLE_CLOSED_ENUM_CHECKING
310
+ #define UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN 1
311
311
  #else
312
- #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0
312
+ #define UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN 0
313
313
  #endif
314
314
 
315
315
  #if defined(__cplusplus)
@@ -342,6 +342,12 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
342
342
  #define UPB_DESC_MINITABLE(sym) &google__protobuf__##sym##_msg_init
343
343
  #endif
344
344
 
345
+ #ifdef UPB_TRACING_ENABLED
346
+ #ifdef NDEBUG
347
+ error UPB_TRACING_ENABLED Tracing should be disabled in production builds
348
+ #endif
349
+ #endif
350
+
345
351
  #ifndef UPB_BASE_STATUS_H_
346
352
  #define UPB_BASE_STATUS_H_
347
353
 
@@ -556,7 +562,7 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
556
562
  }
557
563
 
558
564
  // LINT.ThenChange(
559
- // GoogleInternalName0,
565
+ // GoogleInternalName1,
560
566
  // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string,
561
567
  // //depot/google3/third_party/upb/bits/typescript/string_view.ts
562
568
  // )
@@ -691,12 +697,16 @@ void UPB_PRIVATE(_upb_Arena_SwapIn)(struct upb_Arena* des,
691
697
  void UPB_PRIVATE(_upb_Arena_SwapOut)(struct upb_Arena* des,
692
698
  const struct upb_Arena* src);
693
699
 
700
+ // Returns whether |ptr| was allocated directly by |a| (so care must be used
701
+ // with fused arenas).
702
+ UPB_API bool UPB_ONLYBITS(_upb_Arena_Contains)(const struct upb_Arena* a,
703
+ void* ptr);
704
+
694
705
  UPB_INLINE size_t UPB_PRIVATE(_upb_ArenaHas)(const struct upb_Arena* a) {
695
706
  return (size_t)(a->UPB_ONLYBITS(end) - a->UPB_ONLYBITS(ptr));
696
707
  }
697
708
 
698
- UPB_INLINE void* UPB_PRIVATE(_upb_Arena_Malloc)(struct upb_Arena* a,
699
- size_t size) {
709
+ UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) {
700
710
  void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(struct upb_Arena * a, size_t size);
701
711
 
702
712
  size = UPB_ALIGN_MALLOC(size);
@@ -716,8 +726,8 @@ UPB_INLINE void* UPB_PRIVATE(_upb_Arena_Malloc)(struct upb_Arena* a,
716
726
  return ret;
717
727
  }
718
728
 
719
- UPB_INLINE void* UPB_PRIVATE(_upb_Arena_Realloc)(struct upb_Arena* a, void* ptr,
720
- size_t oldsize, size_t size) {
729
+ UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr,
730
+ size_t oldsize, size_t size) {
721
731
  oldsize = UPB_ALIGN_MALLOC(oldsize);
722
732
  size = UPB_ALIGN_MALLOC(size);
723
733
  bool is_most_recent_alloc =
@@ -733,7 +743,7 @@ UPB_INLINE void* UPB_PRIVATE(_upb_Arena_Realloc)(struct upb_Arena* a, void* ptr,
733
743
  return ptr;
734
744
  }
735
745
 
736
- void* ret = UPB_PRIVATE(_upb_Arena_Malloc)(a, size);
746
+ void* ret = upb_Arena_Malloc(a, size);
737
747
 
738
748
  if (ret && oldsize > 0) {
739
749
  memcpy(ret, ptr, UPB_MIN(oldsize, size));
@@ -742,9 +752,8 @@ UPB_INLINE void* UPB_PRIVATE(_upb_Arena_Realloc)(struct upb_Arena* a, void* ptr,
742
752
  return ret;
743
753
  }
744
754
 
745
- UPB_INLINE void UPB_PRIVATE(_upb_Arena_ShrinkLast)(struct upb_Arena* a,
746
- void* ptr, size_t oldsize,
747
- size_t size) {
755
+ UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr,
756
+ size_t oldsize, size_t size) {
748
757
  oldsize = UPB_ALIGN_MALLOC(oldsize);
749
758
  size = UPB_ALIGN_MALLOC(size);
750
759
  // Must be the last alloc.
@@ -787,23 +796,25 @@ UPB_API_INLINE upb_Arena* upb_Arena_New(void) {
787
796
  return upb_Arena_Init(NULL, 0, &upb_alloc_global);
788
797
  }
789
798
 
790
- UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) {
791
- return UPB_PRIVATE(_upb_Arena_Malloc)(a, size);
792
- }
799
+ UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size);
793
800
 
794
801
  UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
795
- size_t size) {
796
- return UPB_PRIVATE(_upb_Arena_Realloc)(a, ptr, oldsize, size);
797
- }
802
+ size_t size);
798
803
 
799
804
  // Shrinks the last alloc from arena.
800
805
  // REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena.
801
806
  // We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if
802
807
  // this was not the last alloc.
803
808
  UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
804
- size_t oldsize, size_t size) {
805
- UPB_PRIVATE(_upb_Arena_ShrinkLast)(a, ptr, oldsize, size);
806
- }
809
+ size_t oldsize, size_t size);
810
+
811
+ #ifdef UPB_TRACING_ENABLED
812
+ void upb_Arena_SetTraceHandler(void (*initArenaTraceHandler)(const upb_Arena*,
813
+ size_t size),
814
+ void (*fuseArenaTraceHandler)(const upb_Arena*,
815
+ const upb_Arena*),
816
+ void (*freeArenaTraceHandler)(const upb_Arena*));
817
+ #endif
807
818
 
808
819
  #ifdef __cplusplus
809
820
  } /* extern "C" */
@@ -835,7 +846,8 @@ UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
835
846
  extern "C" {
836
847
  #endif
837
848
 
838
- // LINT.IfChange(struct_definition)
849
+ // LINT.IfChange(upb_Array)
850
+
839
851
  // Our internal representation for repeated fields.
840
852
  struct upb_Array {
841
853
  // This is a tagged pointer. Bits #0 and #1 encode the elem size as follows:
@@ -844,13 +856,21 @@ struct upb_Array {
844
856
  // 2 maps to elem size 8
845
857
  // 3 maps to elem size 16
846
858
  //
847
- // Bit #2 contains the frozen/immutable flag (currently unimplemented).
859
+ // Bit #2 contains the frozen/immutable flag.
848
860
  uintptr_t UPB_ONLYBITS(data);
849
861
 
850
862
  size_t UPB_ONLYBITS(size); // The number of elements in the array.
851
863
  size_t UPB_PRIVATE(capacity); // Allocated storage. Measured in elements.
852
864
  };
853
865
 
866
+ UPB_INLINE void UPB_PRIVATE(_upb_Array_ShallowFreeze)(struct upb_Array* arr) {
867
+ arr->UPB_ONLYBITS(data) |= _UPB_ARRAY_MASK_IMM;
868
+ }
869
+
870
+ UPB_API_INLINE bool upb_Array_IsFrozen(const struct upb_Array* arr) {
871
+ return (arr->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_IMM) != 0;
872
+ }
873
+
854
874
  UPB_INLINE void UPB_PRIVATE(_upb_Array_SetTaggedPtr)(struct upb_Array* array,
855
875
  void* data, size_t lg2) {
856
876
  UPB_ASSERT(lg2 != 1);
@@ -866,15 +886,13 @@ UPB_PRIVATE(_upb_Array_ElemSizeLg2)(const struct upb_Array* array) {
866
886
  return lg2;
867
887
  }
868
888
 
869
- UPB_INLINE const void* UPB_PRIVATE(_upb_Array_DataPtr)(
870
- const struct upb_Array* array) {
889
+ UPB_API_INLINE const void* upb_Array_DataPtr(const struct upb_Array* array) {
871
890
  UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array); // Check assertions.
872
891
  return (void*)(array->UPB_ONLYBITS(data) & ~(uintptr_t)_UPB_ARRAY_MASK_ALL);
873
892
  }
874
893
 
875
- UPB_INLINE void* UPB_PRIVATE(_upb_Array_MutableDataPtr)(
876
- struct upb_Array* array) {
877
- return (void*)UPB_PRIVATE(_upb_Array_DataPtr)(array);
894
+ UPB_API_INLINE void* upb_Array_MutableDataPtr(struct upb_Array* array) {
895
+ return (void*)upb_Array_DataPtr(array);
878
896
  }
879
897
 
880
898
  UPB_INLINE struct upb_Array* UPB_PRIVATE(_upb_Array_New)(upb_Arena* arena,
@@ -898,8 +916,9 @@ UPB_INLINE struct upb_Array* UPB_PRIVATE(_upb_Array_New)(upb_Arena* arena,
898
916
  bool UPB_PRIVATE(_upb_Array_Realloc)(struct upb_Array* array, size_t min_size,
899
917
  upb_Arena* arena);
900
918
 
901
- UPB_INLINE bool UPB_PRIVATE(_upb_Array_Reserve)(struct upb_Array* array,
902
- size_t size, upb_Arena* arena) {
919
+ UPB_API_INLINE bool upb_Array_Reserve(struct upb_Array* array, size_t size,
920
+ upb_Arena* arena) {
921
+ UPB_ASSERT(!upb_Array_IsFrozen(array));
903
922
  if (array->UPB_PRIVATE(capacity) < size)
904
923
  return UPB_PRIVATE(_upb_Array_Realloc)(array, size, arena);
905
924
  return true;
@@ -908,9 +927,10 @@ UPB_INLINE bool UPB_PRIVATE(_upb_Array_Reserve)(struct upb_Array* array,
908
927
  // Resize without initializing new elements.
909
928
  UPB_INLINE bool UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
910
929
  struct upb_Array* array, size_t size, upb_Arena* arena) {
930
+ UPB_ASSERT(!upb_Array_IsFrozen(array));
911
931
  UPB_ASSERT(size <= array->UPB_ONLYBITS(size) ||
912
932
  arena); // Allow NULL arena when shrinking.
913
- if (!UPB_PRIVATE(_upb_Array_Reserve)(array, size, arena)) return false;
933
+ if (!upb_Array_Reserve(array, size, arena)) return false;
914
934
  array->UPB_ONLYBITS(size) = size;
915
935
  return true;
916
936
  }
@@ -921,19 +941,18 @@ UPB_INLINE bool UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
921
941
  UPB_INLINE void UPB_PRIVATE(_upb_Array_Set)(struct upb_Array* array, size_t i,
922
942
  const void* data,
923
943
  size_t elem_size) {
944
+ UPB_ASSERT(!upb_Array_IsFrozen(array));
924
945
  UPB_ASSERT(i < array->UPB_ONLYBITS(size));
925
946
  UPB_ASSERT(elem_size == 1U << UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array));
926
- char* arr_data = (char*)UPB_PRIVATE(_upb_Array_MutableDataPtr)(array);
947
+ char* arr_data = (char*)upb_Array_MutableDataPtr(array);
927
948
  memcpy(arr_data + (i * elem_size), data, elem_size);
928
949
  }
929
950
 
930
- UPB_INLINE size_t UPB_PRIVATE(_upb_Array_Size)(const struct upb_Array* arr) {
951
+ UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) {
931
952
  return arr->UPB_ONLYBITS(size);
932
953
  }
933
954
 
934
- // LINT.ThenChange(
935
- // GoogleInternalName1,
936
- //)
955
+ // LINT.ThenChange(GoogleInternalName0)
937
956
 
938
957
  #ifdef __cplusplus
939
958
  } /* extern "C" */
@@ -983,218 +1002,6 @@ typedef union {
983
1002
 
984
1003
  #endif /* UPB_MESSAGE_VALUE_H_ */
985
1004
 
986
- // Must be last.
987
-
988
- typedef struct upb_Array upb_Array;
989
-
990
- #ifdef __cplusplus
991
- extern "C" {
992
- #endif
993
-
994
- // Creates a new array on the given arena that holds elements of this type.
995
- UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type);
996
-
997
- // Returns the number of elements in the array.
998
- UPB_API_INLINE size_t upb_Array_Size(const upb_Array* arr) {
999
- return UPB_PRIVATE(_upb_Array_Size)(arr);
1000
- }
1001
-
1002
- // Returns the given element, which must be within the array's current size.
1003
- UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i);
1004
-
1005
- // Returns a mutating pointer to the given element, which must be within the
1006
- // array's current size.
1007
- UPB_API upb_MutableMessageValue upb_Array_GetMutable(upb_Array* arr, size_t i);
1008
-
1009
- // Sets the given element, which must be within the array's current size.
1010
- UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);
1011
-
1012
- // Appends an element to the array. Returns false on allocation failure.
1013
- UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val,
1014
- upb_Arena* arena);
1015
-
1016
- // Moves elements within the array using memmove().
1017
- // Like memmove(), the source and destination elements may be overlapping.
1018
- UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx,
1019
- size_t count);
1020
-
1021
- // Inserts one or more empty elements into the array.
1022
- // Existing elements are shifted right.
1023
- // The new elements have undefined state and must be set with `upb_Array_Set()`.
1024
- // REQUIRES: `i <= upb_Array_Size(arr)`
1025
- UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count,
1026
- upb_Arena* arena);
1027
-
1028
- // Deletes one or more elements from the array.
1029
- // Existing elements are shifted left.
1030
- // REQUIRES: `i + count <= upb_Array_Size(arr)`
1031
- UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count);
1032
-
1033
- // Changes the size of a vector. New elements are initialized to NULL/0.
1034
- // Returns false on allocation failure.
1035
- UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena);
1036
-
1037
- // Returns pointer to array data.
1038
- UPB_API_INLINE const void* upb_Array_DataPtr(const upb_Array* arr) {
1039
- return UPB_PRIVATE(_upb_Array_DataPtr)(arr);
1040
- }
1041
-
1042
- // Returns mutable pointer to array data.
1043
- UPB_API_INLINE void* upb_Array_MutableDataPtr(upb_Array* arr) {
1044
- return UPB_PRIVATE(_upb_Array_MutableDataPtr)(arr);
1045
- }
1046
-
1047
- #ifdef __cplusplus
1048
- } /* extern "C" */
1049
- #endif
1050
-
1051
-
1052
- #endif /* UPB_MESSAGE_ARRAY_H_ */
1053
-
1054
- #ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
1055
- #define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
1056
-
1057
- #include <stddef.h>
1058
- #include <stdint.h>
1059
- #include <string.h>
1060
-
1061
-
1062
- #ifndef UPB_BASE_INTERNAL_ENDIAN_H_
1063
- #define UPB_BASE_INTERNAL_ENDIAN_H_
1064
-
1065
- #include <stdint.h>
1066
-
1067
- // Must be last.
1068
-
1069
- #ifdef __cplusplus
1070
- extern "C" {
1071
- #endif
1072
-
1073
- UPB_INLINE bool upb_IsLittleEndian(void) {
1074
- const int x = 1;
1075
- return *(char*)&x == 1;
1076
- }
1077
-
1078
- UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) {
1079
- if (upb_IsLittleEndian()) return val;
1080
-
1081
- return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
1082
- ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
1083
- }
1084
-
1085
- UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) {
1086
- if (upb_IsLittleEndian()) return val;
1087
-
1088
- const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32;
1089
- const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32));
1090
- return hi | lo;
1091
- }
1092
-
1093
- #ifdef __cplusplus
1094
- } /* extern "C" */
1095
- #endif
1096
-
1097
-
1098
- #endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */
1099
-
1100
- #ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
1101
- #define UPB_MESSAGE_INTERNAL_EXTENSION_H_
1102
-
1103
-
1104
- /*
1105
- ** Our memory representation for parsing tables and messages themselves.
1106
- ** Functions in this file are used by generated code and possibly reflection.
1107
- **
1108
- ** The definitions in this file are internal to upb.
1109
- **/
1110
-
1111
- #ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_
1112
- #define UPB_MESSAGE_INTERNAL_MESSAGE_H_
1113
-
1114
- #include <stdlib.h>
1115
- #include <string.h>
1116
-
1117
-
1118
- #ifndef UPB_MINI_TABLE_MESSAGE_H_
1119
- #define UPB_MINI_TABLE_MESSAGE_H_
1120
-
1121
-
1122
- #ifndef UPB_MINI_TABLE_ENUM_H_
1123
- #define UPB_MINI_TABLE_ENUM_H_
1124
-
1125
- #include <stdint.h>
1126
-
1127
-
1128
- #ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
1129
- #define UPB_MINI_TABLE_INTERNAL_ENUM_H_
1130
-
1131
- #include <stdint.h>
1132
-
1133
- // Must be last.
1134
-
1135
- struct upb_MiniTableEnum {
1136
- uint32_t UPB_PRIVATE(mask_limit); // Highest that can be tested with mask.
1137
- uint32_t UPB_PRIVATE(value_count); // Number of values after the bitfield.
1138
- uint32_t UPB_PRIVATE(data)[]; // Bitmask + enumerated values follow.
1139
- };
1140
-
1141
- #ifdef __cplusplus
1142
- extern "C" {
1143
- #endif
1144
-
1145
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableEnum_CheckValue)(
1146
- const struct upb_MiniTableEnum* e, uint32_t val) {
1147
- if (UPB_LIKELY(val < 64)) {
1148
- const uint64_t mask =
1149
- e->UPB_PRIVATE(data)[0] | ((uint64_t)e->UPB_PRIVATE(data)[1] << 32);
1150
- const uint64_t bit = 1ULL << val;
1151
- return (mask & bit) != 0;
1152
- }
1153
- if (UPB_LIKELY(val < e->UPB_PRIVATE(mask_limit))) {
1154
- const uint32_t mask = e->UPB_PRIVATE(data)[val / 32];
1155
- const uint32_t bit = 1ULL << (val % 32);
1156
- return (mask & bit) != 0;
1157
- }
1158
-
1159
- // OPT: binary search long lists?
1160
- const uint32_t* start =
1161
- &e->UPB_PRIVATE(data)[e->UPB_PRIVATE(mask_limit) / 32];
1162
- const uint32_t* limit = &e->UPB_PRIVATE(
1163
- data)[e->UPB_PRIVATE(mask_limit) / 32 + e->UPB_PRIVATE(value_count)];
1164
- for (const uint32_t* p = start; p < limit; p++) {
1165
- if (*p == val) return true;
1166
- }
1167
- return false;
1168
- }
1169
-
1170
- #ifdef __cplusplus
1171
- } /* extern "C" */
1172
- #endif
1173
-
1174
-
1175
- #endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */
1176
-
1177
- // Must be last
1178
-
1179
- typedef struct upb_MiniTableEnum upb_MiniTableEnum;
1180
-
1181
- #ifdef __cplusplus
1182
- extern "C" {
1183
- #endif
1184
-
1185
- // Validates enum value against range defined by enum mini table.
1186
- UPB_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e,
1187
- uint32_t val) {
1188
- return UPB_PRIVATE(_upb_MiniTableEnum_CheckValue)(e, val);
1189
- }
1190
-
1191
- #ifdef __cplusplus
1192
- } /* extern "C" */
1193
- #endif
1194
-
1195
-
1196
- #endif /* UPB_MINI_TABLE_ENUM_H_ */
1197
-
1198
1005
  #ifndef UPB_MINI_TABLE_FIELD_H_
1199
1006
  #define UPB_MINI_TABLE_FIELD_H_
1200
1007
 
@@ -1293,7 +1100,7 @@ struct upb_MiniTableField {
1293
1100
  uint8_t UPB_ONLYBITS(mode);
1294
1101
  };
1295
1102
 
1296
- #define kUpb_NoSub ((uint16_t)-1)
1103
+ #define kUpb_NoSub ((uint16_t) - 1)
1297
1104
 
1298
1105
  typedef enum {
1299
1106
  kUpb_FieldMode_Map = 0,
@@ -1344,17 +1151,17 @@ UPB_PRIVATE(_upb_MiniTableField_GetRep)(const struct upb_MiniTableField* f) {
1344
1151
  return (upb_FieldRep)(f->UPB_ONLYBITS(mode) >> kUpb_FieldRep_Shift);
1345
1152
  }
1346
1153
 
1347
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsArray)(
1154
+ UPB_API_INLINE bool upb_MiniTableField_IsArray(
1348
1155
  const struct upb_MiniTableField* f) {
1349
1156
  return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Array;
1350
1157
  }
1351
1158
 
1352
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsMap)(
1159
+ UPB_API_INLINE bool upb_MiniTableField_IsMap(
1353
1160
  const struct upb_MiniTableField* f) {
1354
1161
  return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Map;
1355
1162
  }
1356
1163
 
1357
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsScalar)(
1164
+ UPB_API_INLINE bool upb_MiniTableField_IsScalar(
1358
1165
  const struct upb_MiniTableField* f) {
1359
1166
  return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Scalar;
1360
1167
  }
@@ -1364,18 +1171,18 @@ UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsAlternate)(
1364
1171
  return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsAlternate) != 0;
1365
1172
  }
1366
1173
 
1367
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsExtension)(
1174
+ UPB_API_INLINE bool upb_MiniTableField_IsExtension(
1368
1175
  const struct upb_MiniTableField* f) {
1369
1176
  return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsExtension) != 0;
1370
1177
  }
1371
1178
 
1372
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsPacked)(
1179
+ UPB_API_INLINE bool upb_MiniTableField_IsPacked(
1373
1180
  const struct upb_MiniTableField* f) {
1374
1181
  return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsPacked) != 0;
1375
1182
  }
1376
1183
 
1377
- UPB_INLINE upb_FieldType
1378
- UPB_PRIVATE(_upb_MiniTableField_Type)(const struct upb_MiniTableField* f) {
1184
+ UPB_API_INLINE upb_FieldType
1185
+ upb_MiniTableField_Type(const struct upb_MiniTableField* f) {
1379
1186
  const upb_FieldType type = (upb_FieldType)f->UPB_PRIVATE(descriptortype);
1380
1187
  if (UPB_PRIVATE(_upb_MiniTableField_IsAlternate)(f)) {
1381
1188
  if (type == kUpb_FieldType_Int32) return kUpb_FieldType_Enum;
@@ -1385,9 +1192,9 @@ UPB_PRIVATE(_upb_MiniTableField_Type)(const struct upb_MiniTableField* f) {
1385
1192
  return type;
1386
1193
  }
1387
1194
 
1388
- UPB_INLINE upb_CType
1389
- UPB_PRIVATE(_upb_MiniTableField_CType)(const struct upb_MiniTableField* f) {
1390
- return upb_FieldType_CType(UPB_PRIVATE(_upb_MiniTableField_Type)(f));
1195
+ UPB_API_INLINE
1196
+ upb_CType upb_MiniTableField_CType(const struct upb_MiniTableField* f) {
1197
+ return upb_FieldType_CType(upb_MiniTableField_Type(f));
1391
1198
  }
1392
1199
 
1393
1200
  UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(
@@ -1409,33 +1216,33 @@ UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(
1409
1216
  return index / 8;
1410
1217
  }
1411
1218
 
1412
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsClosedEnum)(
1219
+ UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
1413
1220
  const struct upb_MiniTableField* f) {
1414
1221
  return f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum;
1415
1222
  }
1416
1223
 
1417
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsInOneof)(
1224
+ UPB_API_INLINE bool upb_MiniTableField_IsInOneof(
1418
1225
  const struct upb_MiniTableField* f) {
1419
1226
  return f->presence < 0;
1420
1227
  }
1421
1228
 
1422
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsSubMessage)(
1229
+ UPB_API_INLINE bool upb_MiniTableField_IsSubMessage(
1423
1230
  const struct upb_MiniTableField* f) {
1424
1231
  return f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message ||
1425
1232
  f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group;
1426
1233
  }
1427
1234
 
1428
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_HasPresence)(
1235
+ UPB_API_INLINE bool upb_MiniTableField_HasPresence(
1429
1236
  const struct upb_MiniTableField* f) {
1430
- if (UPB_PRIVATE(_upb_MiniTableField_IsExtension)(f)) {
1431
- return UPB_PRIVATE(_upb_MiniTableField_IsScalar)(f);
1237
+ if (upb_MiniTableField_IsExtension(f)) {
1238
+ return upb_MiniTableField_IsScalar(f);
1432
1239
  } else {
1433
1240
  return f->presence != 0;
1434
1241
  }
1435
1242
  }
1436
1243
 
1437
- UPB_INLINE uint32_t
1438
- UPB_PRIVATE(_upb_MiniTableField_Number)(const struct upb_MiniTableField* f) {
1244
+ UPB_API_INLINE uint32_t
1245
+ upb_MiniTableField_Number(const struct upb_MiniTableField* f) {
1439
1246
  return f->UPB_ONLYBITS(number);
1440
1247
  }
1441
1248
 
@@ -1446,7 +1253,7 @@ UPB_PRIVATE(_upb_MiniTableField_Offset)(const struct upb_MiniTableField* f) {
1446
1253
 
1447
1254
  UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_OneofOffset)(
1448
1255
  const struct upb_MiniTableField* f) {
1449
- UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_IsInOneof)(f));
1256
+ UPB_ASSERT(upb_MiniTableField_IsInOneof(f));
1450
1257
  return ~(ptrdiff_t)f->presence;
1451
1258
  }
1452
1259
 
@@ -1454,7 +1261,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(
1454
1261
  const struct upb_MiniTableField* f) {
1455
1262
  UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(f) ==
1456
1263
  kUpb_FieldRep_NativePointer);
1457
- UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_IsArray)(f));
1264
+ UPB_ASSUME(upb_MiniTableField_IsArray(f));
1458
1265
  UPB_ASSUME(f->presence == 0);
1459
1266
  }
1460
1267
 
@@ -1462,13 +1269,13 @@ UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(
1462
1269
  const struct upb_MiniTableField* f) {
1463
1270
  UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(f) ==
1464
1271
  kUpb_FieldRep_NativePointer);
1465
- UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_IsMap)(f));
1272
+ UPB_ASSUME(upb_MiniTableField_IsMap(f));
1466
1273
  UPB_ASSUME(f->presence == 0);
1467
1274
  }
1468
1275
 
1469
1276
  UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_ElemSizeLg2)(
1470
1277
  const struct upb_MiniTableField* f) {
1471
- const upb_FieldType field_type = UPB_PRIVATE(_upb_MiniTableField_Type)(f);
1278
+ const upb_FieldType field_type = upb_MiniTableField_Type(f);
1472
1279
  return UPB_PRIVATE(_upb_FieldType_SizeLg2)(field_type);
1473
1280
  }
1474
1281
 
@@ -1489,58 +1296,32 @@ typedef struct upb_MiniTableField upb_MiniTableField;
1489
1296
  extern "C" {
1490
1297
  #endif
1491
1298
 
1492
- UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) {
1493
- return UPB_PRIVATE(_upb_MiniTableField_CType)(f);
1494
- }
1299
+ UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f);
1495
1300
 
1496
- UPB_API_INLINE bool upb_MiniTableField_HasPresence(
1497
- const upb_MiniTableField* f) {
1498
- return UPB_PRIVATE(_upb_MiniTableField_HasPresence)(f);
1499
- }
1301
+ UPB_API_INLINE bool upb_MiniTableField_HasPresence(const upb_MiniTableField* f);
1500
1302
 
1501
- UPB_API_INLINE bool upb_MiniTableField_IsArray(const upb_MiniTableField* f) {
1502
- return UPB_PRIVATE(_upb_MiniTableField_IsArray)(f);
1503
- }
1303
+ UPB_API_INLINE bool upb_MiniTableField_IsArray(const upb_MiniTableField* f);
1504
1304
 
1505
1305
  UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
1506
- const upb_MiniTableField* f) {
1507
- return UPB_PRIVATE(_upb_MiniTableField_IsClosedEnum)(f);
1508
- }
1306
+ const upb_MiniTableField* f);
1509
1307
 
1510
- UPB_API_INLINE bool upb_MiniTableField_IsExtension(
1511
- const upb_MiniTableField* f) {
1512
- return UPB_PRIVATE(_upb_MiniTableField_IsExtension)(f);
1513
- }
1308
+ UPB_API_INLINE bool upb_MiniTableField_IsExtension(const upb_MiniTableField* f);
1514
1309
 
1515
- UPB_API_INLINE bool upb_MiniTableField_IsInOneof(const upb_MiniTableField* f) {
1516
- return UPB_PRIVATE(_upb_MiniTableField_IsInOneof)(f);
1517
- }
1310
+ UPB_API_INLINE bool upb_MiniTableField_IsInOneof(const upb_MiniTableField* f);
1518
1311
 
1519
- UPB_API_INLINE bool upb_MiniTableField_IsMap(const upb_MiniTableField* f) {
1520
- return UPB_PRIVATE(_upb_MiniTableField_IsMap)(f);
1521
- }
1312
+ UPB_API_INLINE bool upb_MiniTableField_IsMap(const upb_MiniTableField* f);
1522
1313
 
1523
- UPB_API_INLINE bool upb_MiniTableField_IsPacked(const upb_MiniTableField* f) {
1524
- return UPB_PRIVATE(_upb_MiniTableField_IsPacked)(f);
1525
- }
1314
+ UPB_API_INLINE bool upb_MiniTableField_IsPacked(const upb_MiniTableField* f);
1526
1315
 
1527
- UPB_API_INLINE bool upb_MiniTableField_IsScalar(const upb_MiniTableField* f) {
1528
- return UPB_PRIVATE(_upb_MiniTableField_IsScalar)(f);
1529
- }
1316
+ UPB_API_INLINE bool upb_MiniTableField_IsScalar(const upb_MiniTableField* f);
1530
1317
 
1531
1318
  UPB_API_INLINE bool upb_MiniTableField_IsSubMessage(
1532
- const upb_MiniTableField* f) {
1533
- return UPB_PRIVATE(_upb_MiniTableField_IsSubMessage)(f);
1534
- }
1319
+ const upb_MiniTableField* f);
1535
1320
 
1536
- UPB_API_INLINE uint32_t upb_MiniTableField_Number(const upb_MiniTableField* f) {
1537
- return UPB_PRIVATE(_upb_MiniTableField_Number)(f);
1538
- }
1321
+ UPB_API_INLINE uint32_t upb_MiniTableField_Number(const upb_MiniTableField* f);
1539
1322
 
1540
1323
  UPB_API_INLINE upb_FieldType
1541
- upb_MiniTableField_Type(const upb_MiniTableField* f) {
1542
- return UPB_PRIVATE(_upb_MiniTableField_Type)(f);
1543
- }
1324
+ upb_MiniTableField_Type(const upb_MiniTableField* f);
1544
1325
 
1545
1326
  #ifdef __cplusplus
1546
1327
  } /* extern "C" */
@@ -1549,14 +1330,92 @@ upb_MiniTableField_Type(const upb_MiniTableField* f) {
1549
1330
 
1550
1331
  #endif /* UPB_MINI_TABLE_FIELD_H_ */
1551
1332
 
1552
- #ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1553
- #define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1333
+ #ifndef UPB_MINI_TABLE_MESSAGE_H_
1334
+ #define UPB_MINI_TABLE_MESSAGE_H_
1554
1335
 
1555
- #include <stdint.h>
1556
1336
 
1337
+ #ifndef UPB_MINI_TABLE_ENUM_H_
1338
+ #define UPB_MINI_TABLE_ENUM_H_
1557
1339
 
1558
- #ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_
1559
- #define UPB_MINI_TABLE_INTERNAL_SUB_H_
1340
+ #include <stdint.h>
1341
+
1342
+
1343
+ #ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
1344
+ #define UPB_MINI_TABLE_INTERNAL_ENUM_H_
1345
+
1346
+ #include <stdint.h>
1347
+
1348
+ // Must be last.
1349
+
1350
+ struct upb_MiniTableEnum {
1351
+ uint32_t UPB_PRIVATE(mask_limit); // Highest that can be tested with mask.
1352
+ uint32_t UPB_PRIVATE(value_count); // Number of values after the bitfield.
1353
+ uint32_t UPB_PRIVATE(data)[]; // Bitmask + enumerated values follow.
1354
+ };
1355
+
1356
+ #ifdef __cplusplus
1357
+ extern "C" {
1358
+ #endif
1359
+
1360
+ UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(
1361
+ const struct upb_MiniTableEnum* e, uint32_t val) {
1362
+ if (UPB_LIKELY(val < 64)) {
1363
+ const uint64_t mask =
1364
+ e->UPB_PRIVATE(data)[0] | ((uint64_t)e->UPB_PRIVATE(data)[1] << 32);
1365
+ const uint64_t bit = 1ULL << val;
1366
+ return (mask & bit) != 0;
1367
+ }
1368
+ if (UPB_LIKELY(val < e->UPB_PRIVATE(mask_limit))) {
1369
+ const uint32_t mask = e->UPB_PRIVATE(data)[val / 32];
1370
+ const uint32_t bit = 1ULL << (val % 32);
1371
+ return (mask & bit) != 0;
1372
+ }
1373
+
1374
+ // OPT: binary search long lists?
1375
+ const uint32_t* start =
1376
+ &e->UPB_PRIVATE(data)[e->UPB_PRIVATE(mask_limit) / 32];
1377
+ const uint32_t* limit = &e->UPB_PRIVATE(
1378
+ data)[e->UPB_PRIVATE(mask_limit) / 32 + e->UPB_PRIVATE(value_count)];
1379
+ for (const uint32_t* p = start; p < limit; p++) {
1380
+ if (*p == val) return true;
1381
+ }
1382
+ return false;
1383
+ }
1384
+
1385
+ #ifdef __cplusplus
1386
+ } /* extern "C" */
1387
+ #endif
1388
+
1389
+
1390
+ #endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */
1391
+
1392
+ // Must be last
1393
+
1394
+ typedef struct upb_MiniTableEnum upb_MiniTableEnum;
1395
+
1396
+ #ifdef __cplusplus
1397
+ extern "C" {
1398
+ #endif
1399
+
1400
+ // Validates enum value against range defined by enum mini table.
1401
+ UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e,
1402
+ uint32_t val);
1403
+
1404
+ #ifdef __cplusplus
1405
+ } /* extern "C" */
1406
+ #endif
1407
+
1408
+
1409
+ #endif /* UPB_MINI_TABLE_ENUM_H_ */
1410
+
1411
+ #ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1412
+ #define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1413
+
1414
+ #include <stdint.h>
1415
+
1416
+
1417
+ #ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_
1418
+ #define UPB_MINI_TABLE_INTERNAL_SUB_H_
1560
1419
 
1561
1420
  // Must be last.
1562
1421
 
@@ -1569,26 +1428,26 @@ union upb_MiniTableSub {
1569
1428
  extern "C" {
1570
1429
  #endif
1571
1430
 
1572
- UPB_INLINE union upb_MiniTableSub UPB_PRIVATE(_upb_MiniTableSub_FromEnum)(
1431
+ UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromEnum(
1573
1432
  const struct upb_MiniTableEnum* subenum) {
1574
1433
  union upb_MiniTableSub out;
1575
1434
  out.UPB_PRIVATE(subenum) = subenum;
1576
1435
  return out;
1577
1436
  }
1578
1437
 
1579
- UPB_INLINE union upb_MiniTableSub UPB_PRIVATE(_upb_MiniTableSub_FromMessage)(
1438
+ UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromMessage(
1580
1439
  const struct upb_MiniTable* submsg) {
1581
1440
  union upb_MiniTableSub out;
1582
1441
  out.UPB_PRIVATE(submsg) = submsg;
1583
1442
  return out;
1584
1443
  }
1585
1444
 
1586
- UPB_INLINE const struct upb_MiniTableEnum* UPB_PRIVATE(_upb_MiniTableSub_Enum)(
1445
+ UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableSub_Enum(
1587
1446
  const union upb_MiniTableSub sub) {
1588
1447
  return sub.UPB_PRIVATE(subenum);
1589
1448
  }
1590
1449
 
1591
- UPB_INLINE const struct upb_MiniTable* UPB_PRIVATE(_upb_MiniTableSub_Message)(
1450
+ UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableSub_Message(
1592
1451
  const union upb_MiniTableSub sub) {
1593
1452
  return sub.UPB_PRIVATE(submsg);
1594
1453
  }
@@ -1644,10 +1503,16 @@ struct upb_MiniTable {
1644
1503
  uint8_t UPB_PRIVATE(table_mask);
1645
1504
  uint8_t UPB_PRIVATE(required_count); // Required fields have the low hasbits.
1646
1505
 
1506
+ #ifdef UPB_TRACING_ENABLED
1507
+ const char* UPB_PRIVATE(full_name);
1508
+ #endif
1509
+
1510
+ #ifdef UPB_FASTTABLE_ENABLED
1647
1511
  // To statically initialize the tables of variable length, we need a flexible
1648
1512
  // array member, and we need to compile in gnu99 mode (constant initialization
1649
1513
  // of flexible array members is a GNU extension, not in C99 unfortunately.
1650
1514
  _upb_FastTable_Entry UPB_PRIVATE(fasttable)[];
1515
+ #endif
1651
1516
  };
1652
1517
  // LINT.ThenChange(//depot/google3/third_party/upb/bits/typescript/mini_table.ts)
1653
1518
 
@@ -1661,8 +1526,7 @@ UPB_INLINE const struct upb_MiniTable* UPB_PRIVATE(_upb_MiniTable_Empty)(void) {
1661
1526
  return &UPB_PRIVATE(_kUpb_MiniTable_Empty);
1662
1527
  }
1663
1528
 
1664
- UPB_INLINE int UPB_PRIVATE(_upb_MiniTable_FieldCount)(
1665
- const struct upb_MiniTable* m) {
1529
+ UPB_API_INLINE int upb_MiniTable_FieldCount(const struct upb_MiniTable* m) {
1666
1530
  return m->UPB_ONLYBITS(field_count);
1667
1531
  }
1668
1532
 
@@ -1673,8 +1537,8 @@ UPB_INLINE bool UPB_PRIVATE(_upb_MiniTable_IsEmpty)(
1673
1537
  return m == &UPB_PRIVATE(_kUpb_MiniTable_Empty);
1674
1538
  }
1675
1539
 
1676
- UPB_INLINE const struct upb_MiniTableField* UPB_PRIVATE(
1677
- _upb_MiniTable_GetFieldByIndex)(const struct upb_MiniTable* m, uint32_t i) {
1540
+ UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
1541
+ const struct upb_MiniTable* m, uint32_t i) {
1678
1542
  return &m->UPB_ONLYBITS(fields)[i];
1679
1543
  }
1680
1544
 
@@ -1683,45 +1547,50 @@ UPB_INLINE const union upb_MiniTableSub* UPB_PRIVATE(
1683
1547
  return &m->UPB_PRIVATE(subs)[i];
1684
1548
  }
1685
1549
 
1686
- UPB_INLINE const struct upb_MiniTable* UPB_PRIVATE(
1687
- _upb_MiniTable_GetSubMessageTable)(const struct upb_MiniTable* m,
1688
- const struct upb_MiniTableField* f) {
1689
- UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_CType)(f) == kUpb_CType_Message);
1690
- const struct upb_MiniTable* ret = UPB_PRIVATE(_upb_MiniTableSub_Message)(
1550
+ UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_GetSubMessageTable(
1551
+ const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
1552
+ UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Message);
1553
+ const struct upb_MiniTable* ret = upb_MiniTableSub_Message(
1691
1554
  m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1692
1555
  UPB_ASSUME(ret);
1693
1556
  return UPB_PRIVATE(_upb_MiniTable_IsEmpty)(ret) ? NULL : ret;
1694
1557
  }
1695
1558
 
1696
- UPB_INLINE const struct upb_MiniTableEnum* UPB_PRIVATE(
1697
- _upb_MiniTable_GetSubEnumTable)(const struct upb_MiniTable* m,
1698
- const struct upb_MiniTableField* f) {
1699
- UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_CType)(f) == kUpb_CType_Enum);
1700
- return UPB_PRIVATE(_upb_MiniTableSub_Enum)(
1559
+ UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_SubMessage(
1560
+ const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
1561
+ if (upb_MiniTableField_CType(f) != kUpb_CType_Message) {
1562
+ return NULL;
1563
+ }
1564
+ return upb_MiniTableSub_Message(
1701
1565
  m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1702
1566
  }
1703
1567
 
1704
- UPB_INLINE const struct upb_MiniTableField* UPB_PRIVATE(_upb_MiniTable_MapKey)(
1568
+ UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
1569
+ const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
1570
+ UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Enum);
1571
+ return upb_MiniTableSub_Enum(
1572
+ m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1573
+ }
1574
+
1575
+ UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapKey(
1705
1576
  const struct upb_MiniTable* m) {
1706
- UPB_ASSERT(UPB_PRIVATE(_upb_MiniTable_FieldCount)(m) == 2);
1707
- const struct upb_MiniTableField* f =
1708
- UPB_PRIVATE(_upb_MiniTable_GetFieldByIndex)(m, 0);
1709
- UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_Number)(f) == 1);
1577
+ UPB_ASSERT(upb_MiniTable_FieldCount(m) == 2);
1578
+ const struct upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, 0);
1579
+ UPB_ASSERT(upb_MiniTableField_Number(f) == 1);
1710
1580
  return f;
1711
1581
  }
1712
1582
 
1713
- UPB_INLINE const struct upb_MiniTableField* UPB_PRIVATE(
1714
- _upb_MiniTable_MapValue)(const struct upb_MiniTable* m) {
1715
- UPB_ASSERT(UPB_PRIVATE(_upb_MiniTable_FieldCount)(m) == 2);
1716
- const struct upb_MiniTableField* f =
1717
- UPB_PRIVATE(_upb_MiniTable_GetFieldByIndex)(m, 1);
1718
- UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_Number)(f) == 2);
1583
+ UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapValue(
1584
+ const struct upb_MiniTable* m) {
1585
+ UPB_ASSERT(upb_MiniTable_FieldCount(m) == 2);
1586
+ const struct upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, 1);
1587
+ UPB_ASSERT(upb_MiniTableField_Number(f) == 2);
1719
1588
  return f;
1720
1589
  }
1721
1590
 
1722
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTable_MessageFieldIsLinked)(
1591
+ UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(
1723
1592
  const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
1724
- return UPB_PRIVATE(_upb_MiniTable_GetSubMessageTable)(m, f) != NULL;
1593
+ return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
1725
1594
  }
1726
1595
 
1727
1596
  // Computes a bitmask in which the |m->required_count| lowest bits are set.
@@ -1736,6 +1605,20 @@ UPB_PRIVATE(_upb_MiniTable_RequiredMask)(const struct upb_MiniTable* m) {
1736
1605
  return (1ULL << n) - 1;
1737
1606
  }
1738
1607
 
1608
+ #ifdef UPB_TRACING_ENABLED
1609
+ UPB_INLINE const char* upb_MiniTable_FullName(
1610
+ const struct upb_MiniTable* mini_table) {
1611
+ return mini_table->UPB_PRIVATE(full_name);
1612
+ }
1613
+ // Initializes tracing proto name from language runtimes that construct
1614
+ // mini tables dynamically at runtime. The runtime is responsible for passing
1615
+ // controlling lifetime of name such as storing in same arena as mini_table.
1616
+ UPB_INLINE void upb_MiniTable_SetFullName(struct upb_MiniTable* mini_table,
1617
+ const char* full_name) {
1618
+ mini_table->UPB_PRIVATE(full_name) = full_name;
1619
+ }
1620
+ #endif
1621
+
1739
1622
  #ifdef __cplusplus
1740
1623
  } /* extern "C" */
1741
1624
  #endif
@@ -1755,44 +1638,35 @@ UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
1755
1638
  const upb_MiniTable* m, uint32_t number);
1756
1639
 
1757
1640
  UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
1758
- const upb_MiniTable* m, uint32_t index) {
1759
- return UPB_PRIVATE(_upb_MiniTable_GetFieldByIndex)(m, index);
1760
- }
1641
+ const upb_MiniTable* m, uint32_t index);
1761
1642
 
1762
- UPB_API_INLINE int upb_MiniTable_FieldCount(const upb_MiniTable* m) {
1763
- return UPB_PRIVATE(_upb_MiniTable_FieldCount)(m);
1764
- }
1643
+ UPB_API_INLINE int upb_MiniTable_FieldCount(const upb_MiniTable* m);
1765
1644
 
1645
+ // DEPRECATED: use upb_MiniTable_SubMessage() instead
1766
1646
  // Returns the MiniTable for a message field, NULL if the field is unlinked.
1767
1647
  UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
1768
- const upb_MiniTable* m, const upb_MiniTableField* f) {
1769
- return UPB_PRIVATE(_upb_MiniTable_GetSubMessageTable)(m, f);
1770
- }
1648
+ const upb_MiniTable* m, const upb_MiniTableField* f);
1649
+
1650
+ // Returns the MiniTable for a message field if it is a submessage.
1651
+ UPB_API_INLINE const upb_MiniTable* upb_MiniTable_SubMessage(
1652
+ const upb_MiniTable* m, const upb_MiniTableField* f);
1771
1653
 
1772
1654
  // Returns the MiniTableEnum for a message field, NULL if the field is unlinked.
1773
1655
  UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
1774
- const upb_MiniTable* m, const upb_MiniTableField* f) {
1775
- return UPB_PRIVATE(_upb_MiniTable_GetSubEnumTable)(m, f);
1776
- }
1656
+ const upb_MiniTable* m, const upb_MiniTableField* f);
1777
1657
 
1778
1658
  // Returns the MiniTableField for the key of a map.
1779
1659
  UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_MapKey(
1780
- const upb_MiniTable* m) {
1781
- return UPB_PRIVATE(_upb_MiniTable_MapKey)(m);
1782
- }
1660
+ const upb_MiniTable* m);
1783
1661
 
1784
1662
  // Returns the MiniTableField for the value of a map.
1785
1663
  UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_MapValue(
1786
- const upb_MiniTable* m) {
1787
- return UPB_PRIVATE(_upb_MiniTable_MapValue)(m);
1788
- }
1664
+ const upb_MiniTable* m);
1789
1665
 
1790
1666
  // Returns true if this MiniTable field is linked to a MiniTable for the
1791
1667
  // sub-message.
1792
- UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
1793
- const upb_MiniTable* m, const upb_MiniTableField* f) {
1794
- return UPB_PRIVATE(_upb_MiniTable_MessageFieldIsLinked)(m, f);
1795
- }
1668
+ UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(const upb_MiniTable* m,
1669
+ const upb_MiniTableField* f);
1796
1670
 
1797
1671
  // If this field is in a oneof, returns the first field in the oneof.
1798
1672
  //
@@ -1824,68 +1698,129 @@ bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
1824
1698
 
1825
1699
  // Must be last.
1826
1700
 
1701
+ typedef struct upb_Array upb_Array;
1702
+
1827
1703
  #ifdef __cplusplus
1828
1704
  extern "C" {
1829
1705
  #endif
1830
1706
 
1831
- extern const float kUpb_FltInfinity;
1832
- extern const double kUpb_Infinity;
1833
- extern const double kUpb_NaN;
1707
+ // Creates a new array on the given arena that holds elements of this type.
1708
+ UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type);
1834
1709
 
1835
- // Internal members of a upb_Message that track unknown fields and/or
1836
- // extensions. We can change this without breaking binary compatibility.
1710
+ // Returns the number of elements in the array.
1711
+ UPB_API_INLINE size_t upb_Array_Size(const upb_Array* arr);
1837
1712
 
1838
- typedef struct upb_Message_Internal {
1839
- // Total size of this structure, including the data that follows.
1840
- // Must be aligned to 8, which is alignof(upb_Extension)
1841
- uint32_t size;
1713
+ // Returns the given element, which must be within the array's current size.
1714
+ UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i);
1842
1715
 
1843
- /* Offsets relative to the beginning of this structure.
1844
- *
1845
- * Unknown data grows forward from the beginning to unknown_end.
1846
- * Extension data grows backward from size to ext_begin.
1847
- * When the two meet, we're out of data and have to realloc.
1848
- *
1849
- * If we imagine that the final member of this struct is:
1850
- * char data[size - overhead]; // overhead = sizeof(upb_Message_Internal)
1851
- *
1852
- * Then we have:
1853
- * unknown data: data[0 .. (unknown_end - overhead)]
1854
- * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
1855
- uint32_t unknown_end;
1856
- uint32_t ext_begin;
1857
- // Data follows, as if there were an array:
1858
- // char data[size - sizeof(upb_Message_Internal)];
1859
- } upb_Message_Internal;
1716
+ // Returns a mutating pointer to the given element, which must be within the
1717
+ // array's current size.
1718
+ UPB_API upb_MutableMessageValue upb_Array_GetMutable(upb_Array* arr, size_t i);
1860
1719
 
1861
- // Inline version upb_Message_New(), for internal use.
1862
- UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
1863
- upb_Arena* a) {
1864
- const int size = m->UPB_PRIVATE(size);
1865
- struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
1866
- if (UPB_UNLIKELY(!msg)) return NULL;
1867
- memset(msg, 0, size);
1868
- return msg;
1720
+ // Sets the given element, which must be within the array's current size.
1721
+ UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);
1722
+
1723
+ // Appends an element to the array. Returns false on allocation failure.
1724
+ UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val,
1725
+ upb_Arena* arena);
1726
+
1727
+ // Moves elements within the array using memmove().
1728
+ // Like memmove(), the source and destination elements may be overlapping.
1729
+ UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx,
1730
+ size_t count);
1731
+
1732
+ // Inserts one or more empty elements into the array.
1733
+ // Existing elements are shifted right.
1734
+ // The new elements have undefined state and must be set with `upb_Array_Set()`.
1735
+ // REQUIRES: `i <= upb_Array_Size(arr)`
1736
+ UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count,
1737
+ upb_Arena* arena);
1738
+
1739
+ // Deletes one or more elements from the array.
1740
+ // Existing elements are shifted left.
1741
+ // REQUIRES: `i + count <= upb_Array_Size(arr)`
1742
+ UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count);
1743
+
1744
+ // Reserves |size| elements of storage for the array.
1745
+ UPB_API_INLINE bool upb_Array_Reserve(struct upb_Array* array, size_t size,
1746
+ upb_Arena* arena);
1747
+
1748
+ // Changes the size of a vector. New elements are initialized to NULL/0.
1749
+ // Returns false on allocation failure.
1750
+ UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena);
1751
+
1752
+ // Returns pointer to array data.
1753
+ UPB_API_INLINE const void* upb_Array_DataPtr(const upb_Array* arr);
1754
+
1755
+ // Returns mutable pointer to array data.
1756
+ UPB_API_INLINE void* upb_Array_MutableDataPtr(upb_Array* arr);
1757
+
1758
+ // Mark an array and all of its descendents as frozen/immutable.
1759
+ // If the array elements are messages then |m| must point to the minitable for
1760
+ // those messages. Otherwise |m| must be NULL.
1761
+ UPB_API void upb_Array_Freeze(upb_Array* arr, const upb_MiniTable* m);
1762
+
1763
+ // Returns whether an array has been frozen.
1764
+ UPB_API_INLINE bool upb_Array_IsFrozen(const upb_Array* arr);
1765
+
1766
+ #ifdef __cplusplus
1767
+ } /* extern "C" */
1768
+ #endif
1769
+
1770
+
1771
+ #endif /* UPB_MESSAGE_ARRAY_H_ */
1772
+
1773
+ #ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
1774
+ #define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
1775
+
1776
+ #include <stddef.h>
1777
+ #include <stdint.h>
1778
+ #include <string.h>
1779
+
1780
+
1781
+ #ifndef UPB_BASE_INTERNAL_ENDIAN_H_
1782
+ #define UPB_BASE_INTERNAL_ENDIAN_H_
1783
+
1784
+ #include <stdint.h>
1785
+
1786
+ // Must be last.
1787
+
1788
+ #ifdef __cplusplus
1789
+ extern "C" {
1790
+ #endif
1791
+
1792
+ UPB_INLINE bool upb_IsLittleEndian(void) {
1793
+ const int x = 1;
1794
+ return *(char*)&x == 1;
1869
1795
  }
1870
1796
 
1871
- // Discards the unknown fields for this message only.
1872
- void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg);
1797
+ UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) {
1798
+ if (upb_IsLittleEndian()) return val;
1873
1799
 
1874
- // Adds unknown data (serialized protobuf data) to the given message.
1875
- // The data is copied into the message instance.
1876
- bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg,
1877
- const char* data, size_t len,
1878
- upb_Arena* arena);
1800
+ return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
1801
+ ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
1802
+ }
1879
1803
 
1880
- bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
1881
- upb_Arena* arena);
1804
+ UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) {
1805
+ if (upb_IsLittleEndian()) return val;
1806
+
1807
+ const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32;
1808
+ const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32));
1809
+ return hi | lo;
1810
+ }
1882
1811
 
1883
1812
  #ifdef __cplusplus
1884
1813
  } /* extern "C" */
1885
1814
  #endif
1886
1815
 
1887
1816
 
1888
- #endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */
1817
+ #endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */
1818
+
1819
+ #ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
1820
+ #define UPB_MESSAGE_INTERNAL_EXTENSION_H_
1821
+
1822
+ #include <stddef.h>
1823
+
1889
1824
 
1890
1825
  #ifndef UPB_MINI_TABLE_EXTENSION_H_
1891
1826
  #define UPB_MINI_TABLE_EXTENSION_H_
@@ -1913,23 +1848,22 @@ struct upb_MiniTableExtension {
1913
1848
  extern "C" {
1914
1849
  #endif
1915
1850
 
1916
- UPB_INLINE upb_CType UPB_PRIVATE(_upb_MiniTableExtension_CType)(
1917
- const struct upb_MiniTableExtension* e) {
1918
- return UPB_PRIVATE(_upb_MiniTableField_CType)(&e->UPB_PRIVATE(field));
1851
+ UPB_API_INLINE upb_CType
1852
+ upb_MiniTableExtension_CType(const struct upb_MiniTableExtension* e) {
1853
+ return upb_MiniTableField_CType(&e->UPB_PRIVATE(field));
1919
1854
  }
1920
1855
 
1921
- UPB_INLINE uint32_t UPB_PRIVATE(_upb_MiniTableExtension_Number)(
1922
- const struct upb_MiniTableExtension* e) {
1856
+ UPB_API_INLINE uint32_t
1857
+ upb_MiniTableExtension_Number(const struct upb_MiniTableExtension* e) {
1923
1858
  return e->UPB_PRIVATE(field).UPB_ONLYBITS(number);
1924
1859
  }
1925
1860
 
1926
- UPB_INLINE const struct upb_MiniTable* UPB_PRIVATE(
1927
- _upb_MiniTableExtension_GetSubMessage)(
1861
+ UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableExtension_GetSubMessage(
1928
1862
  const struct upb_MiniTableExtension* e) {
1929
- return UPB_PRIVATE(_upb_MiniTableSub_Message)(e->UPB_PRIVATE(sub));
1863
+ return upb_MiniTableSub_Message(e->UPB_PRIVATE(sub));
1930
1864
  }
1931
1865
 
1932
- UPB_INLINE void UPB_PRIVATE(_upb_MiniTableExtension_SetSubMessage)(
1866
+ UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
1933
1867
  struct upb_MiniTableExtension* e, const struct upb_MiniTable* m) {
1934
1868
  e->UPB_PRIVATE(sub).UPB_PRIVATE(submsg) = m;
1935
1869
  }
@@ -1950,24 +1884,16 @@ extern "C" {
1950
1884
  #endif
1951
1885
 
1952
1886
  UPB_API_INLINE upb_CType
1953
- upb_MiniTableExtension_CType(const upb_MiniTableExtension* e) {
1954
- return UPB_PRIVATE(_upb_MiniTableExtension_CType)(e);
1955
- }
1887
+ upb_MiniTableExtension_CType(const upb_MiniTableExtension* e);
1956
1888
 
1957
1889
  UPB_API_INLINE uint32_t
1958
- upb_MiniTableExtension_Number(const upb_MiniTableExtension* e) {
1959
- return UPB_PRIVATE(_upb_MiniTableExtension_Number)(e);
1960
- }
1890
+ upb_MiniTableExtension_Number(const upb_MiniTableExtension* e);
1961
1891
 
1962
1892
  UPB_API_INLINE const upb_MiniTable* upb_MiniTableExtension_GetSubMessage(
1963
- const upb_MiniTableExtension* e) {
1964
- return UPB_PRIVATE(_upb_MiniTableExtension_GetSubMessage)(e);
1965
- }
1893
+ const upb_MiniTableExtension* e);
1966
1894
 
1967
1895
  UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
1968
- upb_MiniTableExtension* e, const upb_MiniTable* m) {
1969
- UPB_PRIVATE(_upb_MiniTableExtension_SetSubMessage)(e, m);
1970
- }
1896
+ upb_MiniTableExtension* e, const upb_MiniTable* m);
1971
1897
 
1972
1898
  #ifdef __cplusplus
1973
1899
  } /* extern "C" */
@@ -1986,14 +1912,10 @@ UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
1986
1912
  // This is rather wasteful for scalars (in the extreme case of bool,
1987
1913
  // it wastes 15 bytes). We accept this because we expect messages to be
1988
1914
  // the most common extension type.
1989
- struct upb_Extension {
1915
+ typedef struct {
1990
1916
  const upb_MiniTableExtension* ext;
1991
- union {
1992
- upb_StringView str;
1993
- void* ptr;
1994
- char scalar_data[8];
1995
- } data;
1996
- };
1917
+ upb_MessageValue data;
1918
+ } upb_Extension;
1997
1919
 
1998
1920
  #ifdef __cplusplus
1999
1921
  extern "C" {
@@ -2002,18 +1924,18 @@ extern "C" {
2002
1924
  // Adds the given extension data to the given message.
2003
1925
  // |ext| is copied into the message instance.
2004
1926
  // This logically replaces any previously-added extension with this number.
2005
- struct upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
1927
+ upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
2006
1928
  struct upb_Message* msg, const upb_MiniTableExtension* ext,
2007
1929
  upb_Arena* arena);
2008
1930
 
2009
1931
  // Returns an array of extensions for this message.
2010
1932
  // Note: the array is ordered in reverse relative to the order of creation.
2011
- const struct upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)(
1933
+ const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)(
2012
1934
  const struct upb_Message* msg, size_t* count);
2013
1935
 
2014
1936
  // Returns an extension for a message with a given mini table,
2015
1937
  // or NULL if no extension exists with this mini table.
2016
- const struct upb_Extension* UPB_PRIVATE(_upb_Message_Getext)(
1938
+ const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)(
2017
1939
  const struct upb_Message* msg, const upb_MiniTableExtension* ext);
2018
1940
 
2019
1941
  #ifdef __cplusplus
@@ -2342,6 +2264,7 @@ struct upb_Map {
2342
2264
  // Strings are represented as '0' because they must be handled specially.
2343
2265
  char key_size;
2344
2266
  char val_size;
2267
+ bool UPB_PRIVATE(is_frozen);
2345
2268
 
2346
2269
  upb_strtable table;
2347
2270
  };
@@ -2350,6 +2273,14 @@ struct upb_Map {
2350
2273
  extern "C" {
2351
2274
  #endif
2352
2275
 
2276
+ UPB_INLINE void UPB_PRIVATE(_upb_Map_ShallowFreeze)(struct upb_Map* map) {
2277
+ map->UPB_PRIVATE(is_frozen) = true;
2278
+ }
2279
+
2280
+ UPB_API_INLINE bool upb_Map_IsFrozen(const struct upb_Map* map) {
2281
+ return map->UPB_PRIVATE(is_frozen);
2282
+ }
2283
+
2353
2284
  // Converting between internal table representation and user values.
2354
2285
  //
2355
2286
  // _upb_map_tokey() and _upb_map_fromkey() are inverses.
@@ -2407,11 +2338,15 @@ UPB_INLINE void* _upb_map_next(const struct upb_Map* map, size_t* iter) {
2407
2338
  }
2408
2339
 
2409
2340
  UPB_INLINE void _upb_Map_Clear(struct upb_Map* map) {
2341
+ UPB_ASSERT(!upb_Map_IsFrozen(map));
2342
+
2410
2343
  upb_strtable_clear(&map->table);
2411
2344
  }
2412
2345
 
2413
2346
  UPB_INLINE bool _upb_Map_Delete(struct upb_Map* map, const void* key,
2414
2347
  size_t key_size, upb_value* val) {
2348
+ UPB_ASSERT(!upb_Map_IsFrozen(map));
2349
+
2415
2350
  upb_StringView k = _upb_map_tokey(key, key_size);
2416
2351
  return upb_strtable_remove2(&map->table, k.data, k.size, val);
2417
2352
  }
@@ -2431,6 +2366,8 @@ UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(struct upb_Map* map,
2431
2366
  const void* key, size_t key_size,
2432
2367
  void* val, size_t val_size,
2433
2368
  upb_Arena* a) {
2369
+ UPB_ASSERT(!upb_Map_IsFrozen(map));
2370
+
2434
2371
  upb_StringView strkey = _upb_map_tokey(key, key_size);
2435
2372
  upb_value tabval = {0};
2436
2373
  if (!_upb_map_tovalue(val, val_size, &tabval, a)) {
@@ -2468,6 +2405,95 @@ struct upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
2468
2405
 
2469
2406
  #endif /* UPB_MESSAGE_INTERNAL_MAP_H_ */
2470
2407
 
2408
+ /*
2409
+ ** Our memory representation for parsing tables and messages themselves.
2410
+ ** Functions in this file are used by generated code and possibly reflection.
2411
+ **
2412
+ ** The definitions in this file are internal to upb.
2413
+ **/
2414
+
2415
+ #ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_
2416
+ #define UPB_MESSAGE_INTERNAL_MESSAGE_H_
2417
+
2418
+ #include <stdlib.h>
2419
+ #include <string.h>
2420
+
2421
+
2422
+ // Must be last.
2423
+
2424
+ #ifdef __cplusplus
2425
+ extern "C" {
2426
+ #endif
2427
+
2428
+ extern const float kUpb_FltInfinity;
2429
+ extern const double kUpb_Infinity;
2430
+ extern const double kUpb_NaN;
2431
+
2432
+ // Internal members of a upb_Message that track unknown fields and/or
2433
+ // extensions. We can change this without breaking binary compatibility.
2434
+
2435
+ typedef struct upb_Message_Internal {
2436
+ // Total size of this structure, including the data that follows.
2437
+ // Must be aligned to 8, which is alignof(upb_Extension)
2438
+ uint32_t size;
2439
+
2440
+ /* Offsets relative to the beginning of this structure.
2441
+ *
2442
+ * Unknown data grows forward from the beginning to unknown_end.
2443
+ * Extension data grows backward from size to ext_begin.
2444
+ * When the two meet, we're out of data and have to realloc.
2445
+ *
2446
+ * If we imagine that the final member of this struct is:
2447
+ * char data[size - overhead]; // overhead = sizeof(upb_Message_Internal)
2448
+ *
2449
+ * Then we have:
2450
+ * unknown data: data[0 .. (unknown_end - overhead)]
2451
+ * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
2452
+ uint32_t unknown_end;
2453
+ uint32_t ext_begin;
2454
+ // Data follows, as if there were an array:
2455
+ // char data[size - sizeof(upb_Message_Internal)];
2456
+ } upb_Message_Internal;
2457
+
2458
+ #ifdef UPB_TRACING_ENABLED
2459
+ void UPB_PRIVATE(upb_Message_SetNewMessageTraceHandler)(
2460
+ void (*newMessageTraceHandler)(const upb_MiniTable*, const upb_Arena*));
2461
+ void UPB_PRIVATE(upb_Message_LogNewMessage)(const upb_MiniTable* mini_table,
2462
+ const upb_Arena* arena);
2463
+ #endif
2464
+
2465
+ // Inline version upb_Message_New(), for internal use.
2466
+ UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
2467
+ upb_Arena* a) {
2468
+ #ifdef UPB_TRACING_ENABLED
2469
+ UPB_PRIVATE(upb_Message_LogNewMessage)(m, a);
2470
+ #endif
2471
+ const int size = m->UPB_PRIVATE(size);
2472
+ struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
2473
+ if (UPB_UNLIKELY(!msg)) return NULL;
2474
+ memset(msg, 0, size);
2475
+ return msg;
2476
+ }
2477
+
2478
+ // Discards the unknown fields for this message only.
2479
+ void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg);
2480
+
2481
+ // Adds unknown data (serialized protobuf data) to the given message.
2482
+ // The data is copied into the message instance.
2483
+ bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg,
2484
+ const char* data, size_t len,
2485
+ upb_Arena* arena);
2486
+
2487
+ bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
2488
+ upb_Arena* arena);
2489
+
2490
+ #ifdef __cplusplus
2491
+ } /* extern "C" */
2492
+ #endif
2493
+
2494
+
2495
+ #endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */
2496
+
2471
2497
  #ifndef UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_
2472
2498
  #define UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_
2473
2499
 
@@ -2487,7 +2513,7 @@ UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(struct upb_Message* ptr, bool empty) {
2487
2513
  return (uintptr_t)ptr | (empty ? 1 : 0);
2488
2514
  }
2489
2515
 
2490
- UPB_INLINE bool UPB_PRIVATE(_upb_TaggedMessagePtr_IsEmpty)(uintptr_t ptr) {
2516
+ UPB_API_INLINE bool upb_TaggedMessagePtr_IsEmpty(uintptr_t ptr) {
2491
2517
  return ptr & 1;
2492
2518
  }
2493
2519
 
@@ -2496,34 +2522,72 @@ UPB_INLINE struct upb_Message* UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(
2496
2522
  return (struct upb_Message*)(ptr & ~(uintptr_t)1);
2497
2523
  }
2498
2524
 
2525
+ UPB_API_INLINE struct upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
2526
+ uintptr_t ptr) {
2527
+ UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr));
2528
+ return UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(ptr);
2529
+ }
2530
+
2499
2531
  UPB_INLINE struct upb_Message* UPB_PRIVATE(
2500
- _upb_TaggedMessagePtr_GetNonEmptyMessage)(uintptr_t ptr) {
2501
- UPB_ASSERT(!UPB_PRIVATE(_upb_TaggedMessagePtr_IsEmpty)(ptr));
2532
+ _upb_TaggedMessagePtr_GetEmptyMessage)(uintptr_t ptr) {
2533
+ UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr));
2502
2534
  return UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(ptr);
2503
2535
  }
2504
2536
 
2505
- UPB_INLINE struct upb_Message* UPB_PRIVATE(
2506
- _upb_TaggedMessagePtr_GetEmptyMessage)(uintptr_t ptr) {
2507
- UPB_ASSERT(UPB_PRIVATE(_upb_TaggedMessagePtr_IsEmpty)(ptr));
2508
- return UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(ptr);
2537
+ #ifdef __cplusplus
2538
+ } /* extern "C" */
2539
+ #endif
2540
+
2541
+
2542
+ #endif /* UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_ */
2543
+
2544
+ #ifndef UPB_MESSAGE_INTERNAL_TYPES_H_
2545
+ #define UPB_MESSAGE_INTERNAL_TYPES_H_
2546
+
2547
+ #include <stdint.h>
2548
+
2549
+ // Must be last.
2550
+
2551
+ #define UPB_OPAQUE(x) x##_opaque
2552
+
2553
+ struct upb_Message {
2554
+ union {
2555
+ uintptr_t UPB_OPAQUE(internal); // tagged pointer, low bit == frozen
2556
+ double d; // Forces same size for 32-bit/64-bit builds
2557
+ };
2558
+ };
2559
+
2560
+ #ifdef __cplusplus
2561
+ extern "C" {
2562
+ #endif
2563
+
2564
+ UPB_INLINE void UPB_PRIVATE(_upb_Message_ShallowFreeze)(
2565
+ struct upb_Message* msg) {
2566
+ msg->UPB_OPAQUE(internal) |= 1ULL;
2567
+ }
2568
+
2569
+ UPB_API_INLINE bool upb_Message_IsFrozen(const struct upb_Message* msg) {
2570
+ return (msg->UPB_OPAQUE(internal) & 1ULL) != 0;
2571
+ }
2572
+
2573
+ UPB_INLINE struct upb_Message_Internal* UPB_PRIVATE(_upb_Message_GetInternal)(
2574
+ const struct upb_Message* msg) {
2575
+ const uintptr_t tmp = msg->UPB_OPAQUE(internal) & ~1ULL;
2576
+ return (struct upb_Message_Internal*)tmp;
2577
+ }
2578
+
2579
+ UPB_INLINE void UPB_PRIVATE(_upb_Message_SetInternal)(
2580
+ struct upb_Message* msg, struct upb_Message_Internal* internal) {
2581
+ UPB_ASSERT(!upb_Message_IsFrozen(msg));
2582
+ msg->UPB_OPAQUE(internal) = (uintptr_t)internal;
2509
2583
  }
2510
2584
 
2511
2585
  #ifdef __cplusplus
2512
2586
  } /* extern "C" */
2513
2587
  #endif
2514
2588
 
2589
+ #undef UPB_OPAQUE
2515
2590
 
2516
- #endif /* UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_ */
2517
-
2518
- #ifndef UPB_MESSAGE_INTERNAL_TYPES_H_
2519
- #define UPB_MESSAGE_INTERNAL_TYPES_H_
2520
-
2521
- struct upb_Message {
2522
- union {
2523
- struct upb_Message_Internal* internal;
2524
- double d; // Forces same size for 32-bit/64-bit builds
2525
- };
2526
- };
2527
2591
 
2528
2592
  #endif /* UPB_MESSAGE_INTERNAL_TYPES_H_ */
2529
2593
 
@@ -2703,7 +2767,7 @@ UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(
2703
2767
  // bool FooMessage_set_bool_field(const upb_Message* msg, bool val) {
2704
2768
  // const upb_MiniTableField field = {1, 0, 0, /* etc... */};
2705
2769
  // // All value in "field" are compile-time known.
2706
- // _upb_Message_SetNonExtensionField(msg, &field, &value);
2770
+ // upb_Message_SetBaseField(msg, &field, &value);
2707
2771
  // }
2708
2772
  //
2709
2773
  // // Via UPB_ASSUME().
@@ -2726,8 +2790,8 @@ UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(
2726
2790
  // of a setter is known to be a non-extension, the arena may be NULL and the
2727
2791
  // returned bool value may be ignored since it will always succeed.
2728
2792
 
2729
- UPB_INLINE bool UPB_PRIVATE(_upb_Message_HasBaseField)(
2730
- const struct upb_Message* msg, const upb_MiniTableField* field) {
2793
+ UPB_API_INLINE bool upb_Message_HasBaseField(const struct upb_Message* msg,
2794
+ const upb_MiniTableField* field) {
2731
2795
  UPB_ASSERT(upb_MiniTableField_HasPresence(field));
2732
2796
  UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2733
2797
  if (upb_MiniTableField_IsInOneof(field)) {
@@ -2738,19 +2802,19 @@ UPB_INLINE bool UPB_PRIVATE(_upb_Message_HasBaseField)(
2738
2802
  }
2739
2803
  }
2740
2804
 
2741
- UPB_INLINE bool UPB_PRIVATE(_upb_Message_HasExtension)(
2742
- const struct upb_Message* msg, const upb_MiniTableExtension* ext) {
2743
- UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->UPB_PRIVATE(field)));
2744
- return UPB_PRIVATE(_upb_Message_Getext)(msg, ext) != NULL;
2805
+ UPB_API_INLINE bool upb_Message_HasExtension(const struct upb_Message* msg,
2806
+ const upb_MiniTableExtension* e) {
2807
+ UPB_ASSERT(upb_MiniTableField_HasPresence(&e->UPB_PRIVATE(field)));
2808
+ return UPB_PRIVATE(_upb_Message_Getext)(msg, e) != NULL;
2745
2809
  }
2746
2810
 
2747
- static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
2811
+ UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
2748
2812
  const struct upb_Message* msg, const upb_MiniTableField* field,
2749
2813
  const void* default_val, void* val) {
2750
2814
  UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2751
2815
  if ((upb_MiniTableField_IsInOneof(field) ||
2752
2816
  !UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(field, default_val)) &&
2753
- !UPB_PRIVATE(_upb_Message_HasBaseField)(msg, field)) {
2817
+ !upb_Message_HasBaseField(msg, field)) {
2754
2818
  UPB_PRIVATE(_upb_MiniTableField_DataCopy)(field, val, default_val);
2755
2819
  return;
2756
2820
  }
@@ -2761,8 +2825,7 @@ static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
2761
2825
  UPB_INLINE void _upb_Message_GetExtensionField(
2762
2826
  const struct upb_Message* msg, const upb_MiniTableExtension* mt_ext,
2763
2827
  const void* default_val, void* val) {
2764
- const struct upb_Extension* ext =
2765
- UPB_PRIVATE(_upb_Message_Getext)(msg, mt_ext);
2828
+ const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getext)(msg, mt_ext);
2766
2829
  const upb_MiniTableField* f = &mt_ext->UPB_PRIVATE(field);
2767
2830
  UPB_ASSUME(upb_MiniTableField_IsExtension(f));
2768
2831
 
@@ -2773,33 +2836,45 @@ UPB_INLINE void _upb_Message_GetExtensionField(
2773
2836
  }
2774
2837
  }
2775
2838
 
2776
- UPB_INLINE void _upb_Message_SetNonExtensionField(
2777
- struct upb_Message* msg, const upb_MiniTableField* field, const void* val) {
2778
- UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2779
- UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
2839
+ UPB_API_INLINE void upb_Message_SetBaseField(struct upb_Message* msg,
2840
+ const upb_MiniTableField* f,
2841
+ const void* val) {
2842
+ UPB_ASSERT(!upb_Message_IsFrozen(msg));
2843
+ UPB_ASSUME(!upb_MiniTableField_IsExtension(f));
2844
+ UPB_PRIVATE(_upb_Message_SetPresence)(msg, f);
2780
2845
  UPB_PRIVATE(_upb_MiniTableField_DataCopy)
2781
- (field, UPB_PRIVATE(_upb_Message_MutableDataPtr)(msg, field), val);
2846
+ (f, UPB_PRIVATE(_upb_Message_MutableDataPtr)(msg, f), val);
2782
2847
  }
2783
2848
 
2784
- UPB_INLINE bool _upb_Message_SetExtensionField(
2785
- struct upb_Message* msg, const upb_MiniTableExtension* mt_ext,
2786
- const void* val, upb_Arena* a) {
2849
+ UPB_API_INLINE bool upb_Message_SetExtension(struct upb_Message* msg,
2850
+ const upb_MiniTableExtension* e,
2851
+ const void* val, upb_Arena* a) {
2852
+ UPB_ASSERT(!upb_Message_IsFrozen(msg));
2787
2853
  UPB_ASSERT(a);
2788
- struct upb_Extension* ext =
2789
- UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(msg, mt_ext, a);
2854
+ upb_Extension* ext =
2855
+ UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(msg, e, a);
2790
2856
  if (!ext) return false;
2791
2857
  UPB_PRIVATE(_upb_MiniTableField_DataCopy)
2792
- (&mt_ext->UPB_PRIVATE(field), &ext->data, val);
2858
+ (&e->UPB_PRIVATE(field), &ext->data, val);
2793
2859
  return true;
2794
2860
  }
2795
2861
 
2796
- UPB_INLINE void UPB_PRIVATE(_upb_Message_Clear)(struct upb_Message* msg,
2797
- const upb_MiniTable* m) {
2862
+ UPB_API_INLINE void upb_Message_Clear(struct upb_Message* msg,
2863
+ const upb_MiniTable* m) {
2864
+ UPB_ASSERT(!upb_Message_IsFrozen(msg));
2865
+ upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
2798
2866
  memset(msg, 0, m->UPB_PRIVATE(size));
2867
+ if (in) {
2868
+ // Reset the internal buffer to empty.
2869
+ in->unknown_end = sizeof(upb_Message_Internal);
2870
+ in->ext_begin = in->size;
2871
+ UPB_PRIVATE(_upb_Message_SetInternal)(msg, in);
2872
+ }
2799
2873
  }
2800
2874
 
2801
- UPB_INLINE void UPB_PRIVATE(_upb_Message_ClearBaseField)(
2802
- struct upb_Message* msg, const upb_MiniTableField* f) {
2875
+ UPB_API_INLINE void upb_Message_ClearBaseField(struct upb_Message* msg,
2876
+ const upb_MiniTableField* f) {
2877
+ UPB_ASSERT(!upb_Message_IsFrozen(msg));
2803
2878
  if (UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f)) {
2804
2879
  UPB_PRIVATE(_upb_Message_ClearHasbit)(msg, f);
2805
2880
  } else if (upb_MiniTableField_IsInOneof(f)) {
@@ -2812,17 +2887,16 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_ClearBaseField)(
2812
2887
  (f, UPB_PRIVATE(_upb_Message_MutableDataPtr)(msg, f), zeros);
2813
2888
  }
2814
2889
 
2815
- UPB_INLINE void UPB_PRIVATE(_upb_Message_ClearExtension)(
2890
+ UPB_API_INLINE void upb_Message_ClearExtension(
2816
2891
  struct upb_Message* msg, const upb_MiniTableExtension* e) {
2817
- upb_Message_Internal* in = msg->internal;
2892
+ UPB_ASSERT(!upb_Message_IsFrozen(msg));
2893
+ upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
2818
2894
  if (!in) return;
2819
- const struct upb_Extension* base =
2820
- UPB_PTR_AT(in, in->ext_begin, struct upb_Extension);
2821
- struct upb_Extension* ext =
2822
- (struct upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
2895
+ const upb_Extension* base = UPB_PTR_AT(in, in->ext_begin, upb_Extension);
2896
+ upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
2823
2897
  if (ext) {
2824
2898
  *ext = *base;
2825
- in->ext_begin += sizeof(struct upb_Extension);
2899
+ in->ext_begin += sizeof(upb_Extension);
2826
2900
  }
2827
2901
  }
2828
2902
 
@@ -2834,7 +2908,7 @@ UPB_INLINE void _upb_Message_AssertMapIsUntagged(
2834
2908
  uintptr_t default_val = 0;
2835
2909
  uintptr_t tagged;
2836
2910
  _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
2837
- UPB_ASSERT(!UPB_PRIVATE(_upb_TaggedMessagePtr_IsEmpty)(tagged));
2911
+ UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged));
2838
2912
  #endif
2839
2913
  }
2840
2914
 
@@ -2850,7 +2924,7 @@ UPB_INLINE struct upb_Map* _upb_Message_GetOrCreateMutableMap(
2850
2924
  map = _upb_Map_New(arena, key_size, val_size);
2851
2925
  // Check again due to: https://godbolt.org/z/7WfaoKG1r
2852
2926
  UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
2853
- _upb_Message_SetNonExtensionField(msg, field, &map);
2927
+ upb_Message_SetBaseField(msg, field, &map);
2854
2928
  }
2855
2929
  return map;
2856
2930
  }
@@ -2917,12 +2991,6 @@ UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key,
2917
2991
  UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
2918
2992
  upb_MessageValue* val);
2919
2993
 
2920
- // (DEPRECATED and going away soon. Do not use.)
2921
- UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key,
2922
- upb_MessageValue* val) {
2923
- return upb_Map_Delete(map, key, val);
2924
- }
2925
-
2926
2994
  // Map iteration:
2927
2995
  //
2928
2996
  // size_t iter = kUpb_Map_Begin;
@@ -2931,7 +2999,7 @@ UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key,
2931
2999
  // ...
2932
3000
  // }
2933
3001
 
2934
- #define kUpb_Map_Begin ((size_t)-1)
3002
+ #define kUpb_Map_Begin ((size_t) - 1)
2935
3003
 
2936
3004
  // Advances to the next entry. Returns false if no more entries are present.
2937
3005
  // Otherwise returns true and populates both *key and *value.
@@ -2966,6 +3034,14 @@ UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter);
2966
3034
  UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter);
2967
3035
  UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);
2968
3036
 
3037
+ // Mark a map and all of its descendents as frozen/immutable.
3038
+ // If the map values are messages then |m| must point to the minitable for
3039
+ // those messages. Otherwise |m| must be NULL.
3040
+ UPB_API void upb_Map_Freeze(upb_Map* map, const upb_MiniTable* m);
3041
+
3042
+ // Returns whether a map has been frozen.
3043
+ UPB_API_INLINE bool upb_Map_IsFrozen(const upb_Map* map);
3044
+
2969
3045
  #ifdef __cplusplus
2970
3046
  } /* extern "C" */
2971
3047
  #endif
@@ -2991,7 +3067,6 @@ UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);
2991
3067
 
2992
3068
  // Must be last.
2993
3069
 
2994
- typedef struct upb_Extension upb_Extension;
2995
3070
  typedef struct upb_Message upb_Message;
2996
3071
 
2997
3072
  #ifdef __cplusplus
@@ -3010,6 +3085,24 @@ void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len);
3010
3085
  // Returns the number of extensions present in this message.
3011
3086
  size_t upb_Message_ExtensionCount(const upb_Message* msg);
3012
3087
 
3088
+ // Mark a message and all of its descendents as frozen/immutable.
3089
+ UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m);
3090
+
3091
+ // Returns whether a message has been frozen.
3092
+ UPB_API_INLINE bool upb_Message_IsFrozen(const upb_Message* msg);
3093
+
3094
+ #ifdef UPB_TRACING_ENABLED
3095
+ UPB_INLINE void upb_Message_SetNewMessageTraceHandler(
3096
+ void (*newMessageTraceHandler)(const upb_MiniTable* mini_table,
3097
+ const upb_Arena* arena)) {
3098
+ UPB_PRIVATE(upb_Message_SetNewMessageTraceHandler)(newMessageTraceHandler);
3099
+ }
3100
+ UPB_INLINE void upb_Message_LogNewMessage(const upb_MiniTable* mini_table,
3101
+ const upb_Arena* arena) {
3102
+ UPB_PRIVATE(upb_Message_LogNewMessage)(mini_table, arena);
3103
+ }
3104
+ #endif
3105
+
3013
3106
  #ifdef __cplusplus
3014
3107
  } /* extern "C" */
3015
3108
  #endif
@@ -3037,14 +3130,10 @@ extern "C" {
3037
3130
  // Users who enable unlinked sub-messages must use this to test whether a
3038
3131
  // message is empty before accessing it. If a message is empty, it must be
3039
3132
  // first promoted using the interfaces in message/promote.h.
3040
- UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) {
3041
- return UPB_PRIVATE(_upb_TaggedMessagePtr_IsEmpty)(ptr);
3042
- }
3133
+ UPB_API_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr);
3043
3134
 
3044
- UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
3045
- upb_TaggedMessagePtr ptr) {
3046
- return UPB_PRIVATE(_upb_TaggedMessagePtr_GetNonEmptyMessage)(ptr);
3047
- }
3135
+ UPB_API_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
3136
+ upb_TaggedMessagePtr ptr);
3048
3137
 
3049
3138
  #ifdef __cplusplus
3050
3139
  } /* extern "C" */
@@ -3068,26 +3157,18 @@ extern "C" {
3068
3157
  // Constructors
3069
3158
 
3070
3159
  UPB_API_INLINE upb_MiniTableSub
3071
- upb_MiniTableSub_FromEnum(const upb_MiniTableEnum* subenum) {
3072
- return UPB_PRIVATE(_upb_MiniTableSub_FromEnum)(subenum);
3073
- }
3160
+ upb_MiniTableSub_FromEnum(const upb_MiniTableEnum* subenum);
3074
3161
 
3075
3162
  UPB_API_INLINE upb_MiniTableSub
3076
- upb_MiniTableSub_FromMessage(const upb_MiniTable* submsg) {
3077
- return UPB_PRIVATE(_upb_MiniTableSub_FromMessage)(submsg);
3078
- }
3163
+ upb_MiniTableSub_FromMessage(const upb_MiniTable* submsg);
3079
3164
 
3080
3165
  // Getters
3081
3166
 
3082
3167
  UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTableSub_Enum(
3083
- upb_MiniTableSub sub) {
3084
- return UPB_PRIVATE(_upb_MiniTableSub_Enum)(sub);
3085
- }
3168
+ upb_MiniTableSub sub);
3086
3169
 
3087
3170
  UPB_API_INLINE const upb_MiniTable* upb_MiniTableSub_Message(
3088
- upb_MiniTableSub sub) {
3089
- return UPB_PRIVATE(_upb_MiniTableSub_Message)(sub);
3090
- }
3171
+ upb_MiniTableSub sub);
3091
3172
 
3092
3173
  #ifdef __cplusplus
3093
3174
  } /* extern "C" */
@@ -3108,30 +3189,27 @@ extern "C" {
3108
3189
  // Functions ending in Extension() take a (upb_MiniTableExtension*) argument
3109
3190
  // and work only on extensions.
3110
3191
 
3111
- UPB_API_INLINE void upb_Message_Clear(upb_Message* msg,
3112
- const upb_MiniTable* m) {
3113
- UPB_PRIVATE(_upb_Message_Clear)(msg, m);
3114
- }
3192
+ UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, const upb_MiniTable* m);
3115
3193
 
3116
3194
  UPB_API_INLINE void upb_Message_ClearBaseField(upb_Message* msg,
3117
- const upb_MiniTableField* f) {
3118
- UPB_PRIVATE(_upb_Message_ClearBaseField)(msg, f);
3119
- }
3195
+ const upb_MiniTableField* f);
3120
3196
 
3121
- UPB_API_INLINE void upb_Message_ClearExtension(
3122
- upb_Message* msg, const upb_MiniTableExtension* e) {
3123
- UPB_PRIVATE(_upb_Message_ClearExtension)(msg, e);
3124
- }
3197
+ UPB_API_INLINE void upb_Message_ClearExtension(upb_Message* msg,
3198
+ const upb_MiniTableExtension* e);
3125
3199
 
3126
3200
  UPB_API_INLINE bool upb_Message_HasBaseField(const upb_Message* msg,
3127
- const upb_MiniTableField* f) {
3128
- return UPB_PRIVATE(_upb_Message_HasBaseField)(msg, f);
3129
- }
3201
+ const upb_MiniTableField* f);
3130
3202
 
3131
3203
  UPB_API_INLINE bool upb_Message_HasExtension(const upb_Message* msg,
3132
- const upb_MiniTableExtension* e) {
3133
- return UPB_PRIVATE(_upb_Message_HasExtension)(msg, e);
3134
- }
3204
+ const upb_MiniTableExtension* e);
3205
+
3206
+ UPB_API_INLINE void upb_Message_SetBaseField(upb_Message* msg,
3207
+ const upb_MiniTableField* f,
3208
+ const void* val);
3209
+
3210
+ UPB_API_INLINE bool upb_Message_SetExtension(upb_Message* msg,
3211
+ const upb_MiniTableExtension* e,
3212
+ const void* val, upb_Arena* a);
3135
3213
 
3136
3214
  UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
3137
3215
  const upb_Message* message, const upb_MiniTableField* oneof_field) {
@@ -3157,14 +3235,17 @@ upb_Message_GetField(const upb_Message* msg, const upb_MiniTableField* field,
3157
3235
  return ret;
3158
3236
  }
3159
3237
 
3160
- UPB_INLINE bool upb_Message_SetField(upb_Message* msg,
3161
- const upb_MiniTableField* field,
3162
- upb_MessageValue val, upb_Arena* a) {
3238
+ // Sets the value of the given field in the given msg. The return value is true
3239
+ // if the operation completed successfully, or false if memory allocation
3240
+ // failed.
3241
+ UPB_INLINE bool UPB_PRIVATE(_upb_Message_SetField)(
3242
+ upb_Message* msg, const upb_MiniTableField* field, upb_MessageValue val,
3243
+ upb_Arena* a) {
3163
3244
  if (upb_MiniTableField_IsExtension(field)) {
3164
3245
  const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
3165
- return _upb_Message_SetExtensionField(msg, ext, &val, a);
3246
+ return upb_Message_SetExtension(msg, ext, &val, a);
3166
3247
  } else {
3167
- _upb_Message_SetNonExtensionField(msg, field, &val);
3248
+ upb_Message_SetBaseField(msg, field, &val);
3168
3249
  return true;
3169
3250
  }
3170
3251
  }
@@ -3190,7 +3271,7 @@ UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
3190
3271
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3191
3272
  upb_MessageValue val;
3192
3273
  val.bool_val = value;
3193
- return upb_Message_SetField(msg, field, val, a);
3274
+ return UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, a);
3194
3275
  }
3195
3276
 
3196
3277
  UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
@@ -3217,7 +3298,7 @@ UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
3217
3298
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3218
3299
  upb_MessageValue val;
3219
3300
  val.int32_val = value;
3220
- return upb_Message_SetField(msg, field, val, a);
3301
+ return UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, a);
3221
3302
  }
3222
3303
 
3223
3304
  UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
@@ -3242,7 +3323,7 @@ UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
3242
3323
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3243
3324
  upb_MessageValue val;
3244
3325
  val.uint32_val = value;
3245
- return upb_Message_SetField(msg, field, val, a);
3326
+ return UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, a);
3246
3327
  }
3247
3328
 
3248
3329
  UPB_API_INLINE void upb_Message_SetClosedEnum(
@@ -3254,7 +3335,7 @@ UPB_API_INLINE void upb_Message_SetClosedEnum(
3254
3335
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3255
3336
  UPB_ASSERT(upb_MiniTableEnum_CheckValue(
3256
3337
  upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value));
3257
- _upb_Message_SetNonExtensionField(msg, field, &value);
3338
+ upb_Message_SetBaseField(msg, field, &value);
3258
3339
  }
3259
3340
 
3260
3341
  UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
@@ -3279,7 +3360,7 @@ UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
3279
3360
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3280
3361
  upb_MessageValue val;
3281
3362
  val.int64_val = value;
3282
- return upb_Message_SetField(msg, field, val, a);
3363
+ return UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, a);
3283
3364
  }
3284
3365
 
3285
3366
  UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
@@ -3304,7 +3385,7 @@ UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
3304
3385
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3305
3386
  upb_MessageValue val;
3306
3387
  val.uint64_val = value;
3307
- return upb_Message_SetField(msg, field, val, a);
3388
+ return UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, a);
3308
3389
  }
3309
3390
 
3310
3391
  UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
@@ -3329,7 +3410,7 @@ UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
3329
3410
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3330
3411
  upb_MessageValue val;
3331
3412
  val.float_val = value;
3332
- return upb_Message_SetField(msg, field, val, a);
3413
+ return UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, a);
3333
3414
  }
3334
3415
 
3335
3416
  UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
@@ -3354,7 +3435,7 @@ UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
3354
3435
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3355
3436
  upb_MessageValue val;
3356
3437
  val.double_val = value;
3357
- return upb_Message_SetField(msg, field, val, a);
3438
+ return UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, a);
3358
3439
  }
3359
3440
 
3360
3441
  UPB_API_INLINE upb_StringView
@@ -3371,6 +3452,10 @@ upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
3371
3452
  return upb_Message_GetField(msg, field, def).str_val;
3372
3453
  }
3373
3454
 
3455
+ // Sets the value of a `string` or `bytes` field. The bytes of the value are not
3456
+ // copied, so it is the caller's responsibility to ensure that they remain valid
3457
+ // for the lifetime of `msg`. That might be done by copying them into the given
3458
+ // arena, or by fusing that arena with the arena the bytes live in, for example.
3374
3459
  UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
3375
3460
  const upb_MiniTableField* field,
3376
3461
  upb_StringView value, upb_Arena* a) {
@@ -3381,7 +3466,7 @@ UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
3381
3466
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3382
3467
  upb_MessageValue val;
3383
3468
  val.str_val = value;
3384
- return upb_Message_SetField(msg, field, val, a);
3469
+ return UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, a);
3385
3470
  }
3386
3471
 
3387
3472
  UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
@@ -3397,13 +3482,17 @@ UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
3397
3482
  }
3398
3483
 
3399
3484
  UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
3400
- const upb_Message* msg, const upb_MiniTableField* field,
3401
- upb_Message* default_val) {
3485
+ const upb_Message* msg, const upb_MiniTableField* field) {
3402
3486
  upb_TaggedMessagePtr tagged =
3403
- upb_Message_GetTaggedMessagePtr(msg, field, default_val);
3487
+ upb_Message_GetTaggedMessagePtr(msg, field, NULL);
3404
3488
  return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged);
3405
3489
  }
3406
3490
 
3491
+ UPB_API_INLINE upb_Message* upb_Message_GetMutableMessage(
3492
+ upb_Message* msg, const upb_MiniTableField* field) {
3493
+ return (upb_Message*)upb_Message_GetMessage(msg, field);
3494
+ }
3495
+
3407
3496
  // For internal use only; users cannot set tagged messages because only the
3408
3497
  // parser and the message copier are allowed to directly create an empty
3409
3498
  // message.
@@ -3416,9 +3505,12 @@ UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
3416
3505
  UPB_ASSUME(upb_MiniTableField_IsScalar(field));
3417
3506
  UPB_ASSERT(upb_MiniTableSub_Message(
3418
3507
  mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]));
3419
- _upb_Message_SetNonExtensionField(msg, field, &sub_message);
3508
+ upb_Message_SetBaseField(msg, field, &sub_message);
3420
3509
  }
3421
3510
 
3511
+ // Sets the value of a message-typed field. The `mini_table` and `field`
3512
+ // parameters belong to `msg`, not `sub_message`. The mini_tables of `msg` and
3513
+ // `sub_message` must have been linked for this to work correctly.
3422
3514
  UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
3423
3515
  const upb_MiniTable* mini_table,
3424
3516
  const upb_MiniTableField* field,
@@ -3473,7 +3565,7 @@ UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
3473
3565
  UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
3474
3566
  upb_MessageValue val;
3475
3567
  val.array_val = array;
3476
- upb_Message_SetField(msg, field, val, arena);
3568
+ UPB_PRIVATE(_upb_Message_SetField)(msg, field, val, arena);
3477
3569
  }
3478
3570
  return array;
3479
3571
  }
@@ -3509,9 +3601,9 @@ UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
3509
3601
  const upb_MiniTableField* field, upb_Arena* arena) {
3510
3602
  UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
3511
3603
  const upb_MiniTableField* map_entry_key_field =
3512
- &map_entry_mini_table->UPB_PRIVATE(fields)[0];
3604
+ &map_entry_mini_table->UPB_ONLYBITS(fields)[0];
3513
3605
  const upb_MiniTableField* map_entry_value_field =
3514
- &map_entry_mini_table->UPB_PRIVATE(fields)[1];
3606
+ &map_entry_mini_table->UPB_ONLYBITS(fields)[1];
3515
3607
  return _upb_Message_GetOrCreateMutableMap(
3516
3608
  msg, field,
3517
3609
  _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)),
@@ -3587,6 +3679,7 @@ UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
3587
3679
  // Export the newer headers, for legacy users. New users should include the
3588
3680
  // more specific headers directly.
3589
3681
  // IWYU pragma: begin_exports
3682
+
3590
3683
  #ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3591
3684
  #define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3592
3685
 
@@ -3597,20 +3690,11 @@ UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
3597
3690
  extern "C" {
3598
3691
  #endif
3599
3692
 
3600
- // Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor
3601
- // must be for an enum, not a message.
3602
- UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data,
3603
- size_t len,
3604
- upb_Arena* arena,
3605
- upb_Status* status);
3606
-
3607
- // TODO: Deprecated name; update callers.
3608
- UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data,
3609
- size_t len,
3610
- upb_Arena* arena,
3611
- upb_Status* status) {
3612
- return upb_MiniDescriptor_BuildEnum(data, len, arena, status);
3613
- }
3693
+ // Builds a upb_MiniTableEnum from an enum mini descriptor.
3694
+ // The mini descriptor must be for an enum, not a message.
3695
+ UPB_API upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, size_t len,
3696
+ upb_Arena* arena,
3697
+ upb_Status* status);
3614
3698
 
3615
3699
  #ifdef __cplusplus
3616
3700
  } /* extern "C" */
@@ -3878,34 +3962,34 @@ struct upb_MiniTableFile {
3878
3962
  extern "C" {
3879
3963
  #endif
3880
3964
 
3881
- UPB_INLINE int UPB_PRIVATE(_upb_MiniTableFile_EnumCount)(
3965
+ UPB_API_INLINE int upb_MiniTableFile_EnumCount(
3882
3966
  const struct upb_MiniTableFile* f) {
3883
3967
  return f->UPB_PRIVATE(enum_count);
3884
3968
  }
3885
3969
 
3886
- UPB_INLINE int UPB_PRIVATE(_upb_MiniTableFile_ExtensionCount)(
3970
+ UPB_API_INLINE int upb_MiniTableFile_ExtensionCount(
3887
3971
  const struct upb_MiniTableFile* f) {
3888
3972
  return f->UPB_PRIVATE(ext_count);
3889
3973
  }
3890
3974
 
3891
- UPB_INLINE int UPB_PRIVATE(_upb_MiniTableFile_MessageCount)(
3975
+ UPB_API_INLINE int upb_MiniTableFile_MessageCount(
3892
3976
  const struct upb_MiniTableFile* f) {
3893
3977
  return f->UPB_PRIVATE(msg_count);
3894
3978
  }
3895
3979
 
3896
- UPB_INLINE const struct upb_MiniTableEnum* UPB_PRIVATE(_upb_MiniTableFile_Enum)(
3980
+ UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableFile_Enum(
3897
3981
  const struct upb_MiniTableFile* f, int i) {
3898
3982
  UPB_ASSERT(i < f->UPB_PRIVATE(enum_count));
3899
3983
  return f->UPB_PRIVATE(enums)[i];
3900
3984
  }
3901
3985
 
3902
- UPB_INLINE const struct upb_MiniTableExtension* UPB_PRIVATE(
3903
- _upb_MiniTableFile_Extension)(const struct upb_MiniTableFile* f, int i) {
3986
+ UPB_API_INLINE const struct upb_MiniTableExtension* upb_MiniTableFile_Extension(
3987
+ const struct upb_MiniTableFile* f, int i) {
3904
3988
  UPB_ASSERT(i < f->UPB_PRIVATE(ext_count));
3905
3989
  return f->UPB_PRIVATE(exts)[i];
3906
3990
  }
3907
3991
 
3908
- UPB_INLINE const struct upb_MiniTable* UPB_PRIVATE(_upb_MiniTableFile_Message)(
3992
+ UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableFile_Message(
3909
3993
  const struct upb_MiniTableFile* f, int i) {
3910
3994
  UPB_ASSERT(i < f->UPB_PRIVATE(msg_count));
3911
3995
  return f->UPB_PRIVATE(msgs)[i];
@@ -3927,32 +4011,19 @@ extern "C" {
3927
4011
  #endif
3928
4012
 
3929
4013
  UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTableFile_Enum(
3930
- const upb_MiniTableFile* f, int i) {
3931
- return UPB_PRIVATE(_upb_MiniTableFile_Enum)(f, i);
3932
- }
4014
+ const upb_MiniTableFile* f, int i);
3933
4015
 
3934
- UPB_API_INLINE int upb_MiniTableFile_EnumCount(const upb_MiniTableFile* f) {
3935
- return UPB_PRIVATE(_upb_MiniTableFile_EnumCount)(f);
3936
- }
4016
+ UPB_API_INLINE int upb_MiniTableFile_EnumCount(const upb_MiniTableFile* f);
3937
4017
 
3938
4018
  UPB_API_INLINE const upb_MiniTableExtension* upb_MiniTableFile_Extension(
3939
- const upb_MiniTableFile* f, int i) {
3940
- return UPB_PRIVATE(_upb_MiniTableFile_Extension)(f, i);
3941
- }
4019
+ const upb_MiniTableFile* f, int i);
3942
4020
 
3943
- UPB_API_INLINE int upb_MiniTableFile_ExtensionCount(
3944
- const upb_MiniTableFile* f) {
3945
- return UPB_PRIVATE(_upb_MiniTableFile_ExtensionCount)(f);
3946
- }
4021
+ UPB_API_INLINE int upb_MiniTableFile_ExtensionCount(const upb_MiniTableFile* f);
3947
4022
 
3948
4023
  UPB_API_INLINE const upb_MiniTable* upb_MiniTableFile_Message(
3949
- const upb_MiniTableFile* f, int i) {
3950
- return UPB_PRIVATE(_upb_MiniTableFile_Message)(f, i);
3951
- }
4024
+ const upb_MiniTableFile* f, int i);
3952
4025
 
3953
- UPB_API_INLINE int upb_MiniTableFile_MessageCount(const upb_MiniTableFile* f) {
3954
- return UPB_PRIVATE(_upb_MiniTableFile_MessageCount)(f);
3955
- }
4026
+ UPB_API_INLINE int upb_MiniTableFile_MessageCount(const upb_MiniTableFile* f);
3956
4027
 
3957
4028
  #ifdef __cplusplus
3958
4029
  } /* extern "C" */
@@ -4061,6 +4132,7 @@ UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) {
4061
4132
  return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff);
4062
4133
  }
4063
4134
 
4135
+ // LINT.IfChange
4064
4136
  typedef enum {
4065
4137
  kUpb_DecodeStatus_Ok = 0,
4066
4138
  kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
@@ -4078,12 +4150,21 @@ typedef enum {
4078
4150
  // of options.
4079
4151
  kUpb_DecodeStatus_UnlinkedSubMessage = 6,
4080
4152
  } upb_DecodeStatus;
4153
+ // LINT.ThenChange(//depot/google3/third_party/protobuf/rust/upb.rs:decode_status)
4081
4154
 
4082
4155
  UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size,
4083
- upb_Message* msg, const upb_MiniTable* l,
4156
+ upb_Message* msg, const upb_MiniTable* mt,
4084
4157
  const upb_ExtensionRegistry* extreg,
4085
4158
  int options, upb_Arena* arena);
4086
4159
 
4160
+ // Same as upb_Decode but with a varint-encoded length prepended.
4161
+ // On success 'num_bytes_read' will be set to the how many bytes were read,
4162
+ // on failure the contents of num_bytes_read is undefined.
4163
+ UPB_API upb_DecodeStatus upb_DecodeLengthPrefixed(
4164
+ const char* buf, size_t size, upb_Message* msg, size_t* num_bytes_read,
4165
+ const upb_MiniTable* mt, const upb_ExtensionRegistry* extreg, int options,
4166
+ upb_Arena* arena);
4167
+
4087
4168
  #ifdef __cplusplus
4088
4169
  } /* extern "C" */
4089
4170
  #endif
@@ -4115,13 +4196,14 @@ enum {
4115
4196
  * memory during encode. */
4116
4197
  kUpb_EncodeOption_Deterministic = 1,
4117
4198
 
4118
- // When set, unknown fields are not printed.
4199
+ // When set, unknown fields are not encoded.
4119
4200
  kUpb_EncodeOption_SkipUnknown = 2,
4120
4201
 
4121
4202
  // When set, the encode will fail if any required fields are missing.
4122
4203
  kUpb_EncodeOption_CheckRequired = 4,
4123
4204
  };
4124
4205
 
4206
+ // LINT.IfChange
4125
4207
  typedef enum {
4126
4208
  kUpb_EncodeStatus_Ok = 0,
4127
4209
  kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
@@ -4130,6 +4212,7 @@ typedef enum {
4130
4212
  // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
4131
4213
  kUpb_EncodeStatus_MissingRequired = 3,
4132
4214
  } upb_EncodeStatus;
4215
+ // LINT.ThenChange(//depot/google3/third_party/protobuf/rust/upb.rs:encode_status)
4133
4216
 
4134
4217
  UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
4135
4218
  return (uint32_t)depth << 16;
@@ -4150,6 +4233,12 @@ UPB_API upb_EncodeStatus upb_Encode(const upb_Message* msg,
4150
4233
  const upb_MiniTable* l, int options,
4151
4234
  upb_Arena* arena, char** buf, size_t* size);
4152
4235
 
4236
+ // Encodes the message prepended by a varint of the serialized length.
4237
+ UPB_API upb_EncodeStatus upb_EncodeLengthPrefixed(const upb_Message* msg,
4238
+ const upb_MiniTable* l,
4239
+ int options, upb_Arena* arena,
4240
+ char** buf, size_t* size);
4241
+
4153
4242
  #ifdef __cplusplus
4154
4243
  } /* extern "C" */
4155
4244
  #endif
@@ -4333,6 +4422,7 @@ extern const upb_MiniTable google__protobuf__FileOptions_msg_init;
4333
4422
  extern const upb_MiniTable google__protobuf__MessageOptions_msg_init;
4334
4423
  extern const upb_MiniTable google__protobuf__FieldOptions_msg_init;
4335
4424
  extern const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init;
4425
+ extern const upb_MiniTable google__protobuf__FieldOptions__FeatureSupport_msg_init;
4336
4426
  extern const upb_MiniTable google__protobuf__OneofOptions_msg_init;
4337
4427
  extern const upb_MiniTable google__protobuf__EnumOptions_msg_init;
4338
4428
  extern const upb_MiniTable google__protobuf__EnumValueOptions_msg_init;
@@ -4404,8 +4494,8 @@ typedef struct {
4404
4494
  const char* end; // Can read up to SlopBytes bytes beyond this.
4405
4495
  const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0)
4406
4496
  uintptr_t aliasing;
4407
- int limit; // Submessage limit relative to end
4408
- bool error; // To distinguish between EOF and error.
4497
+ int limit; // Submessage limit relative to end
4498
+ bool error; // To distinguish between EOF and error.
4409
4499
  char patch[kUpb_EpsCopyInputStream_SlopBytes * 2];
4410
4500
  } upb_EpsCopyInputStream;
4411
4501
 
@@ -4742,7 +4832,7 @@ typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc(
4742
4832
  // fits within this buffer, calls `func` with `ctx` as a parameter, where the
4743
4833
  // pushing and popping of limits is handled automatically and with lower cost
4744
4834
  // than the normal PushLimit()/PopLimit() sequence.
4745
- static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
4835
+ UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
4746
4836
  upb_EpsCopyInputStream* e, const char** ptr, int len,
4747
4837
  upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
4748
4838
  if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) {
@@ -4837,6 +4927,7 @@ typedef struct google_protobuf_FileOptions { upb_Message UPB_PRIVATE(base); } go
4837
4927
  typedef struct google_protobuf_MessageOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_MessageOptions;
4838
4928
  typedef struct google_protobuf_FieldOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions;
4839
4929
  typedef struct google_protobuf_FieldOptions_EditionDefault { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions_EditionDefault;
4930
+ typedef struct google_protobuf_FieldOptions_FeatureSupport { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions_FeatureSupport;
4840
4931
  typedef struct google_protobuf_OneofOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_OneofOptions;
4841
4932
  typedef struct google_protobuf_EnumOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumOptions;
4842
4933
  typedef struct google_protobuf_EnumValueOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumValueOptions;
@@ -4856,6 +4947,7 @@ typedef enum {
4856
4947
  google_protobuf_EDITION_UNKNOWN = 0,
4857
4948
  google_protobuf_EDITION_1_TEST_ONLY = 1,
4858
4949
  google_protobuf_EDITION_2_TEST_ONLY = 2,
4950
+ google_protobuf_EDITION_LEGACY = 900,
4859
4951
  google_protobuf_EDITION_PROTO2 = 998,
4860
4952
  google_protobuf_EDITION_PROTO3 = 999,
4861
4953
  google_protobuf_EDITION_2023 = 1000,
@@ -5445,11 +5537,11 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_pro
5445
5537
 
5446
5538
  UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
5447
5539
  const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5448
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
5540
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
5449
5541
  }
5450
5542
  UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
5451
5543
  const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5452
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
5544
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
5453
5545
  }
5454
5546
  UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
5455
5547
  upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
@@ -5601,7 +5693,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDesc
5601
5693
  }
5602
5694
  UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
5603
5695
  const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5604
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
5696
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
5605
5697
  }
5606
5698
  UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
5607
5699
  struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
@@ -5613,7 +5705,7 @@ UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorPro
5613
5705
  }
5614
5706
  UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
5615
5707
  const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5616
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
5708
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
5617
5709
  }
5618
5710
  UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
5619
5711
  struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
@@ -5681,11 +5773,11 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_p
5681
5773
  }
5682
5774
  UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
5683
5775
  const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5684
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
5776
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
5685
5777
  }
5686
5778
  UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) {
5687
5779
  const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5688
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
5780
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
5689
5781
  }
5690
5782
 
5691
5783
  /* google.protobuf.DescriptorProto */
@@ -6015,7 +6107,7 @@ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_name_mutable_upb
6015
6107
 
6016
6108
  UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) {
6017
6109
  const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
6018
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6110
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6019
6111
  }
6020
6112
  UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) {
6021
6113
  upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
@@ -6169,7 +6261,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_Descript
6169
6261
  }
6170
6262
  UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
6171
6263
  const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6172
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6264
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6173
6265
  }
6174
6266
  UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
6175
6267
  struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
@@ -6355,15 +6447,15 @@ UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const
6355
6447
 
6356
6448
  UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
6357
6449
  const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6358
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6450
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6359
6451
  }
6360
6452
  UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
6361
6453
  const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6362
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6454
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6363
6455
  }
6364
6456
  UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
6365
6457
  const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6366
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6458
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6367
6459
  }
6368
6460
  UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena) {
6369
6461
  struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
@@ -6445,11 +6537,11 @@ UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const goog
6445
6537
 
6446
6538
  UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
6447
6539
  const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6448
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6540
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6449
6541
  }
6450
6542
  UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
6451
6543
  const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6452
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6544
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6453
6545
  }
6454
6546
 
6455
6547
  /* google.protobuf.ExtensionRangeOptions */
@@ -6617,11 +6709,11 @@ UPB_INLINE struct google_protobuf_ExtensionRangeOptions_Declaration* google_prot
6617
6709
  }
6618
6710
  UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
6619
6711
  const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6620
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6712
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6621
6713
  }
6622
6714
  UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) {
6623
6715
  const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6624
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6716
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6625
6717
  }
6626
6718
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
6627
6719
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg);
@@ -6781,23 +6873,23 @@ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(c
6781
6873
 
6782
6874
  UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
6783
6875
  const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6784
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6876
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6785
6877
  }
6786
6878
  UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
6787
6879
  const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
6788
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6880
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6789
6881
  }
6790
6882
  UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
6791
6883
  const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
6792
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6884
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6793
6885
  }
6794
6886
  UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
6795
6887
  const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
6796
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6888
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6797
6889
  }
6798
6890
  UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
6799
6891
  const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
6800
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
6892
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
6801
6893
  }
6802
6894
 
6803
6895
  /* google.protobuf.FieldDescriptorProto */
@@ -7015,35 +7107,35 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const g
7015
7107
 
7016
7108
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
7017
7109
  const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7018
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7110
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7019
7111
  }
7020
7112
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
7021
7113
  const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7022
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7114
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7023
7115
  }
7024
7116
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
7025
7117
  const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
7026
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7118
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7027
7119
  }
7028
7120
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
7029
7121
  const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
7030
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7122
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7031
7123
  }
7032
7124
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
7033
7125
  const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
7034
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7126
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7035
7127
  }
7036
7128
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
7037
7129
  const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7038
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7130
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7039
7131
  }
7040
7132
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
7041
7133
  const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7042
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7134
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7043
7135
  }
7044
7136
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
7045
7137
  const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7046
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7138
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7047
7139
  }
7048
7140
  UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) {
7049
7141
  struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
@@ -7055,15 +7147,15 @@ UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorP
7055
7147
  }
7056
7148
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
7057
7149
  const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
7058
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7150
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7059
7151
  }
7060
7152
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
7061
7153
  const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7062
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7154
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7063
7155
  }
7064
7156
  UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
7065
7157
  const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
7066
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7158
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7067
7159
  }
7068
7160
 
7069
7161
  /* google.protobuf.OneofDescriptorProto */
@@ -7137,11 +7229,11 @@ UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_pr
7137
7229
 
7138
7230
  UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) {
7139
7231
  const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7140
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7232
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7141
7233
  }
7142
7234
  UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
7143
7235
  const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7144
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7236
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7145
7237
  }
7146
7238
  UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) {
7147
7239
  struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
@@ -7319,7 +7411,7 @@ UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_mutable
7319
7411
 
7320
7412
  UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) {
7321
7413
  const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7322
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7414
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7323
7415
  }
7324
7416
  UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
7325
7417
  upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
@@ -7353,7 +7445,7 @@ UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_Enum
7353
7445
  }
7354
7446
  UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
7355
7447
  const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7356
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7448
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7357
7449
  }
7358
7450
  UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
7359
7451
  struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
@@ -7493,11 +7585,11 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(co
7493
7585
 
7494
7586
  UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
7495
7587
  const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
7496
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7588
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7497
7589
  }
7498
7590
  UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
7499
7591
  const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
7500
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7592
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7501
7593
  }
7502
7594
 
7503
7595
  /* google.protobuf.EnumValueDescriptorProto */
@@ -7587,15 +7679,15 @@ UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const googl
7587
7679
 
7588
7680
  UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) {
7589
7681
  const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7590
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7682
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7591
7683
  }
7592
7684
  UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
7593
7685
  const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
7594
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7686
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7595
7687
  }
7596
7688
  UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
7597
7689
  const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7598
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7690
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7599
7691
  }
7600
7692
  UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) {
7601
7693
  struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
@@ -7709,7 +7801,7 @@ UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_
7709
7801
 
7710
7802
  UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) {
7711
7803
  const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7712
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7804
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7713
7805
  }
7714
7806
  UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
7715
7807
  upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
@@ -7743,7 +7835,7 @@ UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_Service
7743
7835
  }
7744
7836
  UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
7745
7837
  const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7746
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7838
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7747
7839
  }
7748
7840
  UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
7749
7841
  struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
@@ -7889,19 +7981,19 @@ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const
7889
7981
 
7890
7982
  UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
7891
7983
  const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7892
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7984
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7893
7985
  }
7894
7986
  UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
7895
7987
  const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7896
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7988
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7897
7989
  }
7898
7990
  UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
7899
7991
  const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7900
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7992
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7901
7993
  }
7902
7994
  UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
7903
7995
  const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7904
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
7996
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7905
7997
  }
7906
7998
  UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) {
7907
7999
  struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
@@ -7913,11 +8005,11 @@ UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescripto
7913
8005
  }
7914
8006
  UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
7915
8007
  const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
7916
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8008
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7917
8009
  }
7918
8010
  UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
7919
8011
  const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
7920
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8012
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
7921
8013
  }
7922
8014
 
7923
8015
  /* google.protobuf.FileOptions */
@@ -8311,83 +8403,83 @@ UPB_INLINE upb_Array* _google_protobuf_FileOptions_uninterpreted_option_mutable_
8311
8403
 
8312
8404
  UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) {
8313
8405
  const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8314
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8406
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8315
8407
  }
8316
8408
  UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) {
8317
8409
  const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8318
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8410
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8319
8411
  }
8320
8412
  UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
8321
8413
  const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8322
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8414
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8323
8415
  }
8324
8416
  UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
8325
8417
  const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8326
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8418
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8327
8419
  }
8328
8420
  UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) {
8329
8421
  const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8330
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8422
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8331
8423
  }
8332
8424
  UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
8333
8425
  const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8334
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8426
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8335
8427
  }
8336
8428
  UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
8337
8429
  const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8338
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8430
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8339
8431
  }
8340
8432
  UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
8341
8433
  const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8342
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8434
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8343
8435
  }
8344
8436
  UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
8345
8437
  const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8346
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8438
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8347
8439
  }
8348
8440
  UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
8349
8441
  const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8350
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8442
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8351
8443
  }
8352
8444
  UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
8353
8445
  const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8354
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8446
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8355
8447
  }
8356
8448
  UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
8357
8449
  const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8358
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8450
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8359
8451
  }
8360
8452
  UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
8361
8453
  const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8362
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8454
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8363
8455
  }
8364
8456
  UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
8365
8457
  const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8366
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8458
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8367
8459
  }
8368
8460
  UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
8369
8461
  const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8370
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8462
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8371
8463
  }
8372
8464
  UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
8373
8465
  const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8374
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8466
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8375
8467
  }
8376
8468
  UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
8377
8469
  const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8378
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8470
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8379
8471
  }
8380
8472
  UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
8381
8473
  const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8382
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8474
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8383
8475
  }
8384
8476
  UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) {
8385
8477
  const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8386
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8478
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8387
8479
  }
8388
8480
  UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) {
8389
8481
  const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8390
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8482
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8391
8483
  }
8392
8484
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) {
8393
8485
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg);
@@ -8595,27 +8687,27 @@ UPB_INLINE upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_mutab
8595
8687
 
8596
8688
  UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
8597
8689
  const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8598
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8690
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8599
8691
  }
8600
8692
  UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
8601
8693
  const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8602
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8694
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8603
8695
  }
8604
8696
  UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
8605
8697
  const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8606
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8698
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8607
8699
  }
8608
8700
  UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
8609
8701
  const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8610
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8702
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8611
8703
  }
8612
8704
  UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) {
8613
8705
  const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8614
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8706
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8615
8707
  }
8616
8708
  UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) {
8617
8709
  const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8618
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
8710
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8619
8711
  }
8620
8712
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
8621
8713
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg);
@@ -8693,19 +8785,19 @@ UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf
8693
8785
  return ptr;
8694
8786
  }
8695
8787
  UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) {
8696
- const upb_MiniTableField field = {1, 12, 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8788
+ const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8697
8789
  upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
8698
8790
  }
8699
8791
  UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) {
8700
8792
  int32_t default_val = 0;
8701
8793
  int32_t ret;
8702
- const upb_MiniTableField field = {1, 12, 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8794
+ const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8703
8795
  _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8704
8796
  &default_val, &ret);
8705
8797
  return ret;
8706
8798
  }
8707
8799
  UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) {
8708
- const upb_MiniTableField field = {1, 12, 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8800
+ const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8709
8801
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
8710
8802
  }
8711
8803
  UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) {
@@ -8757,19 +8849,19 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_Fiel
8757
8849
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
8758
8850
  }
8759
8851
  UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) {
8760
- const upb_MiniTableField field = {6, 20, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8852
+ const upb_MiniTableField field = {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8761
8853
  upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
8762
8854
  }
8763
8855
  UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) {
8764
8856
  int32_t default_val = 0;
8765
8857
  int32_t ret;
8766
- const upb_MiniTableField field = {6, 20, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8858
+ const upb_MiniTableField field = {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8767
8859
  _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8768
8860
  &default_val, &ret);
8769
8861
  return ret;
8770
8862
  }
8771
8863
  UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) {
8772
- const upb_MiniTableField field = {6, 20, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8864
+ const upb_MiniTableField field = {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8773
8865
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
8774
8866
  }
8775
8867
  UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) {
@@ -8821,27 +8913,27 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_proto
8821
8913
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
8822
8914
  }
8823
8915
  UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) {
8824
- const upb_MiniTableField field = {17, 28, 72, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8916
+ const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8825
8917
  upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
8826
8918
  }
8827
8919
  UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) {
8828
8920
  int32_t default_val = 0;
8829
8921
  int32_t ret;
8830
- const upb_MiniTableField field = {17, 28, 72, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8922
+ const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8831
8923
  _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8832
8924
  &default_val, &ret);
8833
8925
  return ret;
8834
8926
  }
8835
8927
  UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) {
8836
- const upb_MiniTableField field = {17, 28, 72, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8928
+ const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8837
8929
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
8838
8930
  }
8839
8931
  UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
8840
- const upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8932
+ const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8841
8933
  upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
8842
8934
  }
8843
8935
  UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
8844
- const upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8936
+ const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8845
8937
  const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
8846
8938
  if (arr) {
8847
8939
  if (size) *size = arr->UPB_PRIVATE(size);
@@ -8852,7 +8944,7 @@ UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_prot
8852
8944
  }
8853
8945
  }
8854
8946
  UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
8855
- const upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8947
+ const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8856
8948
  const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
8857
8949
  if (size) {
8858
8950
  *size = arr ? arr->UPB_PRIVATE(size) : 0;
@@ -8860,7 +8952,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(cons
8860
8952
  return arr;
8861
8953
  }
8862
8954
  UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
8863
- const upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8955
+ const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8864
8956
  upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8865
8957
  &field, arena);
8866
8958
  if (size) {
@@ -8916,12 +9008,28 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_
8916
9008
  const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8917
9009
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
8918
9010
  }
9011
+ UPB_INLINE void google_protobuf_FieldOptions_clear_feature_support(google_protobuf_FieldOptions* msg) {
9012
+ const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9013
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9014
+ }
9015
+ UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_feature_support(const google_protobuf_FieldOptions* msg) {
9016
+ const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL;
9017
+ const google_protobuf_FieldOptions_FeatureSupport* ret;
9018
+ const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9019
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9020
+ &default_val, &ret);
9021
+ return ret;
9022
+ }
9023
+ UPB_INLINE bool google_protobuf_FieldOptions_has_feature_support(const google_protobuf_FieldOptions* msg) {
9024
+ const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9025
+ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9026
+ }
8919
9027
  UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
8920
- const upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9028
+ const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8921
9029
  upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
8922
9030
  }
8923
9031
  UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) {
8924
- const upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9032
+ const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8925
9033
  const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
8926
9034
  if (arr) {
8927
9035
  if (size) *size = arr->UPB_PRIVATE(size);
@@ -8932,7 +9040,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Fie
8932
9040
  }
8933
9041
  }
8934
9042
  UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
8935
- const upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9043
+ const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8936
9044
  const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
8937
9045
  if (size) {
8938
9046
  *size = arr ? arr->UPB_PRIVATE(size) : 0;
@@ -8940,7 +9048,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_u
8940
9048
  return arr;
8941
9049
  }
8942
9050
  UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
8943
- const upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9051
+ const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8944
9052
  upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8945
9053
  &field, arena);
8946
9054
  if (size) {
@@ -8950,43 +9058,43 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable
8950
9058
  }
8951
9059
 
8952
9060
  UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
8953
- const upb_MiniTableField field = {1, 12, 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8954
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9061
+ const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9062
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8955
9063
  }
8956
9064
  UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
8957
9065
  const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8958
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9066
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8959
9067
  }
8960
9068
  UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
8961
9069
  const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8962
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9070
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8963
9071
  }
8964
9072
  UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
8965
9073
  const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8966
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9074
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8967
9075
  }
8968
9076
  UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
8969
- const upb_MiniTableField field = {6, 20, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8970
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9077
+ const upb_MiniTableField field = {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9078
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8971
9079
  }
8972
9080
  UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
8973
9081
  const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8974
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9082
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8975
9083
  }
8976
9084
  UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) {
8977
9085
  const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8978
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9086
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8979
9087
  }
8980
9088
  UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) {
8981
9089
  const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
8982
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9090
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8983
9091
  }
8984
9092
  UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) {
8985
- const upb_MiniTableField field = {17, 28, 72, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8986
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9093
+ const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9094
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
8987
9095
  }
8988
9096
  UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
8989
- upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9097
+ upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8990
9098
  upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
8991
9099
  if (arr) {
8992
9100
  if (size) *size = arr->UPB_PRIVATE(size);
@@ -8997,12 +9105,12 @@ UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf
8997
9105
  }
8998
9106
  }
8999
9107
  UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
9000
- upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9108
+ upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9001
9109
  return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9002
9110
  &field, size, arena);
9003
9111
  }
9004
9112
  UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) {
9005
- upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9113
+ upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9006
9114
  upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9007
9115
  UPB_UPCAST(msg), &field, arena);
9008
9116
  if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
@@ -9045,7 +9153,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_F
9045
9153
  }
9046
9154
  UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) {
9047
9155
  const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9048
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9156
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9049
9157
  }
9050
9158
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
9051
9159
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg);
@@ -9055,8 +9163,20 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutab
9055
9163
  }
9056
9164
  return sub;
9057
9165
  }
9166
+ UPB_INLINE void google_protobuf_FieldOptions_set_feature_support(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) {
9167
+ const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9168
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9169
+ }
9170
+ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_mutable_feature_support(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
9171
+ struct google_protobuf_FieldOptions_FeatureSupport* sub = (struct google_protobuf_FieldOptions_FeatureSupport*)google_protobuf_FieldOptions_feature_support(msg);
9172
+ if (sub == NULL) {
9173
+ sub = (struct google_protobuf_FieldOptions_FeatureSupport*)_upb_Message_New(&google__protobuf__FieldOptions__FeatureSupport_msg_init, arena);
9174
+ if (sub) google_protobuf_FieldOptions_set_feature_support(msg, sub);
9175
+ }
9176
+ return sub;
9177
+ }
9058
9178
  UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) {
9059
- upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9179
+ upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9060
9180
  upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
9061
9181
  if (arr) {
9062
9182
  if (size) *size = arr->UPB_PRIVATE(size);
@@ -9067,12 +9187,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mu
9067
9187
  }
9068
9188
  }
9069
9189
  UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
9070
- upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9190
+ upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9071
9191
  return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9072
9192
  &field, size, arena);
9073
9193
  }
9074
9194
  UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
9075
- upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9195
+ upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9076
9196
  upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9077
9197
  UPB_UPCAST(msg), &field, arena);
9078
9198
  if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
@@ -9157,11 +9277,129 @@ UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const go
9157
9277
 
9158
9278
  UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
9159
9279
  const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9160
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9280
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9161
9281
  }
9162
9282
  UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) {
9163
9283
  const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9164
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9284
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9285
+ }
9286
+
9287
+ /* google.protobuf.FieldOptions.FeatureSupport */
9288
+
9289
+ UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_new(upb_Arena* arena) {
9290
+ return (google_protobuf_FieldOptions_FeatureSupport*)_upb_Message_New(&google__protobuf__FieldOptions__FeatureSupport_msg_init, arena);
9291
+ }
9292
+ UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_parse(const char* buf, size_t size, upb_Arena* arena) {
9293
+ google_protobuf_FieldOptions_FeatureSupport* ret = google_protobuf_FieldOptions_FeatureSupport_new(arena);
9294
+ if (!ret) return NULL;
9295
+ if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__FeatureSupport_msg_init, NULL, 0, arena) !=
9296
+ kUpb_DecodeStatus_Ok) {
9297
+ return NULL;
9298
+ }
9299
+ return ret;
9300
+ }
9301
+ UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_parse_ex(const char* buf, size_t size,
9302
+ const upb_ExtensionRegistry* extreg,
9303
+ int options, upb_Arena* arena) {
9304
+ google_protobuf_FieldOptions_FeatureSupport* ret = google_protobuf_FieldOptions_FeatureSupport_new(arena);
9305
+ if (!ret) return NULL;
9306
+ if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__FeatureSupport_msg_init, extreg, options,
9307
+ arena) != kUpb_DecodeStatus_Ok) {
9308
+ return NULL;
9309
+ }
9310
+ return ret;
9311
+ }
9312
+ UPB_INLINE char* google_protobuf_FieldOptions_FeatureSupport_serialize(const google_protobuf_FieldOptions_FeatureSupport* msg, upb_Arena* arena, size_t* len) {
9313
+ char* ptr;
9314
+ (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__FeatureSupport_msg_init, 0, arena, &ptr, len);
9315
+ return ptr;
9316
+ }
9317
+ UPB_INLINE char* google_protobuf_FieldOptions_FeatureSupport_serialize_ex(const google_protobuf_FieldOptions_FeatureSupport* msg, int options,
9318
+ upb_Arena* arena, size_t* len) {
9319
+ char* ptr;
9320
+ (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__FeatureSupport_msg_init, options, arena, &ptr, len);
9321
+ return ptr;
9322
+ }
9323
+ UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_introduced(google_protobuf_FieldOptions_FeatureSupport* msg) {
9324
+ const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9325
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9326
+ }
9327
+ UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_introduced(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9328
+ int32_t default_val = 0;
9329
+ int32_t ret;
9330
+ const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9331
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9332
+ &default_val, &ret);
9333
+ return ret;
9334
+ }
9335
+ UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_introduced(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9336
+ const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9337
+ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9338
+ }
9339
+ UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_deprecated(google_protobuf_FieldOptions_FeatureSupport* msg) {
9340
+ const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9341
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9342
+ }
9343
+ UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_deprecated(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9344
+ int32_t default_val = 0;
9345
+ int32_t ret;
9346
+ const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9347
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9348
+ &default_val, &ret);
9349
+ return ret;
9350
+ }
9351
+ UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_deprecated(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9352
+ const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9353
+ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9354
+ }
9355
+ UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_deprecation_warning(google_protobuf_FieldOptions_FeatureSupport* msg) {
9356
+ const upb_MiniTableField field = {3, 24, 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9357
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9358
+ }
9359
+ UPB_INLINE upb_StringView google_protobuf_FieldOptions_FeatureSupport_deprecation_warning(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9360
+ upb_StringView default_val = upb_StringView_FromString("");
9361
+ upb_StringView ret;
9362
+ const upb_MiniTableField field = {3, 24, 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9363
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9364
+ &default_val, &ret);
9365
+ return ret;
9366
+ }
9367
+ UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_deprecation_warning(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9368
+ const upb_MiniTableField field = {3, 24, 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9369
+ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9370
+ }
9371
+ UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_removed(google_protobuf_FieldOptions_FeatureSupport* msg) {
9372
+ const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9373
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9374
+ }
9375
+ UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_removed(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9376
+ int32_t default_val = 0;
9377
+ int32_t ret;
9378
+ const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9379
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9380
+ &default_val, &ret);
9381
+ return ret;
9382
+ }
9383
+ UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_removed(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9384
+ const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9385
+ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9386
+ }
9387
+
9388
+ UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_introduced(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9389
+ const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9390
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9391
+ }
9392
+ UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_deprecated(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9393
+ const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9394
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9395
+ }
9396
+ UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_deprecation_warning(google_protobuf_FieldOptions_FeatureSupport *msg, upb_StringView value) {
9397
+ const upb_MiniTableField field = {3, 24, 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9398
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9399
+ }
9400
+ UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_removed(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9401
+ const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9402
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9165
9403
  }
9166
9404
 
9167
9405
  /* google.protobuf.OneofOptions */
@@ -9251,7 +9489,7 @@ UPB_INLINE upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_mutable
9251
9489
 
9252
9490
  UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) {
9253
9491
  const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9254
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9492
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9255
9493
  }
9256
9494
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
9257
9495
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg);
@@ -9427,19 +9665,19 @@ UPB_INLINE upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_mutable_
9427
9665
 
9428
9666
  UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
9429
9667
  const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
9430
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9668
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9431
9669
  }
9432
9670
  UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
9433
9671
  const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
9434
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9672
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9435
9673
  }
9436
9674
  UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) {
9437
9675
  const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
9438
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9676
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9439
9677
  }
9440
9678
  UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) {
9441
9679
  const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9442
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9680
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9443
9681
  }
9444
9682
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
9445
9683
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg);
@@ -9564,12 +9802,28 @@ UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_p
9564
9802
  const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
9565
9803
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9566
9804
  }
9805
+ UPB_INLINE void google_protobuf_EnumValueOptions_clear_feature_support(google_protobuf_EnumValueOptions* msg) {
9806
+ const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9807
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9808
+ }
9809
+ UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_EnumValueOptions_feature_support(const google_protobuf_EnumValueOptions* msg) {
9810
+ const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL;
9811
+ const google_protobuf_FieldOptions_FeatureSupport* ret;
9812
+ const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9813
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9814
+ &default_val, &ret);
9815
+ return ret;
9816
+ }
9817
+ UPB_INLINE bool google_protobuf_EnumValueOptions_has_feature_support(const google_protobuf_EnumValueOptions* msg) {
9818
+ const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9819
+ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9820
+ }
9567
9821
  UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) {
9568
- const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9822
+ const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9569
9823
  upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9570
9824
  }
9571
9825
  UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) {
9572
- const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9826
+ const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9573
9827
  const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
9574
9828
  if (arr) {
9575
9829
  if (size) *size = arr->UPB_PRIVATE(size);
@@ -9580,7 +9834,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Enu
9580
9834
  }
9581
9835
  }
9582
9836
  UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) {
9583
- const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9837
+ const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9584
9838
  const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
9585
9839
  if (size) {
9586
9840
  *size = arr ? arr->UPB_PRIVATE(size) : 0;
@@ -9588,7 +9842,7 @@ UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_opti
9588
9842
  return arr;
9589
9843
  }
9590
9844
  UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) {
9591
- const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9845
+ const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9592
9846
  upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9593
9847
  &field, arena);
9594
9848
  if (size) {
@@ -9599,11 +9853,11 @@ UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mut
9599
9853
 
9600
9854
  UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
9601
9855
  const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
9602
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9856
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9603
9857
  }
9604
9858
  UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) {
9605
9859
  const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9606
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9860
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9607
9861
  }
9608
9862
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
9609
9863
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg);
@@ -9615,10 +9869,22 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_m
9615
9869
  }
9616
9870
  UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) {
9617
9871
  const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
9618
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9872
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9873
+ }
9874
+ UPB_INLINE void google_protobuf_EnumValueOptions_set_feature_support(google_protobuf_EnumValueOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) {
9875
+ const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9876
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9877
+ }
9878
+ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_EnumValueOptions_mutable_feature_support(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
9879
+ struct google_protobuf_FieldOptions_FeatureSupport* sub = (struct google_protobuf_FieldOptions_FeatureSupport*)google_protobuf_EnumValueOptions_feature_support(msg);
9880
+ if (sub == NULL) {
9881
+ sub = (struct google_protobuf_FieldOptions_FeatureSupport*)_upb_Message_New(&google__protobuf__FieldOptions__FeatureSupport_msg_init, arena);
9882
+ if (sub) google_protobuf_EnumValueOptions_set_feature_support(msg, sub);
9883
+ }
9884
+ return sub;
9619
9885
  }
9620
9886
  UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) {
9621
- upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9887
+ upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9622
9888
  upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
9623
9889
  if (arr) {
9624
9890
  if (size) *size = arr->UPB_PRIVATE(size);
@@ -9629,12 +9895,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOption
9629
9895
  }
9630
9896
  }
9631
9897
  UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) {
9632
- upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9898
+ upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9633
9899
  return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9634
9900
  &field, size, arena);
9635
9901
  }
9636
9902
  UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
9637
- upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9903
+ upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9638
9904
  upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9639
9905
  UPB_UPCAST(msg), &field, arena);
9640
9906
  if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
@@ -9751,11 +10017,11 @@ UPB_INLINE upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_mutab
9751
10017
 
9752
10018
  UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
9753
10019
  const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
9754
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10020
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9755
10021
  }
9756
10022
  UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) {
9757
10023
  const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9758
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10024
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9759
10025
  }
9760
10026
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
9761
10027
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg);
@@ -9915,15 +10181,15 @@ UPB_INLINE upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_mutabl
9915
10181
 
9916
10182
  UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
9917
10183
  const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
9918
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10184
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9919
10185
  }
9920
10186
  UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
9921
10187
  const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9922
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10188
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9923
10189
  }
9924
10190
  UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) {
9925
10191
  const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9926
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10192
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
9927
10193
  }
9928
10194
  UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
9929
10195
  struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg);
@@ -10161,27 +10427,27 @@ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_
10161
10427
  }
10162
10428
  UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
10163
10429
  const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
10164
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10430
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10165
10431
  }
10166
10432
  UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
10167
10433
  const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
10168
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10434
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10169
10435
  }
10170
10436
  UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
10171
10437
  const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
10172
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10438
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10173
10439
  }
10174
10440
  UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
10175
10441
  const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
10176
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10442
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10177
10443
  }
10178
10444
  UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
10179
10445
  const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
10180
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10446
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10181
10447
  }
10182
10448
  UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
10183
10449
  const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
10184
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10450
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10185
10451
  }
10186
10452
 
10187
10453
  /* google.protobuf.UninterpretedOption.NamePart */
@@ -10255,11 +10521,11 @@ UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(co
10255
10521
 
10256
10522
  UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) {
10257
10523
  const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
10258
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10524
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10259
10525
  }
10260
10526
  UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
10261
10527
  const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
10262
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10528
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10263
10529
  }
10264
10530
 
10265
10531
  /* google.protobuf.FeatureSet */
@@ -10397,27 +10663,27 @@ UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf
10397
10663
 
10398
10664
  UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) {
10399
10665
  const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10400
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10666
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10401
10667
  }
10402
10668
  UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) {
10403
10669
  const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10404
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10670
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10405
10671
  }
10406
10672
  UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
10407
10673
  const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10408
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10674
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10409
10675
  }
10410
10676
  UPB_INLINE void google_protobuf_FeatureSet_set_utf8_validation(google_protobuf_FeatureSet *msg, int32_t value) {
10411
10677
  const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10412
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10678
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10413
10679
  }
10414
10680
  UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
10415
10681
  const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10416
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10682
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10417
10683
  }
10418
10684
  UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) {
10419
10685
  const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10420
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10686
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10421
10687
  }
10422
10688
 
10423
10689
  /* google.protobuf.FeatureSetDefaults */
@@ -10553,11 +10819,11 @@ UPB_INLINE struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* g
10553
10819
  }
10554
10820
  UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
10555
10821
  const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10556
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10822
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10557
10823
  }
10558
10824
  UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
10559
10825
  const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10560
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10826
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10561
10827
  }
10562
10828
 
10563
10829
  /* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */
@@ -10596,54 +10862,82 @@ UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_ser
10596
10862
  (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, options, arena, &ptr, len);
10597
10863
  return ptr;
10598
10864
  }
10599
- UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10600
- const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10865
+ UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10866
+ const upb_MiniTableField field = {3, 12, 64, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10867
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
10868
+ }
10869
+ UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10870
+ int32_t default_val = 0;
10871
+ int32_t ret;
10872
+ const upb_MiniTableField field = {3, 12, 64, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10873
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10874
+ &default_val, &ret);
10875
+ return ret;
10876
+ }
10877
+ UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10878
+ const upb_MiniTableField field = {3, 12, 64, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10879
+ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
10880
+ }
10881
+ UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10882
+ const upb_MiniTableField field = {4, 16, 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10601
10883
  upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
10602
10884
  }
10603
- UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10885
+ UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_overridable_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10604
10886
  const google_protobuf_FeatureSet* default_val = NULL;
10605
10887
  const google_protobuf_FeatureSet* ret;
10606
- const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10888
+ const upb_MiniTableField field = {4, 16, 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10607
10889
  _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10608
10890
  &default_val, &ret);
10609
10891
  return ret;
10610
10892
  }
10611
- UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10612
- const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10893
+ UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_overridable_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10894
+ const upb_MiniTableField field = {4, 16, 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10613
10895
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
10614
10896
  }
10615
- UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10616
- const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10897
+ UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10898
+ const upb_MiniTableField field = {5, UPB_SIZE(20, 24), 66, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10617
10899
  upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
10618
10900
  }
10619
- UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10620
- int32_t default_val = 0;
10621
- int32_t ret;
10622
- const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10901
+ UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_fixed_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10902
+ const google_protobuf_FeatureSet* default_val = NULL;
10903
+ const google_protobuf_FeatureSet* ret;
10904
+ const upb_MiniTableField field = {5, UPB_SIZE(20, 24), 66, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10623
10905
  _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10624
10906
  &default_val, &ret);
10625
10907
  return ret;
10626
10908
  }
10627
- UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10628
- const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10909
+ UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_fixed_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10910
+ const upb_MiniTableField field = {5, UPB_SIZE(20, 24), 66, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10629
10911
  return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
10630
10912
  }
10631
10913
 
10632
- UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
10633
- const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10634
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10914
+ UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
10915
+ const upb_MiniTableField field = {3, 12, 64, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10916
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10917
+ }
10918
+ UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
10919
+ const upb_MiniTableField field = {4, 16, 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10920
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10635
10921
  }
10636
- UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10637
- struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg);
10922
+ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10923
+ struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_overridable_features(msg);
10638
10924
  if (sub == NULL) {
10639
10925
  sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
10640
- if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub);
10926
+ if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_overridable_features(msg, sub);
10641
10927
  }
10642
10928
  return sub;
10643
10929
  }
10644
- UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
10645
- const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10646
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10930
+ UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
10931
+ const upb_MiniTableField field = {5, UPB_SIZE(20, 24), 66, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10932
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10933
+ }
10934
+ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10935
+ struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_fixed_features(msg);
10936
+ if (sub == NULL) {
10937
+ sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
10938
+ if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_fixed_features(msg, sub);
10939
+ }
10940
+ return sub;
10647
10941
  }
10648
10942
 
10649
10943
  /* google.protobuf.SourceCodeInfo */
@@ -10969,11 +11263,11 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf
10969
11263
  }
10970
11264
  UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
10971
11265
  const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
10972
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
11266
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10973
11267
  }
10974
11268
  UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
10975
11269
  const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
10976
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
11270
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
10977
11271
  }
10978
11272
  UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
10979
11273
  upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
@@ -11267,19 +11561,19 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_pro
11267
11561
  }
11268
11562
  UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) {
11269
11563
  const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
11270
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
11564
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
11271
11565
  }
11272
11566
  UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
11273
11567
  const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
11274
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
11568
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
11275
11569
  }
11276
11570
  UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
11277
11571
  const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
11278
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
11572
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
11279
11573
  }
11280
11574
  UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
11281
11575
  const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
11282
- _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
11576
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
11283
11577
  }
11284
11578
 
11285
11579
  /* Max size 32 is google.protobuf.FileOptions */
@@ -11421,8 +11715,8 @@ const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
11421
11715
  const upb_MessageDef* m,
11422
11716
  int32_t fieldnum);
11423
11717
 
11424
- const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s,
11425
- const char* name);
11718
+ UPB_API const upb_ServiceDef* upb_DefPool_FindServiceByName(
11719
+ const upb_DefPool* s, const char* name);
11426
11720
 
11427
11721
  const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
11428
11722
  const upb_DefPool* s, const char* name, size_t size);
@@ -11473,6 +11767,7 @@ UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
11473
11767
  UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
11474
11768
  bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
11475
11769
  bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
11770
+ bool upb_EnumDef_IsSpecifiedAsClosed(const upb_EnumDef* e);
11476
11771
 
11477
11772
  // Creates a mini descriptor string for an enum, returns true on success.
11478
11773
  bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
@@ -11601,8 +11896,10 @@ bool upb_FieldDef_IsString(const upb_FieldDef* f);
11601
11896
  UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
11602
11897
  UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
11603
11898
  UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
11899
+ uint32_t upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
11604
11900
  UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
11605
11901
  bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f);
11902
+ bool _upb_FieldDef_IsGroupLike(const upb_FieldDef* f);
11606
11903
 
11607
11904
  // Creates a mini descriptor string for a field, returns true on success.
11608
11905
  bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a,
@@ -11671,6 +11968,9 @@ int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f);
11671
11968
  const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i);
11672
11969
  int upb_FileDef_WeakDependencyCount(const upb_FileDef* f);
11673
11970
 
11971
+ // Returns whether |symbol| is transitively included by |f|
11972
+ bool upb_FileDef_Resolves(const upb_FileDef* f, const char* symbol);
11973
+
11674
11974
  #ifdef __cplusplus
11675
11975
  } /* extern "C" */
11676
11976
  #endif
@@ -11838,18 +12138,19 @@ UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
11838
12138
  extern "C" {
11839
12139
  #endif
11840
12140
 
11841
- bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
12141
+ UPB_API bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
11842
12142
  const char* upb_MethodDef_FullName(const upb_MethodDef* m);
11843
12143
  bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
11844
12144
  int upb_MethodDef_Index(const upb_MethodDef* m);
11845
- const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
11846
- const char* upb_MethodDef_Name(const upb_MethodDef* m);
11847
- const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m);
12145
+ UPB_API const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
12146
+ UPB_API const char* upb_MethodDef_Name(const upb_MethodDef* m);
12147
+ UPB_API const UPB_DESC(MethodOptions) *
12148
+ upb_MethodDef_Options(const upb_MethodDef* m);
11848
12149
  const UPB_DESC(FeatureSet) *
11849
12150
  upb_MethodDef_ResolvedFeatures(const upb_MethodDef* m);
11850
- const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
11851
- bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
11852
- const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
12151
+ UPB_API const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
12152
+ UPB_API bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
12153
+ UPB_API const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
11853
12154
 
11854
12155
  #ifdef __cplusplus
11855
12156
  } /* extern "C" */
@@ -11910,16 +12211,17 @@ const UPB_DESC(FeatureSet*)
11910
12211
  extern "C" {
11911
12212
  #endif
11912
12213
 
11913
- const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
12214
+ UPB_API const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
11914
12215
  const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
11915
12216
  const char* name);
11916
- const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
12217
+ UPB_API const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
11917
12218
  bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
11918
12219
  int upb_ServiceDef_Index(const upb_ServiceDef* s);
11919
- const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i);
11920
- int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
12220
+ UPB_API const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s,
12221
+ int i);
12222
+ UPB_API int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
11921
12223
  const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
11922
- const UPB_DESC(ServiceOptions) *
12224
+ UPB_API const UPB_DESC(ServiceOptions) *
11923
12225
  upb_ServiceDef_Options(const upb_ServiceDef* s);
11924
12226
  const UPB_DESC(FeatureSet) *
11925
12227
  upb_ServiceDef_ResolvedFeatures(const upb_ServiceDef* s);
@@ -12293,9 +12595,9 @@ extern "C" {
12293
12595
  const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
12294
12596
  const upb_Message* msg, size_t index);
12295
12597
 
12296
- // Returns the extension with the given field number, or NULL on failure.
12297
- const upb_Extension* upb_Message_FindExtensionByNumber(const upb_Message* msg,
12298
- uint32_t field_number);
12598
+ // Returns the minitable with the given field number, or NULL on failure.
12599
+ const upb_MiniTableExtension* upb_Message_FindExtensionByNumber(
12600
+ const upb_Message* msg, uint32_t field_number);
12299
12601
 
12300
12602
  #ifdef __cplusplus
12301
12603
  } /* extern "C" */
@@ -12390,9 +12692,9 @@ UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s,
12390
12692
 
12391
12693
  UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s,
12392
12694
  _upb_sortedmap* sorted,
12393
- const struct upb_Extension** ext) {
12695
+ const upb_Extension** ext) {
12394
12696
  if (sorted->pos == sorted->end) return false;
12395
- *ext = (const struct upb_Extension*)s->entries[sorted->pos++];
12697
+ *ext = (const upb_Extension*)s->entries[sorted->pos++];
12396
12698
  return true;
12397
12699
  }
12398
12700
 
@@ -12404,9 +12706,8 @@ UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s,
12404
12706
  bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
12405
12707
  const struct upb_Map* map, _upb_sortedmap* sorted);
12406
12708
 
12407
- bool _upb_mapsorter_pushexts(_upb_mapsorter* s,
12408
- const struct upb_Extension* exts, size_t count,
12409
- _upb_sortedmap* sorted);
12709
+ bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts,
12710
+ size_t count, _upb_sortedmap* sorted);
12410
12711
 
12411
12712
  #ifdef __cplusplus
12412
12713
  } /* extern "C" */
@@ -12447,17 +12748,62 @@ UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
12447
12748
  #ifndef UPB_MESSAGE_COMPARE_H_
12448
12749
  #define UPB_MESSAGE_COMPARE_H_
12449
12750
 
12751
+ #include <stddef.h>
12752
+
12450
12753
 
12451
12754
  // Must be last.
12452
12755
 
12756
+ enum {
12757
+ // If set, upb_Message_IsEqual() will attempt to compare unknown fields.
12758
+ // By its very nature this comparison is inexact.
12759
+ kUpb_CompareOption_IncludeUnknownFields = (1 << 0)
12760
+ };
12761
+
12453
12762
  #ifdef __cplusplus
12454
12763
  extern "C" {
12455
12764
  #endif
12456
12765
 
12457
- // Compares two messages by serializing them and calling memcmp().
12458
- UPB_API bool upb_Message_IsExactlyEqual(const upb_Message* msg1,
12459
- const upb_Message* msg2,
12460
- const upb_MiniTable* m);
12766
+ // Returns true if no known fields or extensions are set in the message.
12767
+ UPB_API bool upb_Message_IsEmpty(const upb_Message* msg,
12768
+ const upb_MiniTable* m);
12769
+
12770
+ UPB_API bool upb_Message_IsEqual(const upb_Message* msg1,
12771
+ const upb_Message* msg2,
12772
+ const upb_MiniTable* m, int options);
12773
+
12774
+ // If |ctype| is a message then |m| must point to its minitable.
12775
+ UPB_API_INLINE bool upb_MessageValue_IsEqual(upb_MessageValue val1,
12776
+ upb_MessageValue val2,
12777
+ upb_CType ctype,
12778
+ const upb_MiniTable* m,
12779
+ int options) {
12780
+ switch (ctype) {
12781
+ case kUpb_CType_Bool:
12782
+ return val1.bool_val == val2.bool_val;
12783
+
12784
+ case kUpb_CType_Float:
12785
+ case kUpb_CType_Int32:
12786
+ case kUpb_CType_UInt32:
12787
+ case kUpb_CType_Enum:
12788
+ return val1.int32_val == val2.int32_val;
12789
+
12790
+ case kUpb_CType_Double:
12791
+ case kUpb_CType_Int64:
12792
+ case kUpb_CType_UInt64:
12793
+ return val1.int64_val == val2.int64_val;
12794
+
12795
+ case kUpb_CType_String:
12796
+ case kUpb_CType_Bytes:
12797
+ return upb_StringView_IsEqual(val1.str_val, val2.str_val);
12798
+
12799
+ case kUpb_CType_Message:
12800
+ return upb_Message_IsEqual(val1.msg_val, val2.msg_val, m, options);
12801
+
12802
+ default:
12803
+ UPB_UNREACHABLE();
12804
+ return false;
12805
+ }
12806
+ }
12461
12807
 
12462
12808
  #ifdef __cplusplus
12463
12809
  } /* extern "C" */
@@ -12466,6 +12812,47 @@ UPB_API bool upb_Message_IsExactlyEqual(const upb_Message* msg1,
12466
12812
 
12467
12813
  #endif // UPB_MESSAGE_COMPARE_H_
12468
12814
 
12815
+ #ifndef UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
12816
+ #define UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
12817
+
12818
+ #include <stddef.h>
12819
+
12820
+ // Must be last.
12821
+
12822
+ #ifdef __cplusplus
12823
+ extern "C" {
12824
+ #endif
12825
+
12826
+ // Returns true if unknown fields from the two messages are equal when sorted
12827
+ // and varints are made canonical.
12828
+ //
12829
+ // This function is discouraged, as the comparison is inherently lossy without
12830
+ // schema data:
12831
+ //
12832
+ // 1. We don't know whether delimited fields are sub-messages. Unknown
12833
+ // sub-messages will therefore not have their fields sorted and varints
12834
+ // canonicalized.
12835
+ // 2. We don't know about oneof/non-repeated fields, which should semantically
12836
+ // discard every value except the last.
12837
+
12838
+ typedef enum {
12839
+ kUpb_UnknownCompareResult_Equal = 0,
12840
+ kUpb_UnknownCompareResult_NotEqual = 1,
12841
+ kUpb_UnknownCompareResult_OutOfMemory = 2,
12842
+ kUpb_UnknownCompareResult_MaxDepthExceeded = 3,
12843
+ } upb_UnknownCompareResult;
12844
+
12845
+ upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(
12846
+ const char* buf1, size_t size1, const char* buf2, size_t size2,
12847
+ int max_depth);
12848
+
12849
+ #ifdef __cplusplus
12850
+ } /* extern "C" */
12851
+ #endif
12852
+
12853
+
12854
+ #endif /* UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_ */
12855
+
12469
12856
  #ifndef UPB_MESSAGE_COPY_H_
12470
12857
  #define UPB_MESSAGE_COPY_H_
12471
12858
 
@@ -12962,7 +13349,7 @@ extern "C" {
12962
13349
  UPB_PRIVATE(_upb_WireReader_LongVarint)
12963
13350
  UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(const char* ptr, uint64_t val);
12964
13351
 
12965
- static UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)(
13352
+ UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)(
12966
13353
  const char* ptr, uint64_t* val, int maxlen, uint64_t maxval) {
12967
13354
  uint64_t byte = (uint8_t)*ptr;
12968
13355
  if (UPB_LIKELY((byte & 0x80) == 0)) {
@@ -12980,11 +13367,11 @@ static UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)(
12980
13367
  return res.ptr;
12981
13368
  }
12982
13369
 
12983
- UPB_INLINE uint32_t UPB_PRIVATE(_upb_WireReader_GetFieldNumber)(uint32_t tag) {
13370
+ UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
12984
13371
  return tag >> kUpb_WireReader_WireTypeBits;
12985
13372
  }
12986
13373
 
12987
- UPB_INLINE uint8_t UPB_PRIVATE(_upb_WireReader_GetWireType)(uint32_t tag) {
13374
+ UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
12988
13375
  return tag & kUpb_WireReader_WireTypeMask;
12989
13376
  }
12990
13377
 
@@ -13028,8 +13415,8 @@ extern "C" {
13028
13415
  // REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13029
13416
  // Bounds checks must be performed before calling this function, preferably
13030
13417
  // by calling upb_EpsCopyInputStream_IsDone().
13031
- static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
13032
- uint32_t* tag) {
13418
+ UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
13419
+ uint32_t* tag) {
13033
13420
  uint64_t val;
13034
13421
  ptr = UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, &val, 5, UINT32_MAX);
13035
13422
  if (!ptr) return NULL;
@@ -13038,14 +13425,10 @@ static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
13038
13425
  }
13039
13426
 
13040
13427
  // Given a tag, returns the field number.
13041
- UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
13042
- return UPB_PRIVATE(_upb_WireReader_GetFieldNumber)(tag);
13043
- }
13428
+ UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag);
13044
13429
 
13045
13430
  // Given a tag, returns the wire type.
13046
- UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
13047
- return UPB_PRIVATE(_upb_WireReader_GetWireType)(tag);
13048
- }
13431
+ UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag);
13049
13432
 
13050
13433
  UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr,
13051
13434
  uint64_t* val) {
@@ -13673,7 +14056,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
13673
14056
  // features. This is used for feature resolution under Editions.
13674
14057
  // NOLINTBEGIN
13675
14058
  // clang-format off
13676
- #define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\021\022\014\010\001\020\002\030\002 \003(\0010\002\030\346\007\n\021\022\014\010\002\020\001\030\001 \002(\0010\001\030\347\007\n\021\022\014\010\001\020\001\030\001 \002(\0010\001\030\350\007 \346\007(\350\007"
14059
+ #define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\023\030\346\007\"\000*\014\010\001\020\002\030\002 \003(\0010\002\n\023\030\347\007\"\000*\014\010\002\020\001\030\001 \002(\0010\001\n\023\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\000 \346\007(\350\007"
13677
14060
  // clang-format on
13678
14061
  // NOLINTEND
13679
14062
 
@@ -13953,7 +14336,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n,
13953
14336
  #undef UPB_ASAN
13954
14337
  #undef UPB_ASAN_GUARD_SIZE
13955
14338
  #undef UPB_CLANG_ASAN
13956
- #undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3
14339
+ #undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN
13957
14340
  #undef UPB_DEPRECATED
13958
14341
  #undef UPB_GNUC_MIN
13959
14342
  #undef UPB_DESCRIPTOR_UPB_H_FILENAME