google-protobuf 3.22.5-x64-mingw32 → 3.23.0.rc.1-x64-mingw32

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.

@@ -167,9 +167,18 @@
167
167
  #define UPB_LONGJMP(buf, val) longjmp(buf, val)
168
168
  #endif
169
169
 
170
+ #ifdef __GNUC__
171
+ #define UPB_USE_C11_ATOMICS
172
+ #define UPB_ATOMIC(T) _Atomic(T)
173
+ #else
174
+ #define UPB_ATOMIC(T) T
175
+ #endif
176
+
170
177
  /* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */
171
178
  #define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr))
172
179
 
180
+ #define UPB_PRIVATE(x) x##_dont_copy_me__upb_internal_use_only
181
+
173
182
  /* Configure whether fasttable is switched on or not. *************************/
174
183
 
175
184
  #ifdef __has_attribute
@@ -347,6 +356,8 @@ void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt,
347
356
  #ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_
348
357
  #define UPB_BASE_DESCRIPTOR_CONSTANTS_H_
349
358
 
359
+ // Must be last.
360
+
350
361
  // The types a field can have. Note that this list is not identical to the
351
362
  // types defined in descriptor.proto, which gives INT32 and SINT32 separate
352
363
  // types (we distinguish the two with the "integer encoding" enum below).
@@ -356,7 +367,7 @@ typedef enum {
356
367
  kUpb_CType_Float = 2,
357
368
  kUpb_CType_Int32 = 3,
358
369
  kUpb_CType_UInt32 = 4,
359
- kUpb_CType_Enum = 5, // Enum values are int32.
370
+ kUpb_CType_Enum = 5, // Enum values are int32. TODO(b/279178239): rename
360
371
  kUpb_CType_Message = 6,
361
372
  kUpb_CType_Double = 7,
362
373
  kUpb_CType_Int64 = 8,
@@ -396,6 +407,26 @@ typedef enum {
396
407
 
397
408
  #define kUpb_FieldType_SizeOf 19
398
409
 
410
+ #ifdef __cplusplus
411
+ extern "C" {
412
+ #endif
413
+
414
+ UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) {
415
+ // clang-format off
416
+ const unsigned kUnpackableTypes =
417
+ (1 << kUpb_FieldType_String) |
418
+ (1 << kUpb_FieldType_Bytes) |
419
+ (1 << kUpb_FieldType_Message) |
420
+ (1 << kUpb_FieldType_Group);
421
+ // clang-format on
422
+ return (1 << type) & ~kUnpackableTypes;
423
+ }
424
+
425
+ #ifdef __cplusplus
426
+ } /* extern "C" */
427
+ #endif
428
+
429
+
399
430
  #endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */
400
431
 
401
432
  // Users should include array.h or map.h instead.
@@ -586,12 +617,14 @@ UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); }
586
617
 
587
618
  typedef struct upb_Arena upb_Arena;
588
619
 
589
- typedef void upb_CleanupFunc(void* context);
620
+ // LINT.IfChange(arena_head)
590
621
 
591
622
  typedef struct {
592
623
  char *ptr, *end;
593
624
  } _upb_ArenaHead;
594
625
 
626
+ // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/arena.ts:arena_head)
627
+
595
628
  #ifdef __cplusplus
596
629
  extern "C" {
597
630
  #endif
@@ -602,8 +635,6 @@ extern "C" {
602
635
  UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc);
603
636
 
604
637
  UPB_API void upb_Arena_Free(upb_Arena* a);
605
- UPB_API bool upb_Arena_AddCleanup(upb_Arena* a, void* ud,
606
- upb_CleanupFunc* func);
607
638
  UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b);
608
639
 
609
640
  void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size);
@@ -817,6 +848,7 @@ UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size,
817
848
  // Resize without initializing new elements.
818
849
  UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size,
819
850
  upb_Arena* arena) {
851
+ UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking.
820
852
  if (!_upb_array_reserve(arr, size, arena)) return false;
821
853
  arr->size = size;
822
854
  return true;
@@ -1428,11 +1460,9 @@ UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
1428
1460
  #define UPB_MESSAGE_EXTENSION_INTERNAL_H_
1429
1461
 
1430
1462
 
1431
- // Public APIs for message operations that do not require descriptors.
1432
- // These functions can be used even in build that does not want to depend on
1433
- // reflection or descriptors.
1463
+ // Public APIs for message operations that do not depend on the schema.
1434
1464
  //
1435
- // Descriptor-based reflection functionality lives in reflection.h.
1465
+ // MiniTable-based accessors live in accessors.h.
1436
1466
 
1437
1467
  #ifndef UPB_MESSAGE_MESSAGE_H_
1438
1468
  #define UPB_MESSAGE_MESSAGE_H_
@@ -1479,12 +1509,18 @@ size_t upb_Message_ExtensionCount(const upb_Message* msg);
1479
1509
 
1480
1510
  // Must be last.
1481
1511
 
1512
+ // LINT.IfChange(mini_table_field_layout)
1513
+
1482
1514
  struct upb_MiniTableField {
1483
1515
  uint32_t number;
1484
1516
  uint16_t offset;
1485
1517
  int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index
1486
- uint16_t submsg_index; // kUpb_NoSub if descriptortype != MESSAGE/GROUP/ENUM
1487
- uint8_t descriptortype;
1518
+
1519
+ // Indexes into `upb_MiniTable.subs`
1520
+ // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM
1521
+ uint16_t UPB_PRIVATE(submsg_index);
1522
+
1523
+ uint8_t UPB_PRIVATE(descriptortype);
1488
1524
 
1489
1525
  // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift)
1490
1526
  uint8_t mode;
@@ -1527,6 +1563,8 @@ typedef enum {
1527
1563
 
1528
1564
  #define kUpb_FieldRep_Shift 6
1529
1565
 
1566
+ // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/mini_table_field.ts:mini_table_field_layout)
1567
+
1530
1568
  UPB_INLINE upb_FieldRep
1531
1569
  _upb_MiniTableField_GetRep(const upb_MiniTableField* field) {
1532
1570
  return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift);
@@ -1560,8 +1598,8 @@ UPB_INLINE bool upb_IsRepeatedOrMap(const upb_MiniTableField* field) {
1560
1598
  }
1561
1599
 
1562
1600
  UPB_INLINE bool upb_IsSubMessage(const upb_MiniTableField* field) {
1563
- return field->descriptortype == kUpb_FieldType_Message ||
1564
- field->descriptortype == kUpb_FieldType_Group;
1601
+ return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message ||
1602
+ field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group;
1565
1603
  }
1566
1604
 
1567
1605
  // LINT.IfChange(presence_logic)
@@ -1618,6 +1656,7 @@ UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg,
1618
1656
  }
1619
1657
 
1620
1658
  // LINT.ThenChange(GoogleInternalName2)
1659
+ // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/presence.ts:presence_logic)
1621
1660
 
1622
1661
  #ifdef __cplusplus
1623
1662
  } /* extern "C" */
@@ -1723,6 +1762,8 @@ typedef enum {
1723
1762
  kUpb_ExtMode_IsMapEntry = 4,
1724
1763
  } upb_ExtMode;
1725
1764
 
1765
+ // LINT.IfChange(mini_table_layout)
1766
+
1726
1767
  // upb_MiniTable represents the memory layout of a given upb_MessageDef.
1727
1768
  // The members are public so generated code can initialize them,
1728
1769
  // but users MUST NOT directly read or write any of its members.
@@ -1746,6 +1787,8 @@ struct upb_MiniTable {
1746
1787
  _upb_FastTable_Entry fasttable[];
1747
1788
  };
1748
1789
 
1790
+ // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/mini_table.ts:presence_logic)
1791
+
1749
1792
  // Map entries aren't actually stored for map fields, they are only used during
1750
1793
  // parsing. For parsing, it helps a lot if all map entry messages have the same
1751
1794
  // layout. The layout code in mini_table/decode.c will ensure that all map
@@ -1931,18 +1974,21 @@ typedef struct upb_ExtensionRegistry upb_ExtensionRegistry;
1931
1974
  // The arena must outlive any use of the extreg.
1932
1975
  UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena);
1933
1976
 
1977
+ UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r,
1978
+ const upb_MiniTableExtension* e);
1979
+
1934
1980
  // Adds the given extension info for the array |e| of size |count| into the
1935
1981
  // registry. If there are any errors, the entire array is backed out.
1936
1982
  // The extensions must outlive the registry.
1937
1983
  // Possible errors include OOM or an extension number that already exists.
1938
- // TODO: There is currently no way to determine the exact reason for failure.
1984
+ // TODO(salo): There is currently no way to know the exact reason for failure.
1939
1985
  bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r,
1940
1986
  const upb_MiniTableExtension** e,
1941
1987
  size_t count);
1942
1988
 
1943
1989
  // Looks up the extension (if any) defined for message type |t| and field
1944
1990
  // number |num|. Returns the extension if found, otherwise NULL.
1945
- const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
1991
+ UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
1946
1992
  const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num);
1947
1993
 
1948
1994
  #ifdef __cplusplus
@@ -2179,6 +2225,10 @@ UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
2179
2225
  #define UPB_MESSAGE_ACCESSORS_H_
2180
2226
 
2181
2227
 
2228
+ #ifndef UPB_MESSAGE_ACCESSORS_INTERNAL_H_
2229
+ #define UPB_MESSAGE_ACCESSORS_INTERNAL_H_
2230
+
2231
+
2182
2232
  #ifndef UPB_MINI_TABLE_COMMON_H_
2183
2233
  #define UPB_MINI_TABLE_COMMON_H_
2184
2234
 
@@ -2206,10 +2256,15 @@ extern "C" {
2206
2256
  UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
2207
2257
  const upb_MiniTable* table, uint32_t number);
2208
2258
 
2259
+ UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
2260
+ const upb_MiniTable* t, uint32_t index) {
2261
+ return &t->fields[index];
2262
+ }
2263
+
2209
2264
  UPB_API upb_FieldType upb_MiniTableField_Type(const upb_MiniTableField* field);
2210
2265
 
2211
2266
  UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) {
2212
- switch (f->descriptortype) {
2267
+ switch (f->UPB_PRIVATE(descriptortype)) {
2213
2268
  case kUpb_FieldType_Double:
2214
2269
  return kUpb_CType_Double;
2215
2270
  case kUpb_FieldType_Float:
@@ -2248,6 +2303,11 @@ UPB_API_INLINE bool upb_MiniTableField_IsExtension(
2248
2303
  return field->mode & kUpb_LabelFlags_IsExtension;
2249
2304
  }
2250
2305
 
2306
+ UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
2307
+ const upb_MiniTableField* field) {
2308
+ return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum;
2309
+ }
2310
+
2251
2311
  UPB_API_INLINE bool upb_MiniTableField_HasPresence(
2252
2312
  const upb_MiniTableField* field) {
2253
2313
  if (upb_MiniTableField_IsExtension(field)) {
@@ -2257,14 +2317,27 @@ UPB_API_INLINE bool upb_MiniTableField_HasPresence(
2257
2317
  }
2258
2318
  }
2259
2319
 
2320
+ // Returns the MiniTable for this message field. If the field is unlinked,
2321
+ // returns NULL.
2260
2322
  UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
2261
2323
  const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
2262
- return mini_table->subs[field->submsg_index].submsg;
2324
+ UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message);
2325
+ return mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
2263
2326
  }
2264
2327
 
2328
+ // Returns the MiniTableEnum for this enum field. If the field is unlinked,
2329
+ // returns NULL.
2265
2330
  UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
2266
2331
  const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
2267
- return mini_table->subs[field->submsg_index].subenum;
2332
+ UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum);
2333
+ return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum;
2334
+ }
2335
+
2336
+ // Returns true if this MiniTable field is linked to a MiniTable for the
2337
+ // sub-message.
2338
+ UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
2339
+ const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
2340
+ return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL;
2268
2341
  }
2269
2342
 
2270
2343
  // If this field is in a oneof, returns the first field in the oneof.
@@ -2280,10 +2353,11 @@ UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
2280
2353
  const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m,
2281
2354
  const upb_MiniTableField* f);
2282
2355
 
2283
- // Returns the next field in the oneof. If this is the last field in the
2284
- // oneof, returns NULL. The ordering of fields in the oneof is not
2356
+ // Iterates to the next field in the oneof. If this is the last field in the
2357
+ // oneof, returns false. The ordering of fields in the oneof is not
2285
2358
  // guaranteed.
2286
- // REQUIRES: |iter| is and iterator.
2359
+ // REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated
2360
+ // by prior upb_MiniTable_NextOneofField calls.
2287
2361
  bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
2288
2362
  const upb_MiniTableField** f);
2289
2363
 
@@ -2341,6 +2415,8 @@ UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg,
2341
2415
  }
2342
2416
  }
2343
2417
 
2418
+ // LINT.IfChange(message_raw_fields)
2419
+
2344
2420
  UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val,
2345
2421
  const upb_MiniTableField* field) {
2346
2422
  char zero[16] = {0};
@@ -2379,6 +2455,8 @@ UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from,
2379
2455
  UPB_UNREACHABLE();
2380
2456
  }
2381
2457
 
2458
+ // LINT.ThenChange(//depot/google3/third_party/upb/js/impl/upb_bits/message.ts:message_raw_fields)
2459
+
2382
2460
  UPB_INLINE size_t
2383
2461
  _upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
2384
2462
  const unsigned char table[] = {
@@ -2402,7 +2480,7 @@ _upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
2402
2480
  2, // kUpb_FieldType_SInt32 = 17,
2403
2481
  3, // kUpb_FieldType_SInt64 = 18,
2404
2482
  };
2405
- return table[field->descriptortype];
2483
+ return table[field->UPB_PRIVATE(descriptortype)];
2406
2484
  }
2407
2485
 
2408
2486
  // Here we define universal getter/setter functions for message fields.
@@ -2422,7 +2500,7 @@ _upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
2422
2500
  // UPB_INLINE bool upb_Message_SetBool(upb_Message* msg,
2423
2501
  // const upb_MiniTableField* field,
2424
2502
  // bool value, upb_Arena* a) {
2425
- // UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool);
2503
+ // UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool);
2426
2504
  // UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2427
2505
  // UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
2428
2506
  // _upb_Message_SetField(msg, field, &value, a);
@@ -2566,7 +2644,22 @@ UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap(
2566
2644
  return map;
2567
2645
  }
2568
2646
 
2569
- // EVERYTHING ABOVE THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
2647
+ #ifdef __cplusplus
2648
+ } /* extern "C" */
2649
+ #endif
2650
+
2651
+ #if defined(__GNUC__) && !defined(__clang__)
2652
+ #pragma GCC diagnostic pop
2653
+ #endif
2654
+
2655
+
2656
+ #endif // UPB_MESSAGE_ACCESSORS_INTERNAL_H_
2657
+
2658
+ // Must be last.
2659
+
2660
+ #ifdef __cplusplus
2661
+ extern "C" {
2662
+ #endif
2570
2663
 
2571
2664
  UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg,
2572
2665
  const upb_MiniTableField* field) {
@@ -2597,9 +2690,9 @@ UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
2597
2690
  UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
2598
2691
  const upb_MiniTableField* field,
2599
2692
  bool default_val) {
2600
- UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool);
2601
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2693
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
2602
2694
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
2695
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2603
2696
  bool ret;
2604
2697
  _upb_Message_GetField(msg, field, &default_val, &ret);
2605
2698
  return ret;
@@ -2608,21 +2701,19 @@ UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
2608
2701
  UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
2609
2702
  const upb_MiniTableField* field,
2610
2703
  bool value, upb_Arena* a) {
2611
- UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool);
2612
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2704
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
2613
2705
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
2706
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2614
2707
  return _upb_Message_SetField(msg, field, &value, a);
2615
2708
  }
2616
2709
 
2617
2710
  UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
2618
2711
  const upb_MiniTableField* field,
2619
2712
  int32_t default_val) {
2620
- UPB_ASSUME(field->descriptortype == kUpb_FieldType_Int32 ||
2621
- field->descriptortype == kUpb_FieldType_SInt32 ||
2622
- field->descriptortype == kUpb_FieldType_SFixed32 ||
2623
- field->descriptortype == kUpb_FieldType_Enum);
2624
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2713
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2714
+ upb_MiniTableField_CType(field) == kUpb_CType_Enum);
2625
2715
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
2716
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2626
2717
  int32_t ret;
2627
2718
  _upb_Message_GetField(msg, field, &default_val, &ret);
2628
2719
  return ret;
@@ -2631,21 +2722,19 @@ UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
2631
2722
  UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
2632
2723
  const upb_MiniTableField* field,
2633
2724
  int32_t value, upb_Arena* a) {
2634
- UPB_ASSUME(field->descriptortype == kUpb_FieldType_Int32 ||
2635
- field->descriptortype == kUpb_FieldType_SInt32 ||
2636
- field->descriptortype == kUpb_FieldType_SFixed32);
2637
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2725
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2726
+ upb_MiniTableField_CType(field) == kUpb_CType_Enum);
2638
2727
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
2728
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2639
2729
  return _upb_Message_SetField(msg, field, &value, a);
2640
2730
  }
2641
2731
 
2642
2732
  UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
2643
2733
  const upb_MiniTableField* field,
2644
2734
  uint32_t default_val) {
2645
- UPB_ASSUME(field->descriptortype == kUpb_FieldType_UInt32 ||
2646
- field->descriptortype == kUpb_FieldType_Fixed32);
2647
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2735
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
2648
2736
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
2737
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2649
2738
  uint32_t ret;
2650
2739
  _upb_Message_GetField(msg, field, &default_val, &ret);
2651
2740
  return ret;
@@ -2654,19 +2743,18 @@ UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
2654
2743
  UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
2655
2744
  const upb_MiniTableField* field,
2656
2745
  uint32_t value, upb_Arena* a) {
2657
- UPB_ASSUME(field->descriptortype == kUpb_FieldType_UInt32 ||
2658
- field->descriptortype == kUpb_FieldType_Fixed32);
2659
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2746
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
2660
2747
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
2748
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2661
2749
  return _upb_Message_SetField(msg, field, &value, a);
2662
2750
  }
2663
2751
 
2664
- UPB_API_INLINE void upb_Message_SetEnumProto2(
2752
+ UPB_API_INLINE void upb_Message_SetClosedEnum(
2665
2753
  upb_Message* msg, const upb_MiniTable* msg_mini_table,
2666
2754
  const upb_MiniTableField* field, int32_t value) {
2667
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Enum);
2668
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2755
+ UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field));
2669
2756
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
2757
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2670
2758
  UPB_ASSERT(upb_MiniTableEnum_CheckValue(
2671
2759
  upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value));
2672
2760
  _upb_Message_SetNonExtensionField(msg, field, &value);
@@ -2675,11 +2763,9 @@ UPB_API_INLINE void upb_Message_SetEnumProto2(
2675
2763
  UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
2676
2764
  const upb_MiniTableField* field,
2677
2765
  uint64_t default_val) {
2678
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Int64 ||
2679
- field->descriptortype == kUpb_FieldType_SInt64 ||
2680
- field->descriptortype == kUpb_FieldType_SFixed64);
2681
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2766
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
2682
2767
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
2768
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2683
2769
  int64_t ret;
2684
2770
  _upb_Message_GetField(msg, field, &default_val, &ret);
2685
2771
  return ret;
@@ -2688,21 +2774,18 @@ UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
2688
2774
  UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
2689
2775
  const upb_MiniTableField* field,
2690
2776
  int64_t value, upb_Arena* a) {
2691
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Int64 ||
2692
- field->descriptortype == kUpb_FieldType_SInt64 ||
2693
- field->descriptortype == kUpb_FieldType_SFixed64);
2694
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2777
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
2695
2778
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
2779
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2696
2780
  return _upb_Message_SetField(msg, field, &value, a);
2697
2781
  }
2698
2782
 
2699
2783
  UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
2700
2784
  const upb_MiniTableField* field,
2701
2785
  uint64_t default_val) {
2702
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_UInt64 ||
2703
- field->descriptortype == kUpb_FieldType_Fixed64);
2704
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2786
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
2705
2787
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
2788
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2706
2789
  uint64_t ret;
2707
2790
  _upb_Message_GetField(msg, field, &default_val, &ret);
2708
2791
  return ret;
@@ -2711,19 +2794,18 @@ UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
2711
2794
  UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
2712
2795
  const upb_MiniTableField* field,
2713
2796
  uint64_t value, upb_Arena* a) {
2714
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_UInt64 ||
2715
- field->descriptortype == kUpb_FieldType_Fixed64);
2716
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2797
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
2717
2798
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
2799
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2718
2800
  return _upb_Message_SetField(msg, field, &value, a);
2719
2801
  }
2720
2802
 
2721
2803
  UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
2722
2804
  const upb_MiniTableField* field,
2723
2805
  float default_val) {
2724
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Float);
2725
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2806
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
2726
2807
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
2808
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2727
2809
  float ret;
2728
2810
  _upb_Message_GetField(msg, field, &default_val, &ret);
2729
2811
  return ret;
@@ -2732,18 +2814,18 @@ UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
2732
2814
  UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
2733
2815
  const upb_MiniTableField* field,
2734
2816
  float value, upb_Arena* a) {
2735
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Float);
2736
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2817
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
2737
2818
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
2819
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2738
2820
  return _upb_Message_SetField(msg, field, &value, a);
2739
2821
  }
2740
2822
 
2741
2823
  UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
2742
2824
  const upb_MiniTableField* field,
2743
2825
  double default_val) {
2744
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Double);
2745
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2826
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
2746
2827
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
2828
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2747
2829
  double ret;
2748
2830
  _upb_Message_GetField(msg, field, &default_val, &ret);
2749
2831
  return ret;
@@ -2752,19 +2834,19 @@ UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
2752
2834
  UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
2753
2835
  const upb_MiniTableField* field,
2754
2836
  double value, upb_Arena* a) {
2755
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Double);
2756
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2837
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
2757
2838
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
2839
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2758
2840
  return _upb_Message_SetField(msg, field, &value, a);
2759
2841
  }
2760
2842
 
2761
2843
  UPB_API_INLINE upb_StringView
2762
2844
  upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
2763
2845
  upb_StringView def_val) {
2764
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Bytes ||
2765
- field->descriptortype == kUpb_FieldType_String);
2766
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2846
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2847
+ upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
2767
2848
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
2849
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2768
2850
  upb_StringView ret;
2769
2851
  _upb_Message_GetField(msg, field, &def_val, &ret);
2770
2852
  return ret;
@@ -2773,21 +2855,20 @@ upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
2773
2855
  UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
2774
2856
  const upb_MiniTableField* field,
2775
2857
  upb_StringView value, upb_Arena* a) {
2776
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Bytes ||
2777
- field->descriptortype == kUpb_FieldType_String);
2778
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2858
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2859
+ upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
2779
2860
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
2861
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2780
2862
  return _upb_Message_SetField(msg, field, &value, a);
2781
2863
  }
2782
2864
 
2783
2865
  UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
2784
2866
  const upb_Message* msg, const upb_MiniTableField* field,
2785
2867
  upb_Message* default_val) {
2786
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Message ||
2787
- field->descriptortype == kUpb_FieldType_Group);
2788
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2868
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
2789
2869
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
2790
2870
  UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
2871
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2791
2872
  upb_Message* ret;
2792
2873
  _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
2793
2874
  return ret;
@@ -2797,24 +2878,23 @@ UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
2797
2878
  const upb_MiniTable* mini_table,
2798
2879
  const upb_MiniTableField* field,
2799
2880
  upb_Message* sub_message) {
2800
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Message ||
2801
- field->descriptortype == kUpb_FieldType_Group);
2802
- UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2881
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
2803
2882
  UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
2804
2883
  UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
2805
- UPB_ASSERT(mini_table->subs[field->submsg_index].submsg);
2884
+ UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2885
+ UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg);
2806
2886
  _upb_Message_SetNonExtensionField(msg, field, &sub_message);
2807
2887
  }
2808
2888
 
2809
2889
  UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
2810
2890
  upb_Message* msg, const upb_MiniTable* mini_table,
2811
2891
  const upb_MiniTableField* field, upb_Arena* arena) {
2812
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Message ||
2813
- field->descriptortype == kUpb_FieldType_Group);
2892
+ UPB_ASSERT(arena);
2893
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
2814
2894
  upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*);
2815
2895
  if (!sub_message) {
2816
2896
  const upb_MiniTable* sub_mini_table =
2817
- mini_table->subs[field->submsg_index].submsg;
2897
+ mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
2818
2898
  UPB_ASSERT(sub_mini_table);
2819
2899
  sub_message = _upb_Message_New(sub_mini_table, arena);
2820
2900
  *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message;
@@ -2826,7 +2906,7 @@ UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
2826
2906
  UPB_API_INLINE const upb_Array* upb_Message_GetArray(
2827
2907
  const upb_Message* msg, const upb_MiniTableField* field) {
2828
2908
  _upb_MiniTableField_CheckIsArray(field);
2829
- const upb_Array* ret;
2909
+ upb_Array* ret;
2830
2910
  const upb_Array* default_val = NULL;
2831
2911
  _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
2832
2912
  return ret;
@@ -2840,6 +2920,7 @@ UPB_API_INLINE upb_Array* upb_Message_GetMutableArray(
2840
2920
 
2841
2921
  UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
2842
2922
  upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) {
2923
+ UPB_ASSERT(arena);
2843
2924
  _upb_MiniTableField_CheckIsArray(field);
2844
2925
  upb_Array* array = upb_Message_GetMutableArray(msg, field);
2845
2926
  if (!array) {
@@ -2872,15 +2953,10 @@ UPB_API_INLINE void* upb_Message_ResizeArray(upb_Message* msg,
2872
2953
  return _upb_array_ptr(arr);
2873
2954
  }
2874
2955
 
2875
- UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
2876
- const upb_MiniTableField* field) {
2877
- return field->descriptortype == kUpb_FieldType_Enum;
2878
- }
2879
-
2880
2956
  UPB_API_INLINE const upb_Map* upb_Message_GetMap(
2881
2957
  const upb_Message* msg, const upb_MiniTableField* field) {
2882
2958
  _upb_MiniTableField_CheckIsMap(field);
2883
- const upb_Map* ret;
2959
+ upb_Map* ret;
2884
2960
  const upb_Map* default_val = NULL;
2885
2961
  _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
2886
2962
  return ret;
@@ -2889,8 +2965,7 @@ UPB_API_INLINE const upb_Map* upb_Message_GetMap(
2889
2965
  UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
2890
2966
  upb_Message* msg, const upb_MiniTable* map_entry_mini_table,
2891
2967
  const upb_MiniTableField* field, upb_Arena* arena) {
2892
- UPB_ASSERT(field->descriptortype == kUpb_FieldType_Message ||
2893
- field->descriptortype == kUpb_FieldType_Group);
2968
+ UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
2894
2969
  const upb_MiniTableField* map_entry_key_field =
2895
2970
  &map_entry_mini_table->fields[0];
2896
2971
  const upb_MiniTableField* map_entry_value_field =
@@ -2909,107 +2984,10 @@ upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map,
2909
2984
  upb_Message* map_entry_message,
2910
2985
  upb_Arena* arena);
2911
2986
 
2912
- typedef enum {
2913
- kUpb_GetExtension_Ok,
2914
- kUpb_GetExtension_NotPresent,
2915
- kUpb_GetExtension_ParseError,
2916
- kUpb_GetExtension_OutOfMemory,
2917
- } upb_GetExtension_Status;
2918
-
2919
- typedef enum {
2920
- kUpb_GetExtensionAsBytes_Ok,
2921
- kUpb_GetExtensionAsBytes_NotPresent,
2922
- kUpb_GetExtensionAsBytes_EncodeError,
2923
- } upb_GetExtensionAsBytes_Status;
2924
-
2925
- // Returns a message extension or promotes an unknown field to
2926
- // an extension.
2927
- //
2928
- // TODO(ferhat): Only supports extension fields that are messages,
2929
- // expand support to include non-message types.
2930
- upb_GetExtension_Status upb_MiniTable_GetOrPromoteExtension(
2931
- upb_Message* msg, const upb_MiniTableExtension* ext_table,
2932
- int decode_options, upb_Arena* arena,
2933
- const upb_Message_Extension** extension);
2934
-
2935
- // Returns a message extension or unknown field matching the extension
2936
- // data as bytes.
2937
- //
2938
- // If an extension has already been decoded it will be re-encoded
2939
- // to bytes.
2940
- upb_GetExtensionAsBytes_Status upb_MiniTable_GetExtensionAsBytes(
2941
- const upb_Message* msg, const upb_MiniTableExtension* ext_table,
2942
- int encode_options, upb_Arena* arena, const char** extension_data,
2943
- size_t* len);
2944
-
2945
- typedef enum {
2946
- kUpb_FindUnknown_Ok,
2947
- kUpb_FindUnknown_NotPresent,
2948
- kUpb_FindUnknown_ParseError,
2949
- } upb_FindUnknown_Status;
2950
-
2951
- typedef struct {
2952
- upb_FindUnknown_Status status;
2953
- // Start of unknown field data in message arena.
2954
- const char* ptr;
2955
- // Size of unknown field data.
2956
- size_t len;
2957
- } upb_FindUnknownRet;
2958
-
2959
- // Finds first occurrence of unknown data by tag id in message.
2960
- upb_FindUnknownRet upb_MiniTable_FindUnknown(const upb_Message* msg,
2961
- uint32_t field_number);
2962
-
2963
- typedef enum {
2964
- kUpb_UnknownToMessage_Ok,
2965
- kUpb_UnknownToMessage_ParseError,
2966
- kUpb_UnknownToMessage_OutOfMemory,
2967
- kUpb_UnknownToMessage_NotFound,
2968
- } upb_UnknownToMessage_Status;
2969
-
2970
- typedef struct {
2971
- upb_UnknownToMessage_Status status;
2972
- upb_Message* message;
2973
- } upb_UnknownToMessageRet;
2974
-
2975
- // Promotes unknown data inside message to a upb_Message parsing the unknown.
2976
- //
2977
- // The unknown data is removed from message after field value is set
2978
- // using upb_Message_SetMessage.
2979
- //
2980
- // WARNING!: See b/267655898
2981
- upb_UnknownToMessageRet upb_MiniTable_PromoteUnknownToMessage(
2982
- upb_Message* msg, const upb_MiniTable* mini_table,
2983
- const upb_MiniTableField* field, const upb_MiniTable* sub_mini_table,
2984
- int decode_options, upb_Arena* arena);
2985
-
2986
- // Promotes all unknown data that matches field tag id to repeated messages
2987
- // in upb_Array.
2988
- //
2989
- // The unknown data is removed from message after upb_Array is populated.
2990
- // Since repeated messages can't be packed we remove each unknown that
2991
- // contains the target tag id.
2992
- upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMessageArray(
2993
- upb_Message* msg, const upb_MiniTableField* field,
2994
- const upb_MiniTable* mini_table, int decode_options, upb_Arena* arena);
2995
-
2996
- // Promotes all unknown data that matches field tag id to upb_Map.
2997
- //
2998
- // The unknown data is removed from message after upb_Map is populated.
2999
- // Since repeated messages can't be packed we remove each unknown that
3000
- // contains the target tag id.
3001
- upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMap(
3002
- upb_Message* msg, const upb_MiniTable* mini_table,
3003
- const upb_MiniTableField* field, int decode_options, upb_Arena* arena);
3004
-
3005
2987
  #ifdef __cplusplus
3006
2988
  } /* extern "C" */
3007
2989
  #endif
3008
2990
 
3009
- #if defined(__GNUC__) && !defined(__clang__)
3010
- #pragma GCC diagnostic pop
3011
- #endif
3012
-
3013
2991
 
3014
2992
  #endif // UPB_MESSAGE_ACCESSORS_H_
3015
2993
 
@@ -3050,14 +3028,28 @@ enum {
3050
3028
  kUpb_DecodeOption_CheckRequired = 2,
3051
3029
  };
3052
3030
 
3053
- #define UPB_DECODE_MAXDEPTH(depth) ((depth) << 16)
3031
+ UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) {
3032
+ return (uint32_t)depth << 16;
3033
+ }
3034
+
3035
+ UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) {
3036
+ return options >> 16;
3037
+ }
3038
+
3039
+ // Enforce an upper bound on recursion depth.
3040
+ UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) {
3041
+ uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options);
3042
+ if (max_depth > limit) max_depth = limit;
3043
+ return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff);
3044
+ }
3054
3045
 
3055
3046
  typedef enum {
3056
3047
  kUpb_DecodeStatus_Ok = 0,
3057
- kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
3058
- kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed
3059
- kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8
3060
- kUpb_DecodeStatus_MaxDepthExceeded = 4, // Exceeded UPB_DECODE_MAXDEPTH
3048
+ kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
3049
+ kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed
3050
+ kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8
3051
+ kUpb_DecodeStatus_MaxDepthExceeded =
3052
+ 4, // Exceeded upb_DecodeOptions_MaxDepth
3061
3053
 
3062
3054
  // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise
3063
3055
  // succeeded.
@@ -3235,24 +3227,37 @@ enum {
3235
3227
  * memory during encode. */
3236
3228
  kUpb_EncodeOption_Deterministic = 1,
3237
3229
 
3238
- /* When set, unknown fields are not printed. */
3230
+ // When set, unknown fields are not printed.
3239
3231
  kUpb_EncodeOption_SkipUnknown = 2,
3240
3232
 
3241
- /* When set, the encode will fail if any required fields are missing. */
3233
+ // When set, the encode will fail if any required fields are missing.
3242
3234
  kUpb_EncodeOption_CheckRequired = 4,
3243
3235
  };
3244
3236
 
3245
- #define UPB_ENCODE_MAXDEPTH(depth) ((depth) << 16)
3246
-
3247
3237
  typedef enum {
3248
3238
  kUpb_EncodeStatus_Ok = 0,
3249
- kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
3250
- kUpb_EncodeStatus_MaxDepthExceeded = 2, // Exceeded UPB_ENCODE_MAXDEPTH
3239
+ kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
3240
+ kUpb_EncodeStatus_MaxDepthExceeded = 2,
3251
3241
 
3252
3242
  // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
3253
3243
  kUpb_EncodeStatus_MissingRequired = 3,
3254
3244
  } upb_EncodeStatus;
3255
3245
 
3246
+ UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
3247
+ return (uint32_t)depth << 16;
3248
+ }
3249
+
3250
+ UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) {
3251
+ return options >> 16;
3252
+ }
3253
+
3254
+ // Enforce an upper bound on recursion depth.
3255
+ UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) {
3256
+ uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options);
3257
+ if (max_depth > limit) max_depth = limit;
3258
+ return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff);
3259
+ }
3260
+
3256
3261
  upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l,
3257
3262
  int options, upb_Arena* arena, char** buf,
3258
3263
  size_t* size);
@@ -3276,6 +3281,7 @@ typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
3276
3281
  typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
3277
3282
  typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
3278
3283
  typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
3284
+ typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration;
3279
3285
  typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
3280
3286
  typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
3281
3287
  typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
@@ -3303,6 +3309,7 @@ extern const upb_MiniTable google_protobuf_DescriptorProto_msg_init;
3303
3309
  extern const upb_MiniTable google_protobuf_DescriptorProto_ExtensionRange_msg_init;
3304
3310
  extern const upb_MiniTable google_protobuf_DescriptorProto_ReservedRange_msg_init;
3305
3311
  extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_msg_init;
3312
+ extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_Declaration_msg_init;
3306
3313
  extern const upb_MiniTable google_protobuf_FieldDescriptorProto_msg_init;
3307
3314
  extern const upb_MiniTable google_protobuf_OneofDescriptorProto_msg_init;
3308
3315
  extern const upb_MiniTable google_protobuf_EnumDescriptorProto_msg_init;
@@ -3325,6 +3332,11 @@ extern const upb_MiniTable google_protobuf_SourceCodeInfo_Location_msg_init;
3325
3332
  extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_msg_init;
3326
3333
  extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_Annotation_msg_init;
3327
3334
 
3335
+ typedef enum {
3336
+ google_protobuf_ExtensionRangeOptions_DECLARATION = 0,
3337
+ google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1
3338
+ } google_protobuf_ExtensionRangeOptions_VerificationState;
3339
+
3328
3340
  typedef enum {
3329
3341
  google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
3330
3342
  google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
@@ -3402,6 +3414,7 @@ typedef enum {
3402
3414
  } google_protobuf_MethodOptions_IdempotencyLevel;
3403
3415
 
3404
3416
 
3417
+ extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init;
3405
3418
  extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init;
3406
3419
  extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init;
3407
3420
  extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init;
@@ -3462,6 +3475,23 @@ UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_Fil
3462
3475
  return NULL;
3463
3476
  }
3464
3477
  }
3478
+ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorSet_file_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
3479
+ const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3480
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
3481
+ if (size) {
3482
+ *size = arr ? arr->size : 0;
3483
+ }
3484
+ return arr;
3485
+ }
3486
+ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorSet_file_mutable_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size, upb_Arena* arena) {
3487
+ const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3488
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
3489
+ (upb_Message*)msg, &field, arena);
3490
+ if (size) {
3491
+ *size = arr ? arr->size : 0;
3492
+ }
3493
+ return arr;
3494
+ }
3465
3495
  UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) {
3466
3496
  size_t size;
3467
3497
  google_protobuf_FileDescriptorSet_file(msg, &size);
@@ -3575,6 +3605,23 @@ UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(
3575
3605
  return NULL;
3576
3606
  }
3577
3607
  }
3608
+ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
3609
+ const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3610
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
3611
+ if (size) {
3612
+ *size = arr ? arr->size : 0;
3613
+ }
3614
+ return arr;
3615
+ }
3616
+ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
3617
+ const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3618
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
3619
+ (upb_Message*)msg, &field, arena);
3620
+ if (size) {
3621
+ *size = arr ? arr->size : 0;
3622
+ }
3623
+ return arr;
3624
+ }
3578
3625
  UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) {
3579
3626
  size_t size;
3580
3627
  google_protobuf_FileDescriptorProto_dependency(msg, &size);
@@ -3595,6 +3642,23 @@ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDes
3595
3642
  return NULL;
3596
3643
  }
3597
3644
  }
3645
+ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
3646
+ const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3647
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
3648
+ if (size) {
3649
+ *size = arr ? arr->size : 0;
3650
+ }
3651
+ return arr;
3652
+ }
3653
+ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
3654
+ const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3655
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
3656
+ (upb_Message*)msg, &field, arena);
3657
+ if (size) {
3658
+ *size = arr ? arr->size : 0;
3659
+ }
3660
+ return arr;
3661
+ }
3598
3662
  UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) {
3599
3663
  size_t size;
3600
3664
  google_protobuf_FileDescriptorProto_message_type(msg, &size);
@@ -3615,6 +3679,23 @@ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_Fil
3615
3679
  return NULL;
3616
3680
  }
3617
3681
  }
3682
+ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
3683
+ const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3684
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
3685
+ if (size) {
3686
+ *size = arr ? arr->size : 0;
3687
+ }
3688
+ return arr;
3689
+ }
3690
+ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
3691
+ const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3692
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
3693
+ (upb_Message*)msg, &field, arena);
3694
+ if (size) {
3695
+ *size = arr ? arr->size : 0;
3696
+ }
3697
+ return arr;
3698
+ }
3618
3699
  UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) {
3619
3700
  size_t size;
3620
3701
  google_protobuf_FileDescriptorProto_enum_type(msg, &size);
@@ -3635,6 +3716,23 @@ UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_
3635
3716
  return NULL;
3636
3717
  }
3637
3718
  }
3719
+ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
3720
+ const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3721
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
3722
+ if (size) {
3723
+ *size = arr ? arr->size : 0;
3724
+ }
3725
+ return arr;
3726
+ }
3727
+ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
3728
+ const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3729
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
3730
+ (upb_Message*)msg, &field, arena);
3731
+ if (size) {
3732
+ *size = arr ? arr->size : 0;
3733
+ }
3734
+ return arr;
3735
+ }
3638
3736
  UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) {
3639
3737
  size_t size;
3640
3738
  google_protobuf_FileDescriptorProto_service(msg, &size);
@@ -3655,6 +3753,23 @@ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_Fi
3655
3753
  return NULL;
3656
3754
  }
3657
3755
  }
3756
+ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
3757
+ const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3758
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
3759
+ if (size) {
3760
+ *size = arr ? arr->size : 0;
3761
+ }
3762
+ return arr;
3763
+ }
3764
+ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
3765
+ const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3766
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
3767
+ (upb_Message*)msg, &field, arena);
3768
+ if (size) {
3769
+ *size = arr ? arr->size : 0;
3770
+ }
3771
+ return arr;
3772
+ }
3658
3773
  UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) {
3659
3774
  size_t size;
3660
3775
  google_protobuf_FileDescriptorProto_extension(msg, &size);
@@ -3705,6 +3820,23 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(
3705
3820
  return NULL;
3706
3821
  }
3707
3822
  }
3823
+ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
3824
+ const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3825
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
3826
+ if (size) {
3827
+ *size = arr ? arr->size : 0;
3828
+ }
3829
+ return arr;
3830
+ }
3831
+ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
3832
+ const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3833
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
3834
+ (upb_Message*)msg, &field, arena);
3835
+ if (size) {
3836
+ *size = arr ? arr->size : 0;
3837
+ }
3838
+ return arr;
3839
+ }
3708
3840
  UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) {
3709
3841
  size_t size;
3710
3842
  google_protobuf_FileDescriptorProto_public_dependency(msg, &size);
@@ -3725,6 +3857,23 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(co
3725
3857
  return NULL;
3726
3858
  }
3727
3859
  }
3860
+ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
3861
+ const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3862
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
3863
+ if (size) {
3864
+ *size = arr ? arr->size : 0;
3865
+ }
3866
+ return arr;
3867
+ }
3868
+ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
3869
+ const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
3870
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
3871
+ (upb_Message*)msg, &field, arena);
3872
+ if (size) {
3873
+ *size = arr ? arr->size : 0;
3874
+ }
3875
+ return arr;
3876
+ }
3728
3877
  UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) {
3729
3878
  size_t size;
3730
3879
  google_protobuf_FileDescriptorProto_weak_dependency(msg, &size);
@@ -4043,6 +4192,23 @@ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_De
4043
4192
  return NULL;
4044
4193
  }
4045
4194
  }
4195
+ UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_field_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
4196
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4197
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4198
+ if (size) {
4199
+ *size = arr ? arr->size : 0;
4200
+ }
4201
+ return arr;
4202
+ }
4203
+ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_field_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
4204
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4205
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4206
+ (upb_Message*)msg, &field, arena);
4207
+ if (size) {
4208
+ *size = arr ? arr->size : 0;
4209
+ }
4210
+ return arr;
4211
+ }
4046
4212
  UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) {
4047
4213
  size_t size;
4048
4214
  google_protobuf_DescriptorProto_field(msg, &size);
@@ -4063,6 +4229,23 @@ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_Descrip
4063
4229
  return NULL;
4064
4230
  }
4065
4231
  }
4232
+ UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_nested_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
4233
+ const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4234
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4235
+ if (size) {
4236
+ *size = arr ? arr->size : 0;
4237
+ }
4238
+ return arr;
4239
+ }
4240
+ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_nested_type_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
4241
+ const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4242
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4243
+ (upb_Message*)msg, &field, arena);
4244
+ if (size) {
4245
+ *size = arr ? arr->size : 0;
4246
+ }
4247
+ return arr;
4248
+ }
4066
4249
  UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) {
4067
4250
  size_t size;
4068
4251
  google_protobuf_DescriptorProto_nested_type(msg, &size);
@@ -4083,6 +4266,23 @@ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_Des
4083
4266
  return NULL;
4084
4267
  }
4085
4268
  }
4269
+ UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_enum_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
4270
+ const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4271
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4272
+ if (size) {
4273
+ *size = arr ? arr->size : 0;
4274
+ }
4275
+ return arr;
4276
+ }
4277
+ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_enum_type_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
4278
+ const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4279
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4280
+ (upb_Message*)msg, &field, arena);
4281
+ if (size) {
4282
+ *size = arr ? arr->size : 0;
4283
+ }
4284
+ return arr;
4285
+ }
4086
4286
  UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) {
4087
4287
  size_t size;
4088
4288
  google_protobuf_DescriptorProto_enum_type(msg, &size);
@@ -4103,6 +4303,23 @@ UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_p
4103
4303
  return NULL;
4104
4304
  }
4105
4305
  }
4306
+ UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
4307
+ const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4308
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4309
+ if (size) {
4310
+ *size = arr ? arr->size : 0;
4311
+ }
4312
+ return arr;
4313
+ }
4314
+ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_range_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
4315
+ const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4316
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4317
+ (upb_Message*)msg, &field, arena);
4318
+ if (size) {
4319
+ *size = arr ? arr->size : 0;
4320
+ }
4321
+ return arr;
4322
+ }
4106
4323
  UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) {
4107
4324
  size_t size;
4108
4325
  google_protobuf_DescriptorProto_extension_range(msg, &size);
@@ -4123,6 +4340,23 @@ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_De
4123
4340
  return NULL;
4124
4341
  }
4125
4342
  }
4343
+ UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
4344
+ const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4345
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4346
+ if (size) {
4347
+ *size = arr ? arr->size : 0;
4348
+ }
4349
+ return arr;
4350
+ }
4351
+ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
4352
+ const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4353
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4354
+ (upb_Message*)msg, &field, arena);
4355
+ if (size) {
4356
+ *size = arr ? arr->size : 0;
4357
+ }
4358
+ return arr;
4359
+ }
4126
4360
  UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) {
4127
4361
  size_t size;
4128
4362
  google_protobuf_DescriptorProto_extension(msg, &size);
@@ -4158,6 +4392,23 @@ UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_De
4158
4392
  return NULL;
4159
4393
  }
4160
4394
  }
4395
+ UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_oneof_decl_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
4396
+ const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4397
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4398
+ if (size) {
4399
+ *size = arr ? arr->size : 0;
4400
+ }
4401
+ return arr;
4402
+ }
4403
+ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_oneof_decl_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
4404
+ const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4405
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4406
+ (upb_Message*)msg, &field, arena);
4407
+ if (size) {
4408
+ *size = arr ? arr->size : 0;
4409
+ }
4410
+ return arr;
4411
+ }
4161
4412
  UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) {
4162
4413
  size_t size;
4163
4414
  google_protobuf_DescriptorProto_oneof_decl(msg, &size);
@@ -4178,6 +4429,23 @@ UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_pr
4178
4429
  return NULL;
4179
4430
  }
4180
4431
  }
4432
+ UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
4433
+ const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4434
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4435
+ if (size) {
4436
+ *size = arr ? arr->size : 0;
4437
+ }
4438
+ return arr;
4439
+ }
4440
+ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_range_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
4441
+ const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4442
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4443
+ (upb_Message*)msg, &field, arena);
4444
+ if (size) {
4445
+ *size = arr ? arr->size : 0;
4446
+ }
4447
+ return arr;
4448
+ }
4181
4449
  UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) {
4182
4450
  size_t size;
4183
4451
  google_protobuf_DescriptorProto_reserved_range(msg, &size);
@@ -4198,6 +4466,23 @@ UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(c
4198
4466
  return NULL;
4199
4467
  }
4200
4468
  }
4469
+ UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_name_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
4470
+ const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4471
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4472
+ if (size) {
4473
+ *size = arr ? arr->size : 0;
4474
+ }
4475
+ return arr;
4476
+ }
4477
+ UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_name_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
4478
+ const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4479
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4480
+ (upb_Message*)msg, &field, arena);
4481
+ if (size) {
4482
+ *size = arr ? arr->size : 0;
4483
+ }
4484
+ return arr;
4485
+ }
4201
4486
  UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) {
4202
4487
  size_t size;
4203
4488
  google_protobuf_DescriptorProto_reserved_name(msg, &size);
@@ -4639,12 +4924,64 @@ UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google
4639
4924
  (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, options, arena, &ptr, len);
4640
4925
  return ptr;
4641
4926
  }
4927
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) {
4928
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4929
+ _upb_Message_ClearNonExtensionField(msg, &field);
4930
+ }
4931
+ UPB_INLINE const google_protobuf_ExtensionRangeOptions_Declaration* const* google_protobuf_ExtensionRangeOptions_declaration(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
4932
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4933
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4934
+ if (arr) {
4935
+ if (size) *size = arr->size;
4936
+ return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr);
4937
+ } else {
4938
+ if (size) *size = 0;
4939
+ return NULL;
4940
+ }
4941
+ }
4942
+ UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
4943
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4944
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4945
+ if (size) {
4946
+ *size = arr ? arr->size : 0;
4947
+ }
4948
+ return arr;
4949
+ }
4950
+ UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_mutable_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
4951
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4952
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4953
+ (upb_Message*)msg, &field, arena);
4954
+ if (size) {
4955
+ *size = arr ? arr->size : 0;
4956
+ }
4957
+ return arr;
4958
+ }
4959
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) {
4960
+ size_t size;
4961
+ google_protobuf_ExtensionRangeOptions_declaration(msg, &size);
4962
+ return size != 0;
4963
+ }
4964
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) {
4965
+ const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
4966
+ _upb_Message_ClearNonExtensionField(msg, &field);
4967
+ }
4968
+ UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) {
4969
+ int32_t default_val = 1;
4970
+ int32_t ret;
4971
+ const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
4972
+ _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
4973
+ return ret;
4974
+ }
4975
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) {
4976
+ const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
4977
+ return _upb_Message_HasNonExtensionField(msg, &field);
4978
+ }
4642
4979
  UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) {
4643
- const upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4980
+ const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4644
4981
  _upb_Message_ClearNonExtensionField(msg, &field);
4645
4982
  }
4646
4983
  UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
4647
- const upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4984
+ const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4648
4985
  const upb_Array* arr = upb_Message_GetArray(msg, &field);
4649
4986
  if (arr) {
4650
4987
  if (size) *size = arr->size;
@@ -4654,14 +4991,61 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Ext
4654
4991
  return NULL;
4655
4992
  }
4656
4993
  }
4994
+ UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
4995
+ const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4996
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
4997
+ if (size) {
4998
+ *size = arr ? arr->size : 0;
4999
+ }
5000
+ return arr;
5001
+ }
5002
+ UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
5003
+ const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5004
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5005
+ (upb_Message*)msg, &field, arena);
5006
+ if (size) {
5007
+ *size = arr ? arr->size : 0;
5008
+ }
5009
+ return arr;
5010
+ }
4657
5011
  UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) {
4658
5012
  size_t size;
4659
5013
  google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size);
4660
5014
  return size != 0;
4661
5015
  }
4662
5016
 
5017
+ UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_mutable_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
5018
+ upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5019
+ upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5020
+ if (arr) {
5021
+ if (size) *size = arr->size;
5022
+ return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr);
5023
+ } else {
5024
+ if (size) *size = 0;
5025
+ return NULL;
5026
+ }
5027
+ }
5028
+ UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_resize_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
5029
+ upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5030
+ return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArray(msg, &field, size, arena);
5031
+ }
5032
+ UPB_INLINE struct google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_add_declaration(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
5033
+ upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5034
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5035
+ if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5036
+ return NULL;
5037
+ }
5038
+ struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena);
5039
+ if (!arr || !sub) return NULL;
5040
+ _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
5041
+ return sub;
5042
+ }
5043
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
5044
+ const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5045
+ _upb_Message_SetNonExtensionField(msg, &field, &value);
5046
+ }
4663
5047
  UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
4664
- upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5048
+ upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4665
5049
  upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4666
5050
  if (arr) {
4667
5051
  if (size) *size = arr->size;
@@ -4672,11 +5056,11 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeO
4672
5056
  }
4673
5057
  }
4674
5058
  UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
4675
- upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5059
+ upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4676
5060
  return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArray(msg, &field, size, arena);
4677
5061
  }
4678
5062
  UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
4679
- upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5063
+ upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
4680
5064
  upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4681
5065
  if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4682
5066
  return NULL;
@@ -4687,6 +5071,157 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_Extension
4687
5071
  return sub;
4688
5072
  }
4689
5073
 
5074
+ /* google.protobuf.ExtensionRangeOptions.Declaration */
5075
+
5076
+ UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) {
5077
+ return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena);
5078
+ }
5079
+ UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) {
5080
+ google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
5081
+ if (!ret) return NULL;
5082
+ if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
5083
+ return NULL;
5084
+ }
5085
+ return ret;
5086
+ }
5087
+ UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size,
5088
+ const upb_ExtensionRegistry* extreg,
5089
+ int options, upb_Arena* arena) {
5090
+ google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
5091
+ if (!ret) return NULL;
5092
+ if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, extreg, options, arena) !=
5093
+ kUpb_DecodeStatus_Ok) {
5094
+ return NULL;
5095
+ }
5096
+ return ret;
5097
+ }
5098
+ UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) {
5099
+ char* ptr;
5100
+ (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, 0, arena, &ptr, len);
5101
+ return ptr;
5102
+ }
5103
+ UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options,
5104
+ upb_Arena* arena, size_t* len) {
5105
+ char* ptr;
5106
+ (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, options, arena, &ptr, len);
5107
+ return ptr;
5108
+ }
5109
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5110
+ const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5111
+ _upb_Message_ClearNonExtensionField(msg, &field);
5112
+ }
5113
+ UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5114
+ int32_t default_val = (int32_t)0;
5115
+ int32_t ret;
5116
+ const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5117
+ _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5118
+ return ret;
5119
+ }
5120
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5121
+ const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5122
+ return _upb_Message_HasNonExtensionField(msg, &field);
5123
+ }
5124
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5125
+ const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5126
+ _upb_Message_ClearNonExtensionField(msg, &field);
5127
+ }
5128
+ UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5129
+ upb_StringView default_val = upb_StringView_FromString("");
5130
+ upb_StringView ret;
5131
+ const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5132
+ _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5133
+ return ret;
5134
+ }
5135
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5136
+ const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5137
+ return _upb_Message_HasNonExtensionField(msg, &field);
5138
+ }
5139
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5140
+ const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5141
+ _upb_Message_ClearNonExtensionField(msg, &field);
5142
+ }
5143
+ UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5144
+ upb_StringView default_val = upb_StringView_FromString("");
5145
+ upb_StringView ret;
5146
+ const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5147
+ _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5148
+ return ret;
5149
+ }
5150
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5151
+ const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5152
+ return _upb_Message_HasNonExtensionField(msg, &field);
5153
+ }
5154
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_is_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5155
+ const upb_MiniTableField field = {4, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5156
+ _upb_Message_ClearNonExtensionField(msg, &field);
5157
+ }
5158
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_is_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5159
+ bool default_val = false;
5160
+ bool ret;
5161
+ const upb_MiniTableField field = {4, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5162
+ _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5163
+ return ret;
5164
+ }
5165
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_is_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5166
+ const upb_MiniTableField field = {4, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5167
+ return _upb_Message_HasNonExtensionField(msg, &field);
5168
+ }
5169
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5170
+ const upb_MiniTableField field = {5, 9, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5171
+ _upb_Message_ClearNonExtensionField(msg, &field);
5172
+ }
5173
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5174
+ bool default_val = false;
5175
+ bool ret;
5176
+ const upb_MiniTableField field = {5, 9, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5177
+ _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5178
+ return ret;
5179
+ }
5180
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5181
+ const upb_MiniTableField field = {5, 9, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5182
+ return _upb_Message_HasNonExtensionField(msg, &field);
5183
+ }
5184
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5185
+ const upb_MiniTableField field = {6, 10, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5186
+ _upb_Message_ClearNonExtensionField(msg, &field);
5187
+ }
5188
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5189
+ bool default_val = false;
5190
+ bool ret;
5191
+ const upb_MiniTableField field = {6, 10, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5192
+ _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5193
+ return ret;
5194
+ }
5195
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5196
+ const upb_MiniTableField field = {6, 10, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5197
+ return _upb_Message_HasNonExtensionField(msg, &field);
5198
+ }
5199
+
5200
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
5201
+ const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5202
+ _upb_Message_SetNonExtensionField(msg, &field, &value);
5203
+ }
5204
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
5205
+ const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5206
+ _upb_Message_SetNonExtensionField(msg, &field, &value);
5207
+ }
5208
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
5209
+ const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5210
+ _upb_Message_SetNonExtensionField(msg, &field, &value);
5211
+ }
5212
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_is_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
5213
+ const upb_MiniTableField field = {4, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5214
+ _upb_Message_SetNonExtensionField(msg, &field, &value);
5215
+ }
5216
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
5217
+ const upb_MiniTableField field = {5, 9, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5218
+ _upb_Message_SetNonExtensionField(msg, &field, &value);
5219
+ }
5220
+ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
5221
+ const upb_MiniTableField field = {6, 10, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
5222
+ _upb_Message_SetNonExtensionField(msg, &field, &value);
5223
+ }
5224
+
4690
5225
  /* google.protobuf.FieldDescriptorProto */
4691
5226
 
4692
5227
  UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) {
@@ -5089,6 +5624,23 @@ UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobu
5089
5624
  return NULL;
5090
5625
  }
5091
5626
  }
5627
+ UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_value_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
5628
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5629
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
5630
+ if (size) {
5631
+ *size = arr ? arr->size : 0;
5632
+ }
5633
+ return arr;
5634
+ }
5635
+ UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_value_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
5636
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5637
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5638
+ (upb_Message*)msg, &field, arena);
5639
+ if (size) {
5640
+ *size = arr ? arr->size : 0;
5641
+ }
5642
+ return arr;
5643
+ }
5092
5644
  UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) {
5093
5645
  size_t size;
5094
5646
  google_protobuf_EnumDescriptorProto_value(msg, &size);
@@ -5124,6 +5676,23 @@ UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* g
5124
5676
  return NULL;
5125
5677
  }
5126
5678
  }
5679
+ UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
5680
+ const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5681
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
5682
+ if (size) {
5683
+ *size = arr ? arr->size : 0;
5684
+ }
5685
+ return arr;
5686
+ }
5687
+ UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
5688
+ const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5689
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5690
+ (upb_Message*)msg, &field, arena);
5691
+ if (size) {
5692
+ *size = arr ? arr->size : 0;
5693
+ }
5694
+ return arr;
5695
+ }
5127
5696
  UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) {
5128
5697
  size_t size;
5129
5698
  google_protobuf_EnumDescriptorProto_reserved_range(msg, &size);
@@ -5144,6 +5713,23 @@ UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_na
5144
5713
  return NULL;
5145
5714
  }
5146
5715
  }
5716
+ UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
5717
+ const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5718
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
5719
+ if (size) {
5720
+ *size = arr ? arr->size : 0;
5721
+ }
5722
+ return arr;
5723
+ }
5724
+ UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
5725
+ const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5726
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5727
+ (upb_Message*)msg, &field, arena);
5728
+ if (size) {
5729
+ *size = arr ? arr->size : 0;
5730
+ }
5731
+ return arr;
5732
+ }
5147
5733
  UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) {
5148
5734
  size_t size;
5149
5735
  google_protobuf_EnumDescriptorProto_reserved_name(msg, &size);
@@ -5485,6 +6071,23 @@ UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_S
5485
6071
  return NULL;
5486
6072
  }
5487
6073
  }
6074
+ UPB_INLINE const upb_Array* _google_protobuf_ServiceDescriptorProto_method_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
6075
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6076
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
6077
+ if (size) {
6078
+ *size = arr ? arr->size : 0;
6079
+ }
6080
+ return arr;
6081
+ }
6082
+ UPB_INLINE upb_Array* _google_protobuf_ServiceDescriptorProto_method_mutable_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size, upb_Arena* arena) {
6083
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6084
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6085
+ (upb_Message*)msg, &field, arena);
6086
+ if (size) {
6087
+ *size = arr ? arr->size : 0;
6088
+ }
6089
+ return arr;
6090
+ }
5488
6091
  UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) {
5489
6092
  size_t size;
5490
6093
  google_protobuf_ServiceDescriptorProto_method(msg, &size);
@@ -6058,6 +6661,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Fil
6058
6661
  return NULL;
6059
6662
  }
6060
6663
  }
6664
+ UPB_INLINE const upb_Array* _google_protobuf_FileOptions_uninterpreted_option_upb_array(const google_protobuf_FileOptions* msg, size_t* size) {
6665
+ const upb_MiniTableField field = {999, UPB_SIZE(20, 184), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6666
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
6667
+ if (size) {
6668
+ *size = arr ? arr->size : 0;
6669
+ }
6670
+ return arr;
6671
+ }
6672
+ UPB_INLINE upb_Array* _google_protobuf_FileOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FileOptions* msg, size_t* size, upb_Arena* arena) {
6673
+ const upb_MiniTableField field = {999, UPB_SIZE(20, 184), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6674
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6675
+ (upb_Message*)msg, &field, arena);
6676
+ if (size) {
6677
+ *size = arr ? arr->size : 0;
6678
+ }
6679
+ return arr;
6680
+ }
6061
6681
  UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) {
6062
6682
  size_t size;
6063
6683
  google_protobuf_FileOptions_uninterpreted_option(msg, &size);
@@ -6296,6 +6916,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Mes
6296
6916
  return NULL;
6297
6917
  }
6298
6918
  }
6919
+ UPB_INLINE const upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_upb_array(const google_protobuf_MessageOptions* msg, size_t* size) {
6920
+ const upb_MiniTableField field = {999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6921
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
6922
+ if (size) {
6923
+ *size = arr ? arr->size : 0;
6924
+ }
6925
+ return arr;
6926
+ }
6927
+ UPB_INLINE upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_MessageOptions* msg, size_t* size, upb_Arena* arena) {
6928
+ const upb_MiniTableField field = {999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6929
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6930
+ (upb_Message*)msg, &field, arena);
6931
+ if (size) {
6932
+ *size = arr ? arr->size : 0;
6933
+ }
6934
+ return arr;
6935
+ }
6299
6936
  UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) {
6300
6937
  size_t size;
6301
6938
  google_protobuf_MessageOptions_uninterpreted_option(msg, &size);
@@ -6534,12 +7171,49 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_target(const google_protobuf_Fi
6534
7171
  const upb_MiniTableField field = {18, 24, 10, 3, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6535
7172
  return _upb_Message_HasNonExtensionField(msg, &field);
6536
7173
  }
7174
+ UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
7175
+ const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 4, 14, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7176
+ _upb_Message_ClearNonExtensionField(msg, &field);
7177
+ }
7178
+ UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
7179
+ const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 4, 14, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7180
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
7181
+ if (arr) {
7182
+ if (size) *size = arr->size;
7183
+ return (int32_t const*)_upb_array_constptr(arr);
7184
+ } else {
7185
+ if (size) *size = 0;
7186
+ return NULL;
7187
+ }
7188
+ }
7189
+ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
7190
+ const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 4, 14, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7191
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
7192
+ if (size) {
7193
+ *size = arr ? arr->size : 0;
7194
+ }
7195
+ return arr;
7196
+ }
7197
+ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
7198
+ const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 4, 14, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7199
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7200
+ (upb_Message*)msg, &field, arena);
7201
+ if (size) {
7202
+ *size = arr ? arr->size : 0;
7203
+ }
7204
+ return arr;
7205
+ }
7206
+ UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) {
7207
+ size_t size;
7208
+ google_protobuf_FieldOptions_targets(msg, &size);
7209
+ return size != 0;
7210
+ }
6537
7211
  UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
6538
- const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7212
+ const upb_MiniTableField field = {999, UPB_SIZE(32, 40), 0, 5, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6539
7213
  _upb_Message_ClearNonExtensionField(msg, &field);
6540
7214
  }
6541
7215
  UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) {
6542
- const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7216
+ const upb_MiniTableField field = {999, UPB_SIZE(32, 40), 0, 5, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6543
7217
  const upb_Array* arr = upb_Message_GetArray(msg, &field);
6544
7218
  if (arr) {
6545
7219
  if (size) *size = arr->size;
@@ -6549,6 +7223,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Fie
6549
7223
  return NULL;
6550
7224
  }
6551
7225
  }
7226
+ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
7227
+ const upb_MiniTableField field = {999, UPB_SIZE(32, 40), 0, 5, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7228
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
7229
+ if (size) {
7230
+ *size = arr ? arr->size : 0;
7231
+ }
7232
+ return arr;
7233
+ }
7234
+ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
7235
+ const upb_MiniTableField field = {999, UPB_SIZE(32, 40), 0, 5, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7236
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7237
+ (upb_Message*)msg, &field, arena);
7238
+ if (size) {
7239
+ *size = arr ? arr->size : 0;
7240
+ }
7241
+ return arr;
7242
+ }
6552
7243
  UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) {
6553
7244
  size_t size;
6554
7245
  google_protobuf_FieldOptions_uninterpreted_option(msg, &size);
@@ -6595,8 +7286,32 @@ UPB_INLINE void google_protobuf_FieldOptions_set_target(google_protobuf_FieldOpt
6595
7286
  const upb_MiniTableField field = {18, 24, 10, 3, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6596
7287
  _upb_Message_SetNonExtensionField(msg, &field, &value);
6597
7288
  }
7289
+ UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
7290
+ upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 4, 14, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7291
+ upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7292
+ if (arr) {
7293
+ if (size) *size = arr->size;
7294
+ return (int32_t*)_upb_array_ptr(arr);
7295
+ } else {
7296
+ if (size) *size = 0;
7297
+ return NULL;
7298
+ }
7299
+ }
7300
+ UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
7301
+ upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 4, 14, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7302
+ return (int32_t*)upb_Message_ResizeArray(msg, &field, size, arena);
7303
+ }
7304
+ UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) {
7305
+ upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 4, 14, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7306
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7307
+ if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7308
+ return false;
7309
+ }
7310
+ _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
7311
+ return true;
7312
+ }
6598
7313
  UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) {
6599
- upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7314
+ upb_MiniTableField field = {999, UPB_SIZE(32, 40), 0, 5, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6600
7315
  upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6601
7316
  if (arr) {
6602
7317
  if (size) *size = arr->size;
@@ -6607,11 +7322,11 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mu
6607
7322
  }
6608
7323
  }
6609
7324
  UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
6610
- upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7325
+ upb_MiniTableField field = {999, UPB_SIZE(32, 40), 0, 5, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6611
7326
  return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArray(msg, &field, size, arena);
6612
7327
  }
6613
7328
  UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
6614
- upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7329
+ upb_MiniTableField field = {999, UPB_SIZE(32, 40), 0, 5, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6615
7330
  upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6616
7331
  if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6617
7332
  return NULL;
@@ -6672,6 +7387,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_One
6672
7387
  return NULL;
6673
7388
  }
6674
7389
  }
7390
+ UPB_INLINE const upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_upb_array(const google_protobuf_OneofOptions* msg, size_t* size) {
7391
+ const upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7392
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
7393
+ if (size) {
7394
+ *size = arr ? arr->size : 0;
7395
+ }
7396
+ return arr;
7397
+ }
7398
+ UPB_INLINE upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_OneofOptions* msg, size_t* size, upb_Arena* arena) {
7399
+ const upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7400
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7401
+ (upb_Message*)msg, &field, arena);
7402
+ if (size) {
7403
+ *size = arr ? arr->size : 0;
7404
+ }
7405
+ return arr;
7406
+ }
6675
7407
  UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) {
6676
7408
  size_t size;
6677
7409
  google_protobuf_OneofOptions_uninterpreted_option(msg, &size);
@@ -6800,6 +7532,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Enu
6800
7532
  return NULL;
6801
7533
  }
6802
7534
  }
7535
+ UPB_INLINE const upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_upb_array(const google_protobuf_EnumOptions* msg, size_t* size) {
7536
+ const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7537
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
7538
+ if (size) {
7539
+ *size = arr ? arr->size : 0;
7540
+ }
7541
+ return arr;
7542
+ }
7543
+ UPB_INLINE upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_EnumOptions* msg, size_t* size, upb_Arena* arena) {
7544
+ const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7545
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7546
+ (upb_Message*)msg, &field, arena);
7547
+ if (size) {
7548
+ *size = arr ? arr->size : 0;
7549
+ }
7550
+ return arr;
7551
+ }
6803
7552
  UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) {
6804
7553
  size_t size;
6805
7554
  google_protobuf_EnumOptions_uninterpreted_option(msg, &size);
@@ -6910,6 +7659,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Enu
6910
7659
  return NULL;
6911
7660
  }
6912
7661
  }
7662
+ UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) {
7663
+ const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7664
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
7665
+ if (size) {
7666
+ *size = arr ? arr->size : 0;
7667
+ }
7668
+ return arr;
7669
+ }
7670
+ UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) {
7671
+ const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7672
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7673
+ (upb_Message*)msg, &field, arena);
7674
+ if (size) {
7675
+ *size = arr ? arr->size : 0;
7676
+ }
7677
+ return arr;
7678
+ }
6913
7679
  UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) {
6914
7680
  size_t size;
6915
7681
  google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size);
@@ -7012,6 +7778,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Ser
7012
7778
  return NULL;
7013
7779
  }
7014
7780
  }
7781
+ UPB_INLINE const upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size) {
7782
+ const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7783
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
7784
+ if (size) {
7785
+ *size = arr ? arr->size : 0;
7786
+ }
7787
+ return arr;
7788
+ }
7789
+ UPB_INLINE upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size, upb_Arena* arena) {
7790
+ const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7791
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7792
+ (upb_Message*)msg, &field, arena);
7793
+ if (size) {
7794
+ *size = arr ? arr->size : 0;
7795
+ }
7796
+ return arr;
7797
+ }
7015
7798
  UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) {
7016
7799
  size_t size;
7017
7800
  google_protobuf_ServiceOptions_uninterpreted_option(msg, &size);
@@ -7129,6 +7912,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Met
7129
7912
  return NULL;
7130
7913
  }
7131
7914
  }
7915
+ UPB_INLINE const upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_upb_array(const google_protobuf_MethodOptions* msg, size_t* size) {
7916
+ const upb_MiniTableField field = {999, 8, 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7917
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
7918
+ if (size) {
7919
+ *size = arr ? arr->size : 0;
7920
+ }
7921
+ return arr;
7922
+ }
7923
+ UPB_INLINE upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_MethodOptions* msg, size_t* size, upb_Arena* arena) {
7924
+ const upb_MiniTableField field = {999, 8, 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7925
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7926
+ (upb_Message*)msg, &field, arena);
7927
+ if (size) {
7928
+ *size = arr ? arr->size : 0;
7929
+ }
7930
+ return arr;
7931
+ }
7132
7932
  UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) {
7133
7933
  size_t size;
7134
7934
  google_protobuf_MethodOptions_uninterpreted_option(msg, &size);
@@ -7220,6 +8020,23 @@ UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_pro
7220
8020
  return NULL;
7221
8021
  }
7222
8022
  }
8023
+ UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) {
8024
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8025
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
8026
+ if (size) {
8027
+ *size = arr ? arr->size : 0;
8028
+ }
8029
+ return arr;
8030
+ }
8031
+ UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) {
8032
+ const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8033
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8034
+ (upb_Message*)msg, &field, arena);
8035
+ if (size) {
8036
+ *size = arr ? arr->size : 0;
8037
+ }
8038
+ return arr;
8039
+ }
7223
8040
  UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) {
7224
8041
  size_t size;
7225
8042
  google_protobuf_UninterpretedOption_name(msg, &size);
@@ -7492,6 +8309,23 @@ UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf
7492
8309
  return NULL;
7493
8310
  }
7494
8311
  }
8312
+ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_location_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
8313
+ const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8314
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
8315
+ if (size) {
8316
+ *size = arr ? arr->size : 0;
8317
+ }
8318
+ return arr;
8319
+ }
8320
+ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_location_mutable_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size, upb_Arena* arena) {
8321
+ const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8322
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8323
+ (upb_Message*)msg, &field, arena);
8324
+ if (size) {
8325
+ *size = arr ? arr->size : 0;
8326
+ }
8327
+ return arr;
8328
+ }
7495
8329
  UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) {
7496
8330
  size_t size;
7497
8331
  google_protobuf_SourceCodeInfo_location(msg, &size);
@@ -7575,6 +8409,23 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const goo
7575
8409
  return NULL;
7576
8410
  }
7577
8411
  }
8412
+ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
8413
+ const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8414
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
8415
+ if (size) {
8416
+ *size = arr ? arr->size : 0;
8417
+ }
8418
+ return arr;
8419
+ }
8420
+ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
8421
+ const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8422
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8423
+ (upb_Message*)msg, &field, arena);
8424
+ if (size) {
8425
+ *size = arr ? arr->size : 0;
8426
+ }
8427
+ return arr;
8428
+ }
7578
8429
  UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) {
7579
8430
  size_t size;
7580
8431
  google_protobuf_SourceCodeInfo_Location_path(msg, &size);
@@ -7595,6 +8446,23 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const goo
7595
8446
  return NULL;
7596
8447
  }
7597
8448
  }
8449
+ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
8450
+ const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8451
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
8452
+ if (size) {
8453
+ *size = arr ? arr->size : 0;
8454
+ }
8455
+ return arr;
8456
+ }
8457
+ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
8458
+ const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8459
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8460
+ (upb_Message*)msg, &field, arena);
8461
+ if (size) {
8462
+ *size = arr ? arr->size : 0;
8463
+ }
8464
+ return arr;
8465
+ }
7598
8466
  UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) {
7599
8467
  size_t size;
7600
8468
  google_protobuf_SourceCodeInfo_Location_span(msg, &size);
@@ -7645,6 +8513,23 @@ UPB_INLINE upb_StringView const* google_protobuf_SourceCodeInfo_Location_leading
7645
8513
  return NULL;
7646
8514
  }
7647
8515
  }
8516
+ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
8517
+ const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8518
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
8519
+ if (size) {
8520
+ *size = arr ? arr->size : 0;
8521
+ }
8522
+ return arr;
8523
+ }
8524
+ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
8525
+ const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8526
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8527
+ (upb_Message*)msg, &field, arena);
8528
+ if (size) {
8529
+ *size = arr ? arr->size : 0;
8530
+ }
8531
+ return arr;
8532
+ }
7648
8533
  UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
7649
8534
  size_t size;
7650
8535
  google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size);
@@ -7782,6 +8667,23 @@ UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_pro
7782
8667
  return NULL;
7783
8668
  }
7784
8669
  }
8670
+ UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
8671
+ const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8672
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
8673
+ if (size) {
8674
+ *size = arr ? arr->size : 0;
8675
+ }
8676
+ return arr;
8677
+ }
8678
+ UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_mutable_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size, upb_Arena* arena) {
8679
+ const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8680
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8681
+ (upb_Message*)msg, &field, arena);
8682
+ if (size) {
8683
+ *size = arr ? arr->size : 0;
8684
+ }
8685
+ return arr;
8686
+ }
7785
8687
  UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) {
7786
8688
  size_t size;
7787
8689
  google_protobuf_GeneratedCodeInfo_annotation(msg, &size);
@@ -7865,6 +8767,23 @@ UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(cons
7865
8767
  return NULL;
7866
8768
  }
7867
8769
  }
8770
+ UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
8771
+ const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8772
+ const upb_Array* arr = upb_Message_GetArray(msg, &field);
8773
+ if (size) {
8774
+ *size = arr ? arr->size : 0;
8775
+ }
8776
+ return arr;
8777
+ }
8778
+ UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) {
8779
+ const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8780
+ upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8781
+ (upb_Message*)msg, &field, arena);
8782
+ if (size) {
8783
+ *size = arr ? arr->size : 0;
8784
+ }
8785
+ return arr;
8786
+ }
7868
8787
  UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
7869
8788
  size_t size;
7870
8789
  google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size);
@@ -9370,36 +10289,170 @@ typedef struct _upb_MemBlock _upb_MemBlock;
9370
10289
 
9371
10290
  struct upb_Arena {
9372
10291
  _upb_ArenaHead head;
9373
- /* Stores cleanup metadata for this arena.
9374
- * - a pointer to the current cleanup counter.
9375
- * - a boolean indicating if there is an unowned initial block. */
9376
- uintptr_t cleanup_metadata;
9377
-
9378
- /* Allocator to allocate arena blocks. We are responsible for freeing these
9379
- * when we are destroyed. */
9380
- upb_alloc* block_alloc;
9381
- uint32_t last_size;
9382
-
9383
- /* When multiple arenas are fused together, each arena points to a parent
9384
- * arena (root points to itself). The root tracks how many live arenas
9385
- * reference it. */
9386
- uint32_t refcount; /* Only used when a->parent == a */
9387
- struct upb_Arena* parent;
9388
-
9389
- /* Linked list of blocks to free/cleanup. */
9390
- _upb_MemBlock *freelist, *freelist_tail;
10292
+
10293
+ // upb_alloc* together with a low bit which signals if there is an initial
10294
+ // block.
10295
+ uintptr_t block_alloc;
10296
+
10297
+ // When multiple arenas are fused together, each arena points to a parent
10298
+ // arena (root points to itself). The root tracks how many live arenas
10299
+ // reference it.
10300
+
10301
+ // The low bit is tagged:
10302
+ // 0: pointer to parent
10303
+ // 1: count, left shifted by one
10304
+ UPB_ATOMIC(uintptr_t) parent_or_count;
10305
+
10306
+ // All nodes that are fused together are in a singly-linked list.
10307
+ UPB_ATOMIC(upb_Arena*) next; // NULL at end of list.
10308
+
10309
+ // The last element of the linked list. This is present only as an
10310
+ // optimization, so that we do not have to iterate over all members for every
10311
+ // fuse. Only significant for an arena root. In other cases it is ignored.
10312
+ UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members.
10313
+
10314
+ // Linked list of blocks to free/cleanup. Atomic only for the benefit of
10315
+ // upb_Arena_SpaceAllocated().
10316
+ UPB_ATOMIC(_upb_MemBlock*) blocks;
9391
10317
  };
9392
10318
 
10319
+ UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) {
10320
+ return (parent_or_count & 1) == 1;
10321
+ }
10322
+
10323
+ UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) {
10324
+ return (parent_or_count & 1) == 0;
10325
+ }
10326
+
10327
+ UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) {
10328
+ UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
10329
+ return parent_or_count >> 1;
10330
+ }
10331
+
10332
+ UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) {
10333
+ uintptr_t parent_or_count = (refcount << 1) | 1;
10334
+ UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
10335
+ return parent_or_count;
10336
+ }
10337
+
10338
+ UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) {
10339
+ UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
10340
+ return (upb_Arena*)parent_or_count;
10341
+ }
10342
+
10343
+ UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) {
10344
+ uintptr_t parent_or_count = (uintptr_t)a;
10345
+ UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
10346
+ return parent_or_count;
10347
+ }
10348
+
10349
+ UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) {
10350
+ return (upb_alloc*)(arena->block_alloc & ~0x1);
10351
+ }
10352
+
10353
+ UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc,
10354
+ bool has_initial) {
10355
+ uintptr_t alloc_uint = (uintptr_t)alloc;
10356
+ UPB_ASSERT((alloc_uint & 1) == 0);
10357
+ return alloc_uint | (has_initial ? 1 : 0);
10358
+ }
10359
+
10360
+ UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) {
10361
+ return arena->block_alloc & 0x1;
10362
+ }
10363
+
10364
+
10365
+ #endif /* UPB_MEM_ARENA_INTERNAL_H_ */
10366
+
10367
+ #ifndef UPB_PORT_ATOMIC_H_
10368
+ #define UPB_PORT_ATOMIC_H_
10369
+
10370
+
10371
+ #ifdef UPB_USE_C11_ATOMICS
10372
+
10373
+ #include <stdatomic.h>
10374
+ #include <stdbool.h>
10375
+
10376
+ #define upb_Atomic_Init(addr, val) atomic_init(addr, val)
10377
+ #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order)
10378
+ #define upb_Atomic_Store(addr, val, order) \
10379
+ atomic_store_explicit(addr, val, order)
10380
+ #define upb_Atomic_Add(addr, val, order) \
10381
+ atomic_fetch_add_explicit(addr, val, order)
10382
+ #define upb_Atomic_Sub(addr, val, order) \
10383
+ atomic_fetch_sub_explicit(addr, val, order)
10384
+ #define upb_Atomic_Exchange(addr, val, order) \
10385
+ atomic_exchange_explicit(addr, val, order)
10386
+ #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
10387
+ success_order, failure_order) \
10388
+ atomic_compare_exchange_strong_explicit(addr, expected, desired, \
10389
+ success_order, failure_order)
10390
+ #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
10391
+ failure_order) \
10392
+ atomic_compare_exchange_weak_explicit(addr, expected, desired, \
10393
+ success_order, failure_order)
10394
+
10395
+ #else // !UPB_USE_C11_ATOMICS
10396
+
10397
+ #include <string.h>
10398
+
10399
+ #define upb_Atomic_Init(addr, val) (*addr = val)
10400
+ #define upb_Atomic_Load(addr, order) (*addr)
10401
+ #define upb_Atomic_Store(addr, val, order) (*(addr) = val)
10402
+ #define upb_Atomic_Add(addr, val, order) (*(addr) += val)
10403
+ #define upb_Atomic_Sub(addr, val, order) (*(addr) -= val)
10404
+
10405
+ UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) {
10406
+ void* old;
10407
+ memcpy(&old, addr, sizeof(value));
10408
+ memcpy(addr, &value, sizeof(value));
10409
+ return old;
10410
+ }
10411
+
10412
+ #define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val)
10413
+
10414
+ // `addr` and `expected` are logically double pointers.
10415
+ UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
10416
+ void* expected,
10417
+ void* desired) {
10418
+ if (memcmp(addr, expected, sizeof(desired)) == 0) {
10419
+ memcpy(addr, &desired, sizeof(desired));
10420
+ return true;
10421
+ } else {
10422
+ memcpy(expected, addr, sizeof(desired));
10423
+ return false;
10424
+ }
10425
+ }
10426
+
10427
+ #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
10428
+ success_order, failure_order) \
10429
+ _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \
10430
+ (void*)desired)
10431
+ #define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
10432
+ failure_order) \
10433
+ upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0)
10434
+
10435
+ #endif
10436
+
10437
+
10438
+ #endif // UPB_PORT_ATOMIC_H_
10439
+
10440
+ #ifndef UPB_WIRE_COMMON_H_
10441
+ #define UPB_WIRE_COMMON_H_
10442
+
10443
+ // Must be last.
10444
+
9393
10445
  #ifdef __cplusplus
9394
10446
  extern "C" {
9395
10447
  #endif
9396
10448
 
10449
+ #define kUpb_WireFormat_DefaultDepthLimit 100
10450
+
9397
10451
  #ifdef __cplusplus
9398
- } /* extern "C" */
10452
+ }
9399
10453
  #endif
9400
10454
 
9401
-
9402
- #endif /* UPB_MEM_ARENA_INTERNAL_H_ */
10455
+ #endif // UPB_WIRE_COMMON_H_
9403
10456
 
9404
10457
  #ifndef UPB_WIRE_READER_H_
9405
10458
  #define UPB_WIRE_READER_H_
@@ -9722,17 +10775,6 @@ UPB_INLINE char _upb_FromBase92(uint8_t ch) {
9722
10775
  return _kUpb_FromBase92[ch - ' '];
9723
10776
  }
9724
10777
 
9725
- UPB_INLINE bool _upb_FieldType_IsPackable(upb_FieldType type) {
9726
- // clang-format off
9727
- const unsigned kUnpackableTypes =
9728
- (1 << kUpb_FieldType_String) |
9729
- (1 << kUpb_FieldType_Bytes) |
9730
- (1 << kUpb_FieldType_Message) |
9731
- (1 << kUpb_FieldType_Group);
9732
- // clang-format on
9733
- return (1 << type) & ~kUnpackableTypes;
9734
- }
9735
-
9736
10778
  #ifdef __cplusplus
9737
10779
  } /* extern "C" */
9738
10780
  #endif
@@ -9790,18 +10832,53 @@ UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table,
9790
10832
  upb_MiniTableField* field,
9791
10833
  const upb_MiniTableEnum* sub);
9792
10834
 
9793
- const char* _upb_MiniTableExtension_Build(const char* data, size_t len,
9794
- upb_MiniTableExtension* ext,
9795
- const upb_MiniTable* extendee,
9796
- upb_MiniTableSub sub,
9797
- upb_MiniTablePlatform platform,
9798
- upb_Status* status);
9799
-
9800
- UPB_API_INLINE const char* upb_MiniTableExtension_Build(
10835
+ // Initializes a MiniTableExtension buffer that has already been allocated.
10836
+ // This is needed by upb_FileDef and upb_MessageDef, which allocate all of the
10837
+ // extensions together in a single contiguous array.
10838
+ const char* _upb_MiniTableExtension_Init(const char* data, size_t len,
10839
+ upb_MiniTableExtension* ext,
10840
+ const upb_MiniTable* extendee,
10841
+ upb_MiniTableSub sub,
10842
+ upb_MiniTablePlatform platform,
10843
+ upb_Status* status);
10844
+
10845
+ UPB_API_INLINE const char* upb_MiniTableExtension_Init(
9801
10846
  const char* data, size_t len, upb_MiniTableExtension* ext,
9802
10847
  const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) {
9803
- return _upb_MiniTableExtension_Build(data, len, ext, extendee, sub,
9804
- kUpb_MiniTablePlatform_Native, status);
10848
+ return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub,
10849
+ kUpb_MiniTablePlatform_Native, status);
10850
+ }
10851
+
10852
+ UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build(
10853
+ const char* data, size_t len, const upb_MiniTable* extendee,
10854
+ upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena,
10855
+ upb_Status* status);
10856
+
10857
+ UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
10858
+ const char* data, size_t len, const upb_MiniTable* extendee,
10859
+ upb_Arena* arena, upb_Status* status) {
10860
+ upb_MiniTableSub sub;
10861
+ sub.submsg = NULL;
10862
+ return _upb_MiniTableExtension_Build(
10863
+ data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
10864
+ }
10865
+
10866
+ UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
10867
+ const char* data, size_t len, const upb_MiniTable* extendee,
10868
+ upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) {
10869
+ upb_MiniTableSub sub;
10870
+ sub.submsg = submsg;
10871
+ return _upb_MiniTableExtension_Build(
10872
+ data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
10873
+ }
10874
+
10875
+ UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum(
10876
+ const char* data, size_t len, const upb_MiniTable* extendee,
10877
+ upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) {
10878
+ upb_MiniTableSub sub;
10879
+ sub.subenum = subenum;
10880
+ return _upb_MiniTableExtension_Build(
10881
+ data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
9805
10882
  }
9806
10883
 
9807
10884
  UPB_API upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, size_t len,
@@ -9819,6 +10896,33 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
9819
10896
  upb_Arena* arena, void** buf,
9820
10897
  size_t* buf_size, upb_Status* status);
9821
10898
 
10899
+ // Returns a list of fields that require linking at runtime, to connect the
10900
+ // MiniTable to its sub-messages and sub-enums. The list of fields will be
10901
+ // written to the `subs` array, which must have been allocated by the caller
10902
+ // and must be large enough to hold a list of all fields in the message.
10903
+ //
10904
+ // The order of the fields returned by this function is significant: it matches
10905
+ // the order expected by upb_MiniTable_Link() below.
10906
+ //
10907
+ // The return value packs the sub-message count and sub-enum count into a single
10908
+ // integer like so:
10909
+ // return (msg_count << 16) | enum_count;
10910
+ UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt,
10911
+ const upb_MiniTableField** subs);
10912
+
10913
+ // Links a message to its sub-messages and sub-enums. The caller must pass
10914
+ // arrays of sub-tables and sub-enums, in the same length and order as is
10915
+ // returned by upb_MiniTable_GetSubList() above. However, individual elements
10916
+ // of the sub_tables may be NULL if those sub-messages were tree shaken.
10917
+ //
10918
+ // Returns false if either array is too short, or if any of the tables fails
10919
+ // to link.
10920
+ UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt,
10921
+ const upb_MiniTable** sub_tables,
10922
+ size_t sub_table_count,
10923
+ const upb_MiniTableEnum** sub_enums,
10924
+ size_t sub_enum_count);
10925
+
9822
10926
  #ifdef __cplusplus
9823
10927
  } /* extern "C" */
9824
10928
  #endif
@@ -10386,8 +11490,8 @@ extern "C" {
10386
11490
  #endif
10387
11491
 
10388
11492
  upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i);
10389
- bool _upb_OneofDef_Insert(upb_OneofDef* o, const upb_FieldDef* f,
10390
- const char* name, size_t size, upb_Arena* a);
11493
+ void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o,
11494
+ const upb_FieldDef* f, const char* name, size_t size);
10391
11495
 
10392
11496
  // Allocate and initialize an array of |n| oneof defs owned by |m|.
10393
11497
  upb_OneofDef* _upb_OneofDefs_New(
@@ -10671,3 +11775,6 @@ UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) {
10671
11775
  #undef UPB_DESCRIPTOR_UPB_H_FILENAME
10672
11776
  #undef UPB_DESC
10673
11777
  #undef UPB_IS_GOOGLE3
11778
+ #undef UPB_ATOMIC
11779
+ #undef UPB_USE_C11_ATOMICS
11780
+ #undef UPB_PRIVATE