google-protobuf 3.2.0 → 3.9.1

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

Potentially problematic release.


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

@@ -1,4 +1,45 @@
1
- // Amalgamated source file
1
+ /* Amalgamated source file */
2
+
3
+ #if UINTPTR_MAX == 0xffffffff
4
+ #define UPB_SIZE(size32, size64) size32
5
+ #else
6
+ #define UPB_SIZE(size32, size64) size64
7
+ #endif
8
+
9
+ #define UPB_FIELD_AT(msg, fieldtype, offset) \
10
+ *(fieldtype*)((const char*)(msg) + offset)
11
+
12
+ #define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
13
+ UPB_FIELD_AT(msg, int, case_offset) == case_val \
14
+ ? UPB_FIELD_AT(msg, fieldtype, offset) \
15
+ : default
16
+
17
+ #define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
18
+ UPB_FIELD_AT(msg, int, case_offset) = case_val; \
19
+ UPB_FIELD_AT(msg, fieldtype, offset) = value;
20
+ /*
21
+ ** upb::Message is a representation for protobuf messages.
22
+ **
23
+ ** However it differs from other common representations like
24
+ ** google::protobuf::Message in one key way: it does not prescribe any
25
+ ** ownership between messages and submessages, and it relies on the
26
+ ** client to ensure that each submessage/array/map outlives its parent.
27
+ **
28
+ ** All messages, arrays, and maps live in an Arena. If the entire message
29
+ ** tree is in the same arena, ensuring proper lifetimes is simple. However
30
+ ** the client can mix arenas as long as they ensure that there are no
31
+ ** dangling pointers.
32
+ **
33
+ ** A client can access a upb::Message without knowing anything about
34
+ ** ownership semantics, but to create or mutate a message a user needs
35
+ ** to implement the memory management themselves.
36
+ **
37
+ ** TODO: UTF-8 checking?
38
+ **/
39
+
40
+ #ifndef UPB_MSG_H_
41
+ #define UPB_MSG_H_
42
+
2
43
  /*
3
44
  ** Defs are upb's internal representation of the constructs that can appear
4
45
  ** in a .proto file:
@@ -100,6 +141,9 @@ template class InlinedEnvironment;
100
141
  #define UPB_INLINE static
101
142
  #endif
102
143
 
144
+ /* Hints to the compiler about likely/unlikely branches. */
145
+ #define UPB_LIKELY(x) __builtin_expect((x),1)
146
+
103
147
  /* Define UPB_BIG_ENDIAN manually if you're on big endian and your compiler
104
148
  * doesn't provide these preprocessor symbols. */
105
149
  #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
@@ -361,6 +405,16 @@ class PointerBase2 : public PointerBase {
361
405
 
362
406
  #endif
363
407
 
408
+ /* A list of types as they are encoded on-the-wire. */
409
+ typedef enum {
410
+ UPB_WIRE_TYPE_VARINT = 0,
411
+ UPB_WIRE_TYPE_64BIT = 1,
412
+ UPB_WIRE_TYPE_DELIMITED = 2,
413
+ UPB_WIRE_TYPE_START_GROUP = 3,
414
+ UPB_WIRE_TYPE_END_GROUP = 4,
415
+ UPB_WIRE_TYPE_32BIT = 5
416
+ } upb_wiretype_t;
417
+
364
418
 
365
419
  /* upb::ErrorSpace ************************************************************/
366
420
 
@@ -689,7 +743,7 @@ void upb_env_uninit(upb_env *e);
689
743
 
690
744
  void upb_env_initonly(upb_env *e);
691
745
 
692
- upb_arena *upb_env_arena(upb_env *e);
746
+ UPB_INLINE upb_arena *upb_env_arena(upb_env *e) { return (upb_arena*)e; }
693
747
  bool upb_env_ok(const upb_env *e);
694
748
  void upb_env_seterrorfunc(upb_env *e, upb_error_func *func, void *ud);
695
749
 
@@ -1786,9 +1840,24 @@ class upb::Def {
1786
1840
 
1787
1841
  private:
1788
1842
  UPB_DISALLOW_POD_OPS(Def, upb::Def)
1843
+ #else
1844
+ struct upb_def {
1845
+ upb_refcounted base;
1846
+
1847
+ const char *fullname;
1848
+ const upb_filedef* file;
1849
+ char type; /* A upb_deftype_t (char to save space) */
1850
+
1851
+ /* Used as a flag during the def's mutable stage. Must be false unless
1852
+ * it is currently being used by a function on the stack. This allows
1853
+ * us to easily determine which defs were passed into the function's
1854
+ * current invocation. */
1855
+ bool came_from_user;
1856
+ #endif
1789
1857
  };
1790
1858
 
1791
- #endif /* __cplusplus */
1859
+ #define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \
1860
+ { UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false }
1792
1861
 
1793
1862
  UPB_BEGIN_EXTERN_C
1794
1863
 
@@ -1947,6 +2016,36 @@ typedef enum {
1947
2016
  UPB_SYNTAX_PROTO3 = 3
1948
2017
  } upb_syntax_t;
1949
2018
 
2019
+ /* All the different kind of well known type messages. For simplicity of check,
2020
+ * number wrappers and string wrappers are grouped together. Make sure the
2021
+ * order and merber of these groups are not changed.
2022
+ */
2023
+ typedef enum {
2024
+ UPB_WELLKNOWN_UNSPECIFIED,
2025
+ UPB_WELLKNOWN_ANY,
2026
+ UPB_WELLKNOWN_FIELDMASK,
2027
+ UPB_WELLKNOWN_DURATION,
2028
+ UPB_WELLKNOWN_TIMESTAMP,
2029
+ /* number wrappers */
2030
+ UPB_WELLKNOWN_DOUBLEVALUE,
2031
+ UPB_WELLKNOWN_FLOATVALUE,
2032
+ UPB_WELLKNOWN_INT64VALUE,
2033
+ UPB_WELLKNOWN_UINT64VALUE,
2034
+ UPB_WELLKNOWN_INT32VALUE,
2035
+ UPB_WELLKNOWN_UINT32VALUE,
2036
+ /* string wrappers */
2037
+ UPB_WELLKNOWN_STRINGVALUE,
2038
+ UPB_WELLKNOWN_BYTESVALUE,
2039
+ UPB_WELLKNOWN_BOOLVALUE,
2040
+ UPB_WELLKNOWN_VALUE,
2041
+ UPB_WELLKNOWN_LISTVALUE,
2042
+ UPB_WELLKNOWN_STRUCT
2043
+ } upb_wellknowntype_t;
2044
+
2045
+
2046
+ /* Maps descriptor type -> upb field type. */
2047
+ extern const uint8_t upb_desctype_to_fieldtype[];
2048
+
1950
2049
  /* Maximum field number allowed for FieldDefs. This is an inherent limit of the
1951
2050
  * protobuf wire format. */
1952
2051
  #define UPB_MAX_FIELDNUMBER ((1 << 29) - 1)
@@ -2221,12 +2320,57 @@ class upb::FieldDef {
2221
2320
 
2222
2321
  private:
2223
2322
  UPB_DISALLOW_POD_OPS(FieldDef, upb::FieldDef)
2224
- };
2323
+ #else
2324
+ struct upb_fielddef {
2325
+ upb_def base;
2225
2326
 
2327
+ union {
2328
+ int64_t sint;
2329
+ uint64_t uint;
2330
+ double dbl;
2331
+ float flt;
2332
+ void *bytes;
2333
+ } defaultval;
2334
+ union {
2335
+ const upb_msgdef *def; /* If !msg_is_symbolic. */
2336
+ char *name; /* If msg_is_symbolic. */
2337
+ } msg;
2338
+ union {
2339
+ const upb_def *def; /* If !subdef_is_symbolic. */
2340
+ char *name; /* If subdef_is_symbolic. */
2341
+ } sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */
2342
+ bool subdef_is_symbolic;
2343
+ bool msg_is_symbolic;
2344
+ const upb_oneofdef *oneof;
2345
+ bool default_is_string;
2346
+ bool type_is_set_; /* False until type is explicitly set. */
2347
+ bool is_extension_;
2348
+ bool lazy_;
2349
+ bool packed_;
2350
+ upb_intfmt_t intfmt;
2351
+ bool tagdelim;
2352
+ upb_fieldtype_t type_;
2353
+ upb_label_t label_;
2354
+ uint32_t number_;
2355
+ uint32_t selector_base; /* Used to index into a upb::Handlers table. */
2356
+ uint32_t index_;
2226
2357
  # endif /* defined(__cplusplus) */
2358
+ };
2227
2359
 
2228
2360
  UPB_BEGIN_EXTERN_C
2229
2361
 
2362
+ extern const struct upb_refcounted_vtbl upb_fielddef_vtbl;
2363
+
2364
+ #define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \
2365
+ packed, name, num, msgdef, subdef, selector_base, \
2366
+ index, defaultval, refs, ref2s) \
2367
+ { \
2368
+ UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \
2369
+ defaultval, {msgdef}, {subdef}, NULL, false, false, \
2370
+ type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \
2371
+ lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \
2372
+ }
2373
+
2230
2374
  /* Native C API. */
2231
2375
  upb_fielddef *upb_fielddef_new(const void *owner);
2232
2376
 
@@ -2328,6 +2472,18 @@ typedef upb_strtable_iter upb_msg_oneof_iter;
2328
2472
  #define UPB_MAPENTRY_KEY 1
2329
2473
  #define UPB_MAPENTRY_VALUE 2
2330
2474
 
2475
+ /* Well-known field tag numbers for Any messages. */
2476
+ #define UPB_ANY_TYPE 1
2477
+ #define UPB_ANY_VALUE 2
2478
+
2479
+ /* Well-known field tag numbers for timestamp messages. */
2480
+ #define UPB_DURATION_SECONDS 1
2481
+ #define UPB_DURATION_NANOS 2
2482
+
2483
+ /* Well-known field tag numbers for duration messages. */
2484
+ #define UPB_TIMESTAMP_SECONDS 1
2485
+ #define UPB_TIMESTAMP_NANOS 2
2486
+
2331
2487
  #ifdef __cplusplus
2332
2488
 
2333
2489
  /* Structure that describes a single .proto message type.
@@ -2442,6 +2598,13 @@ class upb::MessageDef {
2442
2598
  void setmapentry(bool map_entry);
2443
2599
  bool mapentry() const;
2444
2600
 
2601
+ /* Return the type of well known type message. UPB_WELLKNOWN_UNSPECIFIED for
2602
+ * non-well-known message. */
2603
+ upb_wellknowntype_t wellknowntype() const;
2604
+
2605
+ /* Whether is a number wrapper. */
2606
+ bool isnumberwrapper() const;
2607
+
2445
2608
  /* Iteration over fields. The order is undefined. */
2446
2609
  class field_iterator
2447
2610
  : public std::iterator<std::forward_iterator_tag, FieldDef*> {
@@ -2557,12 +2720,45 @@ class upb::MessageDef {
2557
2720
 
2558
2721
  private:
2559
2722
  UPB_DISALLOW_POD_OPS(MessageDef, upb::MessageDef)
2560
- };
2723
+ #else
2724
+ struct upb_msgdef {
2725
+ upb_def base;
2726
+
2727
+ size_t selector_count;
2728
+ uint32_t submsg_field_count;
2729
+
2730
+ /* Tables for looking up fields by number and name. */
2731
+ upb_inttable itof; /* int to field */
2732
+ upb_strtable ntof; /* name to field/oneof */
2733
+
2734
+ /* Is this a map-entry message? */
2735
+ bool map_entry;
2736
+
2737
+ /* Whether this message has proto2 or proto3 semantics. */
2738
+ upb_syntax_t syntax;
2561
2739
 
2740
+ /* Type of well known type message. UPB_WELLKNOWN_UNSPECIFIED for
2741
+ * non-well-known message. */
2742
+ upb_wellknowntype_t well_known_type;
2743
+
2744
+ /* TODO(haberman): proper extension ranges (there can be multiple). */
2562
2745
  #endif /* __cplusplus */
2746
+ };
2563
2747
 
2564
2748
  UPB_BEGIN_EXTERN_C
2565
2749
 
2750
+ extern const struct upb_refcounted_vtbl upb_msgdef_vtbl;
2751
+
2752
+ /* TODO: also support static initialization of the oneofs table. This will be
2753
+ * needed if we compile in descriptors that contain oneofs. */
2754
+ #define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \
2755
+ map_entry, syntax, well_known_type, refs, ref2s) \
2756
+ { \
2757
+ UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \
2758
+ selector_count, submsg_field_count, itof, ntof, map_entry, syntax, \
2759
+ well_known_type \
2760
+ }
2761
+
2566
2762
  /* Returns NULL if memory allocation failed. */
2567
2763
  upb_msgdef *upb_msgdef_new(const void *owner);
2568
2764
 
@@ -2583,6 +2779,8 @@ bool upb_msgdef_addoneof(upb_msgdef *m, upb_oneofdef *o, const void *ref_donor,
2583
2779
  bool upb_msgdef_setfullname(upb_msgdef *m, const char *fullname, upb_status *s);
2584
2780
  void upb_msgdef_setmapentry(upb_msgdef *m, bool map_entry);
2585
2781
  bool upb_msgdef_mapentry(const upb_msgdef *m);
2782
+ upb_wellknowntype_t upb_msgdef_wellknowntype(const upb_msgdef *m);
2783
+ bool upb_msgdef_isnumberwrapper(const upb_msgdef *m);
2586
2784
  bool upb_msgdef_setsyntax(upb_msgdef *m, upb_syntax_t syntax);
2587
2785
 
2588
2786
  /* Field lookup in a couple of different variations:
@@ -2739,12 +2937,24 @@ class upb::EnumDef {
2739
2937
 
2740
2938
  private:
2741
2939
  UPB_DISALLOW_POD_OPS(EnumDef, upb::EnumDef)
2742
- };
2940
+ #else
2941
+ struct upb_enumdef {
2942
+ upb_def base;
2743
2943
 
2944
+ upb_strtable ntoi;
2945
+ upb_inttable iton;
2946
+ int32_t defaultval;
2744
2947
  #endif /* __cplusplus */
2948
+ };
2745
2949
 
2746
2950
  UPB_BEGIN_EXTERN_C
2747
2951
 
2952
+ extern const struct upb_refcounted_vtbl upb_enumdef_vtbl;
2953
+
2954
+ #define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \
2955
+ { UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \
2956
+ iton, defaultval }
2957
+
2748
2958
  /* Native C API. */
2749
2959
  upb_enumdef *upb_enumdef_new(const void *owner);
2750
2960
 
@@ -2893,12 +3103,25 @@ class upb::OneofDef {
2893
3103
 
2894
3104
  private:
2895
3105
  UPB_DISALLOW_POD_OPS(OneofDef, upb::OneofDef)
2896
- };
3106
+ #else
3107
+ struct upb_oneofdef {
3108
+ upb_refcounted base;
2897
3109
 
3110
+ uint32_t index; /* Index within oneofs. */
3111
+ const char *name;
3112
+ upb_strtable ntof;
3113
+ upb_inttable itof;
3114
+ const upb_msgdef *parent;
2898
3115
  #endif /* __cplusplus */
3116
+ };
2899
3117
 
2900
3118
  UPB_BEGIN_EXTERN_C
2901
3119
 
3120
+ extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl;
3121
+
3122
+ #define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \
3123
+ { UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof }
3124
+
2902
3125
  /* Native C API. */
2903
3126
  upb_oneofdef *upb_oneofdef_new(const void *owner);
2904
3127
 
@@ -2966,6 +3189,17 @@ class upb::FileDef {
2966
3189
  const char* package() const;
2967
3190
  bool set_package(const char* package, Status* s);
2968
3191
 
3192
+ /* Sets the php class prefix which is prepended to all php generated classes
3193
+ * from this .proto. Default is empty. */
3194
+ const char* phpprefix() const;
3195
+ bool set_phpprefix(const char* phpprefix, Status* s);
3196
+
3197
+ /* Use this option to change the namespace of php generated classes. Default
3198
+ * is empty. When this option is empty, the package name will be used for
3199
+ * determining the namespace. */
3200
+ const char* phpnamespace() const;
3201
+ bool set_phpnamespace(const char* phpnamespace, Status* s);
3202
+
2969
3203
  /* Syntax for the file. Defaults to proto2. */
2970
3204
  upb_syntax_t syntax() const;
2971
3205
  void set_syntax(upb_syntax_t syntax);
@@ -3006,12 +3240,25 @@ class upb::FileDef {
3006
3240
 
3007
3241
  private:
3008
3242
  UPB_DISALLOW_POD_OPS(FileDef, upb::FileDef)
3009
- };
3243
+ #else
3244
+ struct upb_filedef {
3245
+ upb_refcounted base;
3246
+
3247
+ const char *name;
3248
+ const char *package;
3249
+ const char *phpprefix;
3250
+ const char *phpnamespace;
3251
+ upb_syntax_t syntax;
3010
3252
 
3253
+ upb_inttable defs;
3254
+ upb_inttable deps;
3011
3255
  #endif
3256
+ };
3012
3257
 
3013
3258
  UPB_BEGIN_EXTERN_C
3014
3259
 
3260
+ extern const struct upb_refcounted_vtbl upb_filedef_vtbl;
3261
+
3015
3262
  upb_filedef *upb_filedef_new(const void *owner);
3016
3263
 
3017
3264
  /* Include upb_refcounted methods like upb_msgdef_ref(). */
@@ -3019,6 +3266,8 @@ UPB_REFCOUNTED_CMETHODS(upb_filedef, upb_filedef_upcast)
3019
3266
 
3020
3267
  const char *upb_filedef_name(const upb_filedef *f);
3021
3268
  const char *upb_filedef_package(const upb_filedef *f);
3269
+ const char *upb_filedef_phpprefix(const upb_filedef *f);
3270
+ const char *upb_filedef_phpnamespace(const upb_filedef *f);
3022
3271
  upb_syntax_t upb_filedef_syntax(const upb_filedef *f);
3023
3272
  size_t upb_filedef_defcount(const upb_filedef *f);
3024
3273
  size_t upb_filedef_depcount(const upb_filedef *f);
@@ -3028,6 +3277,10 @@ const upb_filedef *upb_filedef_dep(const upb_filedef *f, size_t i);
3028
3277
  bool upb_filedef_freeze(upb_filedef *f, upb_status *s);
3029
3278
  bool upb_filedef_setname(upb_filedef *f, const char *name, upb_status *s);
3030
3279
  bool upb_filedef_setpackage(upb_filedef *f, const char *package, upb_status *s);
3280
+ bool upb_filedef_setphpprefix(upb_filedef *f, const char *phpprefix,
3281
+ upb_status *s);
3282
+ bool upb_filedef_setphpnamespace(upb_filedef *f, const char *phpnamespace,
3283
+ upb_status *s);
3031
3284
  bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax, upb_status *s);
3032
3285
 
3033
3286
  bool upb_filedef_adddef(upb_filedef *f, upb_def *def, const void *ref_donor,
@@ -3135,9 +3388,13 @@ class upb::SymbolTable {
3135
3388
 
3136
3389
  private:
3137
3390
  UPB_DISALLOW_POD_OPS(SymbolTable, upb::SymbolTable)
3138
- };
3391
+ #else
3392
+ struct upb_symtab {
3393
+ upb_refcounted base;
3139
3394
 
3395
+ upb_strtable symtab;
3140
3396
  #endif /* __cplusplus */
3397
+ };
3141
3398
 
3142
3399
  UPB_BEGIN_EXTERN_C
3143
3400
 
@@ -3149,6 +3406,8 @@ const upb_def *upb_symtab_resolve(const upb_symtab *s, const char *base,
3149
3406
  const char *sym);
3150
3407
  const upb_def *upb_symtab_lookup(const upb_symtab *s, const char *sym);
3151
3408
  const upb_msgdef *upb_symtab_lookupmsg(const upb_symtab *s, const char *sym);
3409
+ const upb_msgdef *upb_symtab_lookupmsg2(
3410
+ const upb_symtab *s, const char *sym, size_t len);
3152
3411
  const upb_enumdef *upb_symtab_lookupenum(const upb_symtab *s, const char *sym);
3153
3412
  bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, size_t n,
3154
3413
  void *ref_donor, upb_status *status);
@@ -3505,6 +3764,12 @@ inline void MessageDef::setmapentry(bool map_entry) {
3505
3764
  inline bool MessageDef::mapentry() const {
3506
3765
  return upb_msgdef_mapentry(this);
3507
3766
  }
3767
+ inline upb_wellknowntype_t MessageDef::wellknowntype() const {
3768
+ return upb_msgdef_wellknowntype(this);
3769
+ }
3770
+ inline bool MessageDef::isnumberwrapper() const {
3771
+ return upb_msgdef_isnumberwrapper(this);
3772
+ }
3508
3773
  inline MessageDef::field_iterator MessageDef::field_begin() {
3509
3774
  return field_iterator(this);
3510
3775
  }
@@ -3786,6 +4051,18 @@ inline const char* FileDef::package() const {
3786
4051
  inline bool FileDef::set_package(const char* package, Status* s) {
3787
4052
  return upb_filedef_setpackage(this, package, s);
3788
4053
  }
4054
+ inline const char* FileDef::phpprefix() const {
4055
+ return upb_filedef_phpprefix(this);
4056
+ }
4057
+ inline bool FileDef::set_phpprefix(const char* phpprefix, Status* s) {
4058
+ return upb_filedef_setphpprefix(this, phpprefix, s);
4059
+ }
4060
+ inline const char* FileDef::phpnamespace() const {
4061
+ return upb_filedef_phpnamespace(this);
4062
+ }
4063
+ inline bool FileDef::set_phpnamespace(const char* phpnamespace, Status* s) {
4064
+ return upb_filedef_setphpnamespace(this, phpnamespace, s);
4065
+ }
3789
4066
  inline int FileDef::def_count() const {
3790
4067
  return upb_filedef_defcount(this);
3791
4068
  }
@@ -3822,263 +4099,75 @@ inline bool FileDef::AddDependency(const FileDef* file) {
3822
4099
 
3823
4100
  #endif /* UPB_DEF_H_ */
3824
4101
  /*
3825
- ** This file contains definitions of structs that should be considered private
3826
- ** and NOT stable across versions of upb.
4102
+ ** upb::Handlers (upb_handlers)
3827
4103
  **
3828
- ** The only reason they are declared here and not in .c files is to allow upb
3829
- ** and the application (if desired) to embed statically-initialized instances
3830
- ** of structures like defs.
4104
+ ** A upb_handlers is like a virtual table for a upb_msgdef. Each field of the
4105
+ ** message can have associated functions that will be called when we are
4106
+ ** parsing or visiting a stream of data. This is similar to how handlers work
4107
+ ** in SAX (the Simple API for XML).
3831
4108
  **
3832
- ** If you include this file, all guarantees of ABI compatibility go out the
3833
- ** window! Any code that includes this file needs to recompile against the
3834
- ** exact same version of upb that they are linking against.
4109
+ ** The handlers have no idea where the data is coming from, so a single set of
4110
+ ** handlers could be used with two completely different data sources (for
4111
+ ** example, a parser and a visitor over in-memory objects). This decoupling is
4112
+ ** the most important feature of upb, because it allows parsers and serializers
4113
+ ** to be highly reusable.
3835
4114
  **
3836
- ** You also need to recompile if you change the value of the UPB_DEBUG_REFS
3837
- ** flag.
4115
+ ** This is a mixed C/C++ interface that offers a full API to both languages.
4116
+ ** See the top-level README for more information.
3838
4117
  */
3839
4118
 
4119
+ #ifndef UPB_HANDLERS_H
4120
+ #define UPB_HANDLERS_H
3840
4121
 
3841
- #ifndef UPB_STATICINIT_H_
3842
- #define UPB_STATICINIT_H_
3843
4122
 
3844
4123
  #ifdef __cplusplus
3845
- /* Because of how we do our typedefs, this header can't be included from C++. */
3846
- #error This file cannot be included from C++
4124
+ namespace upb {
4125
+ class BufferHandle;
4126
+ class BytesHandler;
4127
+ class HandlerAttributes;
4128
+ class Handlers;
4129
+ template <class T> class Handler;
4130
+ template <class T> struct CanonicalType;
4131
+ } /* namespace upb */
3847
4132
  #endif
3848
4133
 
3849
- /* upb_refcounted *************************************************************/
4134
+ UPB_DECLARE_TYPE(upb::BufferHandle, upb_bufhandle)
4135
+ UPB_DECLARE_TYPE(upb::BytesHandler, upb_byteshandler)
4136
+ UPB_DECLARE_TYPE(upb::HandlerAttributes, upb_handlerattr)
4137
+ UPB_DECLARE_DERIVED_TYPE(upb::Handlers, upb::RefCounted,
4138
+ upb_handlers, upb_refcounted)
3850
4139
 
4140
+ /* The maximum depth that the handler graph can have. This is a resource limit
4141
+ * for the C stack since we sometimes need to recursively traverse the graph.
4142
+ * Cycles are ok; the traversal will stop when it detects a cycle, but we must
4143
+ * hit the cycle before the maximum depth is reached.
4144
+ *
4145
+ * If having a single static limit is too inflexible, we can add another variant
4146
+ * of Handlers::Freeze that allows specifying this as a parameter. */
4147
+ #define UPB_MAX_HANDLER_DEPTH 64
3851
4148
 
3852
- /* upb_def ********************************************************************/
4149
+ /* All the different types of handlers that can be registered.
4150
+ * Only needed for the advanced functions in upb::Handlers. */
4151
+ typedef enum {
4152
+ UPB_HANDLER_INT32,
4153
+ UPB_HANDLER_INT64,
4154
+ UPB_HANDLER_UINT32,
4155
+ UPB_HANDLER_UINT64,
4156
+ UPB_HANDLER_FLOAT,
4157
+ UPB_HANDLER_DOUBLE,
4158
+ UPB_HANDLER_BOOL,
4159
+ UPB_HANDLER_STARTSTR,
4160
+ UPB_HANDLER_STRING,
4161
+ UPB_HANDLER_ENDSTR,
4162
+ UPB_HANDLER_STARTSUBMSG,
4163
+ UPB_HANDLER_ENDSUBMSG,
4164
+ UPB_HANDLER_STARTSEQ,
4165
+ UPB_HANDLER_ENDSEQ
4166
+ } upb_handlertype_t;
3853
4167
 
3854
- struct upb_def {
3855
- upb_refcounted base;
4168
+ #define UPB_HANDLER_MAX (UPB_HANDLER_ENDSEQ+1)
3856
4169
 
3857
- const char *fullname;
3858
- const upb_filedef* file;
3859
- char type; /* A upb_deftype_t (char to save space) */
3860
-
3861
- /* Used as a flag during the def's mutable stage. Must be false unless
3862
- * it is currently being used by a function on the stack. This allows
3863
- * us to easily determine which defs were passed into the function's
3864
- * current invocation. */
3865
- bool came_from_user;
3866
- };
3867
-
3868
- #define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \
3869
- { UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false }
3870
-
3871
-
3872
- /* upb_fielddef ***************************************************************/
3873
-
3874
- struct upb_fielddef {
3875
- upb_def base;
3876
-
3877
- union {
3878
- int64_t sint;
3879
- uint64_t uint;
3880
- double dbl;
3881
- float flt;
3882
- void *bytes;
3883
- } defaultval;
3884
- union {
3885
- const upb_msgdef *def; /* If !msg_is_symbolic. */
3886
- char *name; /* If msg_is_symbolic. */
3887
- } msg;
3888
- union {
3889
- const upb_def *def; /* If !subdef_is_symbolic. */
3890
- char *name; /* If subdef_is_symbolic. */
3891
- } sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */
3892
- bool subdef_is_symbolic;
3893
- bool msg_is_symbolic;
3894
- const upb_oneofdef *oneof;
3895
- bool default_is_string;
3896
- bool type_is_set_; /* False until type is explicitly set. */
3897
- bool is_extension_;
3898
- bool lazy_;
3899
- bool packed_;
3900
- upb_intfmt_t intfmt;
3901
- bool tagdelim;
3902
- upb_fieldtype_t type_;
3903
- upb_label_t label_;
3904
- uint32_t number_;
3905
- uint32_t selector_base; /* Used to index into a upb::Handlers table. */
3906
- uint32_t index_;
3907
- };
3908
-
3909
- extern const struct upb_refcounted_vtbl upb_fielddef_vtbl;
3910
-
3911
- #define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \
3912
- packed, name, num, msgdef, subdef, selector_base, \
3913
- index, defaultval, refs, ref2s) \
3914
- { \
3915
- UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \
3916
- defaultval, {msgdef}, {subdef}, NULL, false, false, \
3917
- type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \
3918
- lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \
3919
- }
3920
-
3921
-
3922
- /* upb_msgdef *****************************************************************/
3923
-
3924
- struct upb_msgdef {
3925
- upb_def base;
3926
-
3927
- size_t selector_count;
3928
- uint32_t submsg_field_count;
3929
-
3930
- /* Tables for looking up fields by number and name. */
3931
- upb_inttable itof; /* int to field */
3932
- upb_strtable ntof; /* name to field/oneof */
3933
-
3934
- /* Is this a map-entry message? */
3935
- bool map_entry;
3936
-
3937
- /* Whether this message has proto2 or proto3 semantics. */
3938
- upb_syntax_t syntax;
3939
-
3940
- /* TODO(haberman): proper extension ranges (there can be multiple). */
3941
- };
3942
-
3943
- extern const struct upb_refcounted_vtbl upb_msgdef_vtbl;
3944
-
3945
- /* TODO: also support static initialization of the oneofs table. This will be
3946
- * needed if we compile in descriptors that contain oneofs. */
3947
- #define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \
3948
- map_entry, syntax, refs, ref2s) \
3949
- { \
3950
- UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \
3951
- selector_count, submsg_field_count, itof, ntof, map_entry, syntax \
3952
- }
3953
-
3954
-
3955
- /* upb_enumdef ****************************************************************/
3956
-
3957
- struct upb_enumdef {
3958
- upb_def base;
3959
-
3960
- upb_strtable ntoi;
3961
- upb_inttable iton;
3962
- int32_t defaultval;
3963
- };
3964
-
3965
- extern const struct upb_refcounted_vtbl upb_enumdef_vtbl;
3966
-
3967
- #define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \
3968
- { UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \
3969
- iton, defaultval }
3970
-
3971
-
3972
- /* upb_oneofdef ***************************************************************/
3973
-
3974
- struct upb_oneofdef {
3975
- upb_refcounted base;
3976
-
3977
- uint32_t index; /* Index within oneofs. */
3978
- const char *name;
3979
- upb_strtable ntof;
3980
- upb_inttable itof;
3981
- const upb_msgdef *parent;
3982
- };
3983
-
3984
- extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl;
3985
-
3986
- #define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \
3987
- { UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof }
3988
-
3989
-
3990
- /* upb_symtab *****************************************************************/
3991
-
3992
- struct upb_symtab {
3993
- upb_refcounted base;
3994
-
3995
- upb_strtable symtab;
3996
- };
3997
-
3998
- struct upb_filedef {
3999
- upb_refcounted base;
4000
-
4001
- const char *name;
4002
- const char *package;
4003
- upb_syntax_t syntax;
4004
-
4005
- upb_inttable defs;
4006
- upb_inttable deps;
4007
- };
4008
-
4009
- extern const struct upb_refcounted_vtbl upb_filedef_vtbl;
4010
-
4011
- #endif /* UPB_STATICINIT_H_ */
4012
- /*
4013
- ** upb::Handlers (upb_handlers)
4014
- **
4015
- ** A upb_handlers is like a virtual table for a upb_msgdef. Each field of the
4016
- ** message can have associated functions that will be called when we are
4017
- ** parsing or visiting a stream of data. This is similar to how handlers work
4018
- ** in SAX (the Simple API for XML).
4019
- **
4020
- ** The handlers have no idea where the data is coming from, so a single set of
4021
- ** handlers could be used with two completely different data sources (for
4022
- ** example, a parser and a visitor over in-memory objects). This decoupling is
4023
- ** the most important feature of upb, because it allows parsers and serializers
4024
- ** to be highly reusable.
4025
- **
4026
- ** This is a mixed C/C++ interface that offers a full API to both languages.
4027
- ** See the top-level README for more information.
4028
- */
4029
-
4030
- #ifndef UPB_HANDLERS_H
4031
- #define UPB_HANDLERS_H
4032
-
4033
-
4034
- #ifdef __cplusplus
4035
- namespace upb {
4036
- class BufferHandle;
4037
- class BytesHandler;
4038
- class HandlerAttributes;
4039
- class Handlers;
4040
- template <class T> class Handler;
4041
- template <class T> struct CanonicalType;
4042
- } /* namespace upb */
4043
- #endif
4044
-
4045
- UPB_DECLARE_TYPE(upb::BufferHandle, upb_bufhandle)
4046
- UPB_DECLARE_TYPE(upb::BytesHandler, upb_byteshandler)
4047
- UPB_DECLARE_TYPE(upb::HandlerAttributes, upb_handlerattr)
4048
- UPB_DECLARE_DERIVED_TYPE(upb::Handlers, upb::RefCounted,
4049
- upb_handlers, upb_refcounted)
4050
-
4051
- /* The maximum depth that the handler graph can have. This is a resource limit
4052
- * for the C stack since we sometimes need to recursively traverse the graph.
4053
- * Cycles are ok; the traversal will stop when it detects a cycle, but we must
4054
- * hit the cycle before the maximum depth is reached.
4055
- *
4056
- * If having a single static limit is too inflexible, we can add another variant
4057
- * of Handlers::Freeze that allows specifying this as a parameter. */
4058
- #define UPB_MAX_HANDLER_DEPTH 64
4059
-
4060
- /* All the different types of handlers that can be registered.
4061
- * Only needed for the advanced functions in upb::Handlers. */
4062
- typedef enum {
4063
- UPB_HANDLER_INT32,
4064
- UPB_HANDLER_INT64,
4065
- UPB_HANDLER_UINT32,
4066
- UPB_HANDLER_UINT64,
4067
- UPB_HANDLER_FLOAT,
4068
- UPB_HANDLER_DOUBLE,
4069
- UPB_HANDLER_BOOL,
4070
- UPB_HANDLER_STARTSTR,
4071
- UPB_HANDLER_STRING,
4072
- UPB_HANDLER_ENDSTR,
4073
- UPB_HANDLER_STARTSUBMSG,
4074
- UPB_HANDLER_ENDSUBMSG,
4075
- UPB_HANDLER_STARTSEQ,
4076
- UPB_HANDLER_ENDSEQ
4077
- } upb_handlertype_t;
4078
-
4079
- #define UPB_HANDLER_MAX (UPB_HANDLER_ENDSEQ+1)
4080
-
4081
- #define UPB_BREAK NULL
4170
+ #define UPB_BREAK NULL
4082
4171
 
4083
4172
  /* A convenient definition for when no closure is needed. */
4084
4173
  extern char _upb_noclosure;
@@ -4113,7 +4202,8 @@ UPB_END_EXTERN_C
4113
4202
  /* Static selectors for upb::Handlers. */
4114
4203
  #define UPB_STARTMSG_SELECTOR 0
4115
4204
  #define UPB_ENDMSG_SELECTOR 1
4116
- #define UPB_STATIC_SELECTOR_COUNT 2
4205
+ #define UPB_UNKNOWN_SELECTOR 2
4206
+ #define UPB_STATIC_SELECTOR_COUNT 3
4117
4207
 
4118
4208
  /* Static selectors for upb::BytesHandler. */
4119
4209
  #define UPB_STARTSTR_SELECTOR 0
@@ -4642,6 +4732,8 @@ UPB_BEGIN_EXTERN_C
4642
4732
  /* Native C API. */
4643
4733
 
4644
4734
  /* Handler function typedefs. */
4735
+ typedef bool upb_unknown_handlerfunc(void *c, const void *hd, const char *buf,
4736
+ size_t n);
4645
4737
  typedef bool upb_startmsg_handlerfunc(void *c, const void*);
4646
4738
  typedef bool upb_endmsg_handlerfunc(void *c, const void *, upb_status *status);
4647
4739
  typedef void* upb_startfield_handlerfunc(void *c, const void *hd);
@@ -4695,6 +4787,8 @@ const upb_status *upb_handlers_status(upb_handlers *h);
4695
4787
  void upb_handlers_clearerr(upb_handlers *h);
4696
4788
  const upb_msgdef *upb_handlers_msgdef(const upb_handlers *h);
4697
4789
  bool upb_handlers_addcleanup(upb_handlers *h, void *p, upb_handlerfree *hfree);
4790
+ bool upb_handlers_setunknown(upb_handlers *h, upb_unknown_handlerfunc *func,
4791
+ upb_handlerattr *attr);
4698
4792
 
4699
4793
  bool upb_handlers_setstartmsg(upb_handlers *h, upb_startmsg_handlerfunc *func,
4700
4794
  upb_handlerattr *attr);
@@ -4803,6 +4897,34 @@ UPB_INLINE upb_selector_t upb_handlers_getendselector(upb_selector_t start) {
4803
4897
  uint32_t upb_handlers_selectorbaseoffset(const upb_fielddef *f);
4804
4898
  uint32_t upb_handlers_selectorcount(const upb_fielddef *f);
4805
4899
 
4900
+
4901
+ /** Message handlers ******************************************************************/
4902
+
4903
+ /* These are the handlers used internally by upb_msgfactory_getmergehandlers().
4904
+ * They write scalar data to a known offset from the message pointer.
4905
+ *
4906
+ * These would be trivial for anyone to implement themselves, but it's better
4907
+ * to use these because some JITs will recognize and specialize these instead
4908
+ * of actually calling the function. */
4909
+
4910
+ /* Sets a handler for the given primitive field that will write the data at the
4911
+ * given offset. If hasbit > 0, also sets a hasbit at the given bit offset
4912
+ * (addressing each byte low to high). */
4913
+ bool upb_msg_setscalarhandler(upb_handlers *h,
4914
+ const upb_fielddef *f,
4915
+ size_t offset,
4916
+ int32_t hasbit);
4917
+
4918
+ /* If the given handler is a msghandlers_primitive field, returns true and sets
4919
+ * *type, *offset and *hasbit. Otherwise returns false. */
4920
+ bool upb_msg_getscalarhandlerdata(const upb_handlers *h,
4921
+ upb_selector_t s,
4922
+ upb_fieldtype_t *type,
4923
+ size_t *offset,
4924
+ int32_t *hasbit);
4925
+
4926
+
4927
+
4806
4928
  UPB_END_EXTERN_C
4807
4929
 
4808
4930
  /*
@@ -6264,6 +6386,18 @@ UPB_INLINE size_t upb_sink_putstring(upb_sink *s, upb_selector_t sel,
6264
6386
  return handler(s->closure, hd, buf, n, handle);
6265
6387
  }
6266
6388
 
6389
+ UPB_INLINE bool upb_sink_putunknown(upb_sink *s, const char *buf, size_t n) {
6390
+ typedef upb_unknown_handlerfunc func;
6391
+ func *handler;
6392
+ const void *hd;
6393
+ if (!s->handlers) return true;
6394
+ handler = (func *)upb_handlers_gethandler(s->handlers, UPB_UNKNOWN_SELECTOR);
6395
+
6396
+ if (!handler) return n;
6397
+ hd = upb_handlers_gethandlerdata(s->handlers, UPB_UNKNOWN_SELECTOR);
6398
+ return handler(s->closure, hd, buf, n);
6399
+ }
6400
+
6267
6401
  UPB_INLINE bool upb_sink_startmsg(upb_sink *s) {
6268
6402
  typedef upb_startmsg_handlerfunc func;
6269
6403
  func *startmsg;
@@ -6468,34 +6602,6 @@ inline bool BufferSource::PutBuffer(const char *buf, size_t len,
6468
6602
  #endif
6469
6603
 
6470
6604
  #endif
6471
- /*
6472
- ** upb::Message is a representation for protobuf messages.
6473
- **
6474
- ** However it differs from other common representations like
6475
- ** google::protobuf::Message in one key way: it does not prescribe any
6476
- ** ownership between messages and submessages, and it relies on the
6477
- ** client to delete each message/submessage/array/map at the appropriate
6478
- ** time.
6479
- **
6480
- ** A client can access a upb::Message without knowing anything about
6481
- ** ownership semantics, but to create or mutate a message a user needs
6482
- ** to implement the memory management themselves.
6483
- **
6484
- ** Currently all messages, arrays, and maps store a upb_alloc* internally.
6485
- ** Mutating operations use this when they require dynamically-allocated
6486
- ** memory. We could potentially eliminate this size overhead later by
6487
- ** letting the user flip a bit on the factory that prevents this from
6488
- ** being stored. The user would then need to use separate functions where
6489
- ** the upb_alloc* is passed explicitly. However for handlers to populate
6490
- ** such structures, they would need a place to store this upb_alloc* during
6491
- ** parsing; upb_handlers don't currently have a good way to accommodate this.
6492
- **
6493
- ** TODO: UTF-8 checking?
6494
- **/
6495
-
6496
- #ifndef UPB_MSG_H_
6497
- #define UPB_MSG_H_
6498
-
6499
6605
 
6500
6606
  #ifdef __cplusplus
6501
6607
 
@@ -6503,21 +6609,16 @@ namespace upb {
6503
6609
  class Array;
6504
6610
  class Map;
6505
6611
  class MapIterator;
6506
- class MessageFactory;
6507
6612
  class MessageLayout;
6508
- class Visitor;
6509
- class VisitorPlan;
6510
6613
  }
6511
6614
 
6512
6615
  #endif
6513
6616
 
6514
- UPB_DECLARE_TYPE(upb::MessageFactory, upb_msgfactory)
6515
- UPB_DECLARE_TYPE(upb::MessageLayout, upb_msglayout)
6516
- UPB_DECLARE_TYPE(upb::Array, upb_array)
6517
6617
  UPB_DECLARE_TYPE(upb::Map, upb_map)
6518
6618
  UPB_DECLARE_TYPE(upb::MapIterator, upb_mapiter)
6519
- UPB_DECLARE_TYPE(upb::Visitor, upb_visitor)
6520
- UPB_DECLARE_TYPE(upb::VisitorPlan, upb_visitorplan)
6619
+
6620
+ struct upb_array;
6621
+ typedef struct upb_array upb_array;
6521
6622
 
6522
6623
  /* TODO(haberman): C++ accessors */
6523
6624
 
@@ -6528,68 +6629,45 @@ typedef void upb_msg;
6528
6629
 
6529
6630
  /** upb_msglayout *************************************************************/
6530
6631
 
6531
- /* upb_msglayout represents the memory layout of a given upb_msgdef. You get
6532
- * instances of this from a upb_msgfactory, and the factory always owns the
6533
- * msglayout. */
6534
-
6535
- /* Gets the factory for this layout */
6536
- upb_msgfactory *upb_msglayout_factory(const upb_msglayout *l);
6537
-
6538
- /* Get the msglayout for a submessage. This requires that this field is a
6539
- * submessage, ie. upb_fielddef_issubmsg(upb_msglayout_msgdef(l)) == true.
6540
- *
6541
- * Since map entry messages don't have layouts, if upb_fielddef_ismap(f) == true
6542
- * then this function will return the layout for the map's value. It requires
6543
- * that the value type of the map field is a submessage. */
6544
- const upb_msglayout *upb_msglayout_sublayout(const upb_msglayout *l,
6545
- const upb_fielddef *f);
6546
-
6547
- /* Returns the msgdef for this msglayout. */
6548
- const upb_msgdef *upb_msglayout_msgdef(const upb_msglayout *l);
6549
-
6632
+ /* upb_msglayout represents the memory layout of a given upb_msgdef. The
6633
+ * members are public so generated code can initialize them, but users MUST NOT
6634
+ * read or write any of its members. */
6550
6635
 
6551
- /** upb_visitor ***************************************************************/
6552
-
6553
- /* upb_visitor will visit all the fields of a message and its submessages. It
6554
- * uses a upb_visitorplan which you can obtain from a upb_msgfactory. */
6555
-
6556
- upb_visitor *upb_visitor_create(upb_env *e, const upb_visitorplan *vp,
6557
- upb_sink *output);
6558
- bool upb_visitor_visitmsg(upb_visitor *v, const upb_msg *msg);
6559
-
6560
-
6561
- /** upb_msgfactory ************************************************************/
6562
-
6563
- /* A upb_msgfactory contains a cache of upb_msglayout, upb_handlers, and
6564
- * upb_visitorplan objects. These are the objects necessary to represent,
6565
- * populate, and and visit upb_msg objects.
6566
- *
6567
- * These caches are all populated by upb_msgdef, and lazily created on demand.
6568
- */
6569
-
6570
- /* Creates and destroys a msgfactory, respectively. The messages for this
6571
- * msgfactory must come from |symtab| (which should outlive the msgfactory). */
6572
- upb_msgfactory *upb_msgfactory_new(const upb_symtab *symtab);
6573
- void upb_msgfactory_free(upb_msgfactory *f);
6636
+ typedef struct {
6637
+ uint32_t number;
6638
+ uint16_t offset;
6639
+ int16_t presence; /* If >0, hasbit_index+1. If <0, oneof_index+1. */
6640
+ uint16_t submsg_index; /* undefined if descriptortype != MESSAGE or GROUP. */
6641
+ uint8_t descriptortype;
6642
+ uint8_t label;
6643
+ } upb_msglayout_field;
6644
+
6645
+ typedef struct upb_msglayout {
6646
+ const struct upb_msglayout *const* submsgs;
6647
+ const upb_msglayout_field *fields;
6648
+ /* Must be aligned to sizeof(void*). Doesn't include internal members like
6649
+ * unknown fields, extension dict, pointer to msglayout, etc. */
6650
+ uint16_t size;
6651
+ uint16_t field_count;
6652
+ bool extendable;
6653
+ } upb_msglayout;
6654
+
6655
+
6656
+ /** upb_strview ************************************************************/
6574
6657
 
6575
- const upb_symtab *upb_msgfactory_symtab(const upb_msgfactory *f);
6658
+ typedef struct {
6659
+ const char *data;
6660
+ size_t size;
6661
+ } upb_strview;
6662
+
6663
+ UPB_INLINE upb_strview upb_strview_make(const char *data, size_t size) {
6664
+ upb_strview ret;
6665
+ ret.data = data;
6666
+ ret.size = size;
6667
+ return ret;
6668
+ }
6576
6669
 
6577
- /* The functions to get cached objects, lazily creating them on demand. These
6578
- * all require:
6579
- *
6580
- * - m is in upb_msgfactory_symtab(f)
6581
- * - upb_msgdef_mapentry(m) == false (since map messages can't have layouts).
6582
- *
6583
- * The returned objects will live for as long as the msgfactory does.
6584
- *
6585
- * TODO(haberman): consider making this thread-safe and take a const
6586
- * upb_msgfactory. */
6587
- const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f,
6588
- const upb_msgdef *m);
6589
- const upb_handlers *upb_msgfactory_getmergehandlers(upb_msgfactory *f,
6590
- const upb_msgdef *m);
6591
- const upb_visitorplan *upb_msgfactory_getvisitorplan(upb_msgfactory *f,
6592
- const upb_handlers *h);
6670
+ #define UPB_STRVIEW_INIT(ptr, len) {ptr, len}
6593
6671
 
6594
6672
 
6595
6673
  /** upb_msgval ****************************************************************/
@@ -6609,10 +6687,7 @@ typedef union {
6609
6687
  const upb_msg* msg;
6610
6688
  const upb_array* arr;
6611
6689
  const void* ptr;
6612
- struct {
6613
- const char *ptr;
6614
- size_t len;
6615
- } str;
6690
+ upb_strview str;
6616
6691
  } upb_msgval;
6617
6692
 
6618
6693
  #define ACCESSORS(name, membername, ctype) \
@@ -6639,237 +6714,2015 @@ ACCESSORS(map, map, const upb_map*)
6639
6714
  ACCESSORS(msg, msg, const upb_msg*)
6640
6715
  ACCESSORS(ptr, ptr, const void*)
6641
6716
  ACCESSORS(arr, arr, const upb_array*)
6717
+ ACCESSORS(str, str, upb_strview)
6642
6718
 
6643
6719
  #undef ACCESSORS
6644
6720
 
6645
- UPB_INLINE upb_msgval upb_msgval_str(const char *ptr, size_t len) {
6646
- upb_msgval ret;
6647
- ret.str.ptr = ptr;
6648
- ret.str.len = len;
6649
- return ret;
6650
- }
6651
-
6652
- UPB_INLINE const char* upb_msgval_getstr(upb_msgval val) {
6653
- return val.str.ptr;
6654
- }
6655
-
6656
- UPB_INLINE size_t upb_msgval_getstrlen(upb_msgval val) {
6657
- return val.str.len;
6721
+ UPB_INLINE upb_msgval upb_msgval_makestr(const char *data, size_t size) {
6722
+ return upb_msgval_str(upb_strview_make(data, size));
6658
6723
  }
6659
6724
 
6660
6725
 
6661
6726
  /** upb_msg *******************************************************************/
6662
6727
 
6663
6728
  /* A upb_msg represents a protobuf message. It always corresponds to a specific
6664
- * upb_msglayout, which describes how it is laid out in memory.
6665
- *
6666
- * The message will have a fixed size, as returned by upb_msg_sizeof(), which
6667
- * will be used to store fixed-length fields. The upb_msg may also allocate
6668
- * dynamic memory internally to store data such as:
6729
+ * upb_msglayout, which describes how it is laid out in memory. */
6730
+
6731
+ /* Creates a new message of the given type/layout in this arena. */
6732
+ upb_msg *upb_msg_new(const upb_msglayout *l, upb_arena *a);
6733
+
6734
+ /* Returns the arena for the given message. */
6735
+ upb_arena *upb_msg_arena(const upb_msg *msg);
6736
+
6737
+ void upb_msg_addunknown(upb_msg *msg, const char *data, size_t len);
6738
+ const char *upb_msg_getunknown(const upb_msg *msg, size_t *len);
6739
+
6740
+ /* Read-only message API. Can be safely called by anyone. */
6741
+
6742
+ /* Returns the value associated with this field:
6743
+ * - for scalar fields (including strings), the value directly.
6744
+ * - return upb_msg*, or upb_map* for msg/map.
6745
+ * If the field is unset for these field types, returns NULL.
6669
6746
  *
6670
- * - extensions
6671
- * - unknown fields
6747
+ * TODO(haberman): should we let users store cached array/map/msg
6748
+ * pointers here for fields that are unset? Could be useful for the
6749
+ * strongly-owned submessage model (ie. generated C API that doesn't use
6750
+ * arenas).
6751
+ */
6752
+ upb_msgval upb_msg_get(const upb_msg *msg,
6753
+ int field_index,
6754
+ const upb_msglayout *l);
6755
+
6756
+ /* May only be called for fields where upb_fielddef_haspresence(f) == true. */
6757
+ bool upb_msg_has(const upb_msg *msg,
6758
+ int field_index,
6759
+ const upb_msglayout *l);
6760
+
6761
+ /* Mutable message API. May only be called by the owner of the message who
6762
+ * knows its ownership scheme and how to keep it consistent. */
6763
+
6764
+ /* Sets the given field to the given value. Does not perform any memory
6765
+ * management: if you overwrite a pointer to a msg/array/map/string without
6766
+ * cleaning it up (or using an arena) it will leak.
6767
+ */
6768
+ void upb_msg_set(upb_msg *msg,
6769
+ int field_index,
6770
+ upb_msgval val,
6771
+ const upb_msglayout *l);
6772
+
6773
+ /* For a primitive field, set it back to its default. For repeated, string, and
6774
+ * submessage fields set it back to NULL. This could involve releasing some
6775
+ * internal memory (for example, from an extension dictionary), but it is not
6776
+ * recursive in any way and will not recover any memory that may be used by
6777
+ * arrays/maps/strings/msgs that this field may have pointed to.
6672
6778
  */
6779
+ bool upb_msg_clearfield(upb_msg *msg,
6780
+ int field_index,
6781
+ const upb_msglayout *l);
6782
+
6783
+ /* TODO(haberman): copyfrom()/mergefrom()? */
6784
+
6785
+
6786
+ /** upb_array *****************************************************************/
6787
+
6788
+ /* A upb_array stores data for a repeated field. The memory management
6789
+ * semantics are the same as upb_msg. A upb_array allocates dynamic
6790
+ * memory internally for the array elements. */
6791
+
6792
+ upb_array *upb_array_new(upb_fieldtype_t type, upb_arena *a);
6793
+ upb_fieldtype_t upb_array_type(const upb_array *arr);
6794
+
6795
+ /* Read-only interface. Safe for anyone to call. */
6796
+
6797
+ size_t upb_array_size(const upb_array *arr);
6798
+ upb_msgval upb_array_get(const upb_array *arr, size_t i);
6799
+
6800
+ /* Write interface. May only be called by the message's owner who can enforce
6801
+ * its memory management invariants. */
6802
+
6803
+ bool upb_array_set(upb_array *arr, size_t i, upb_msgval val);
6804
+
6805
+
6806
+ /** upb_map *******************************************************************/
6807
+
6808
+ /* A upb_map stores data for a map field. The memory management semantics are
6809
+ * the same as upb_msg, with one notable exception. upb_map will internally
6810
+ * store a copy of all string keys, but *not* any string values or submessages.
6811
+ * So you must ensure that any string or message values outlive the map, and you
6812
+ * must delete them manually when they are no longer required. */
6813
+
6814
+ upb_map *upb_map_new(upb_fieldtype_t ktype, upb_fieldtype_t vtype,
6815
+ upb_arena *a);
6816
+
6817
+ /* Read-only interface. Safe for anyone to call. */
6818
+
6819
+ size_t upb_map_size(const upb_map *map);
6820
+ upb_fieldtype_t upb_map_keytype(const upb_map *map);
6821
+ upb_fieldtype_t upb_map_valuetype(const upb_map *map);
6822
+ bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val);
6823
+
6824
+ /* Write interface. May only be called by the message's owner who can enforce
6825
+ * its memory management invariants. */
6826
+
6827
+ /* Sets or overwrites an entry in the map. Return value indicates whether
6828
+ * the operation succeeded or failed with OOM, and also whether an existing
6829
+ * key was replaced or not. */
6830
+ bool upb_map_set(upb_map *map,
6831
+ upb_msgval key, upb_msgval val,
6832
+ upb_msgval *valremoved);
6833
+
6834
+ /* Deletes an entry in the map. Returns true if the key was present. */
6835
+ bool upb_map_del(upb_map *map, upb_msgval key);
6836
+
6837
+
6838
+ /** upb_mapiter ***************************************************************/
6839
+
6840
+ /* For iterating over a map. Map iterators are invalidated by mutations to the
6841
+ * map, but an invalidated iterator will never return junk or crash the process.
6842
+ * An invalidated iterator may return entries that were already returned though,
6843
+ * and if you keep invalidating the iterator during iteration, the program may
6844
+ * enter an infinite loop. */
6845
+
6846
+ size_t upb_mapiter_sizeof();
6847
+
6848
+ void upb_mapiter_begin(upb_mapiter *i, const upb_map *t);
6849
+ upb_mapiter *upb_mapiter_new(const upb_map *t, upb_alloc *a);
6850
+ void upb_mapiter_free(upb_mapiter *i, upb_alloc *a);
6851
+ void upb_mapiter_next(upb_mapiter *i);
6852
+ bool upb_mapiter_done(const upb_mapiter *i);
6853
+
6854
+ upb_msgval upb_mapiter_key(const upb_mapiter *i);
6855
+ upb_msgval upb_mapiter_value(const upb_mapiter *i);
6856
+ void upb_mapiter_setdone(upb_mapiter *i);
6857
+ bool upb_mapiter_isequal(const upb_mapiter *i1, const upb_mapiter *i2);
6673
6858
 
6674
- /* Returns the size of a message given this layout. */
6675
- size_t upb_msg_sizeof(const upb_msglayout *l);
6859
+ UPB_END_EXTERN_C
6676
6860
 
6677
- /* upb_msg_init() / upb_msg_uninit() allow the user to use a pre-allocated
6678
- * block of memory as a message. The block's size should be upb_msg_sizeof().
6679
- * upb_msg_uninit() must be called to release internally-allocated memory
6680
- * unless the allocator is an arena that does not require freeing.
6861
+ #endif /* UPB_MSG_H_ */
6862
+ /* This file was generated by upbc (the upb compiler) from the input
6863
+ * file:
6864
+ *
6865
+ * google/protobuf/descriptor.proto
6681
6866
  *
6682
- * Please note that upb_msg_uninit() does *not* free any submessages, maps,
6683
- * or arrays referred to by this message's fields. You must free them manually
6684
- * yourself. */
6685
- void upb_msg_init(upb_msg *msg, const upb_msglayout *l, upb_alloc *a);
6686
- void upb_msg_uninit(upb_msg *msg, const upb_msglayout *l);
6867
+ * Do not edit -- your changes will be discarded when the file is
6868
+ * regenerated. */
6869
+
6870
+ #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
6871
+ #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
6872
+
6873
+ /*
6874
+ ** Functions for use by generated code. These are not public and users must
6875
+ ** not call them directly.
6876
+ */
6877
+
6878
+ #ifndef UPB_GENERATED_UTIL_H_
6879
+ #define UPB_GENERATED_UTIL_H_
6880
+
6881
+ #include <stdint.h>
6882
+ /*
6883
+ ** structs.int.h: structures definitions that are internal to upb.
6884
+ */
6885
+
6886
+ #ifndef UPB_STRUCTS_H_
6887
+ #define UPB_STRUCTS_H_
6888
+
6889
+
6890
+ struct upb_array {
6891
+ upb_fieldtype_t type;
6892
+ uint8_t element_size;
6893
+ void *data; /* Each element is element_size. */
6894
+ size_t len; /* Measured in elements. */
6895
+ size_t size; /* Measured in elements. */
6896
+ upb_arena *arena;
6897
+ };
6898
+
6899
+ #endif /* UPB_STRUCTS_H_ */
6900
+
6901
+
6902
+ #define PTR_AT(msg, ofs, type) (type*)((const char*)msg + ofs)
6903
+
6904
+ UPB_INLINE const void *_upb_array_accessor(const void *msg, size_t ofs,
6905
+ size_t *size) {
6906
+ const upb_array *arr = *PTR_AT(msg, ofs, const upb_array*);
6907
+ if (arr) {
6908
+ if (size) *size = arr->size;
6909
+ return arr->data;
6910
+ } else {
6911
+ if (size) *size = 0;
6912
+ return NULL;
6913
+ }
6914
+ }
6915
+
6916
+ UPB_INLINE void *_upb_array_mutable_accessor(void *msg, size_t ofs,
6917
+ size_t *size) {
6918
+ upb_array *arr = *PTR_AT(msg, ofs, upb_array*);
6919
+ if (arr) {
6920
+ if (size) *size = arr->size;
6921
+ return arr->data;
6922
+ } else {
6923
+ if (size) *size = 0;
6924
+ return NULL;
6925
+ }
6926
+ }
6927
+
6928
+ /* TODO(haberman): this is a mess. It will improve when upb_array no longer
6929
+ * carries reflective state (type, elem_size). */
6930
+ UPB_INLINE void *_upb_array_resize_accessor(void *msg, size_t ofs, size_t size,
6931
+ size_t elem_size,
6932
+ upb_fieldtype_t type,
6933
+ upb_arena *arena) {
6934
+ upb_array *arr = *PTR_AT(msg, ofs, upb_array*);
6935
+
6936
+ if (!arr) {
6937
+ arr = upb_array_new(type, arena);
6938
+ if (!arr) return NULL;
6939
+ *PTR_AT(msg, ofs, upb_array*) = arr;
6940
+ }
6941
+
6942
+ if (size > arr->size) {
6943
+ size_t new_size = UPB_MAX(arr->size, 4);
6944
+ size_t old_bytes = arr->size * elem_size;
6945
+ size_t new_bytes;
6946
+ upb_alloc *alloc = upb_arena_alloc(arr->arena);
6947
+ while (new_size < size) new_size *= 2;
6948
+ new_bytes = new_size * elem_size;
6949
+ arr->data = upb_realloc(alloc, arr->data, old_bytes, new_bytes);
6950
+ if (!arr->data) {
6951
+ return NULL;
6952
+ }
6953
+ arr->size = new_size;
6954
+ }
6955
+
6956
+ arr->len = size;
6957
+ return arr->data;
6958
+ }
6959
+
6960
+ UPB_INLINE bool _upb_array_append_accessor(void *msg, size_t ofs,
6961
+ size_t elem_size,
6962
+ upb_fieldtype_t type,
6963
+ const void *value,
6964
+ upb_arena *arena) {
6965
+ upb_array *arr = *PTR_AT(msg, ofs, upb_array*);
6966
+ size_t i = arr ? arr->len : 0;
6967
+ void *data =
6968
+ _upb_array_resize_accessor(msg, ofs, i + 1, elem_size, type, arena);
6969
+ if (!data) return false;
6970
+ memcpy(PTR_AT(data, i * elem_size, char), value, elem_size);
6971
+ return true;
6972
+ }
6973
+
6974
+ UPB_INLINE bool _upb_has_field(const void *msg, size_t idx) {
6975
+ return (*PTR_AT(msg, idx / 8, const char) & (idx % 8)) != 0;
6976
+ }
6977
+
6978
+ UPB_INLINE bool _upb_sethas(const void *msg, size_t idx) {
6979
+ return (*PTR_AT(msg, idx / 8, char)) |= (1 << (idx % 8));
6980
+ }
6981
+
6982
+ UPB_INLINE bool _upb_clearhas(const void *msg, size_t idx) {
6983
+ return (*PTR_AT(msg, idx / 8, char)) &= ~(1 << (idx % 8));
6984
+ }
6985
+
6986
+ UPB_INLINE bool _upb_has_oneof_field(const void *msg, size_t case_ofs, int32_t num) {
6987
+ return *PTR_AT(msg, case_ofs, int32_t) == num;
6988
+ }
6989
+
6990
+ #undef PTR_AT
6991
+
6992
+ #endif /* UPB_GENERATED_UTIL_H_ */
6993
+
6994
+
6995
+ /*
6996
+ ** upb_decode: parsing into a upb_msg using a upb_msglayout.
6997
+ */
6998
+
6999
+ #ifndef UPB_DECODE_H_
7000
+ #define UPB_DECODE_H_
7001
+
7002
+
7003
+ UPB_BEGIN_EXTERN_C
7004
+
7005
+ bool upb_decode(upb_strview buf, upb_msg *msg, const upb_msglayout *l);
7006
+
7007
+ UPB_END_EXTERN_C
7008
+
7009
+ #endif /* UPB_DECODE_H_ */
7010
+ /*
7011
+ ** upb_encode: parsing into a upb_msg using a upb_msglayout.
7012
+ */
7013
+
7014
+ #ifndef UPB_ENCODE_H_
7015
+ #define UPB_ENCODE_H_
7016
+
7017
+
7018
+ UPB_BEGIN_EXTERN_C
7019
+
7020
+ char *upb_encode(const void *msg, const upb_msglayout *l, upb_arena *arena,
7021
+ size_t *size);
7022
+
7023
+ UPB_END_EXTERN_C
7024
+
7025
+ #endif /* UPB_ENCODE_H_ */
7026
+ UPB_BEGIN_EXTERN_C
7027
+
7028
+ struct google_protobuf_FileDescriptorSet;
7029
+ struct google_protobuf_FileDescriptorProto;
7030
+ struct google_protobuf_DescriptorProto;
7031
+ struct google_protobuf_DescriptorProto_ExtensionRange;
7032
+ struct google_protobuf_DescriptorProto_ReservedRange;
7033
+ struct google_protobuf_ExtensionRangeOptions;
7034
+ struct google_protobuf_FieldDescriptorProto;
7035
+ struct google_protobuf_OneofDescriptorProto;
7036
+ struct google_protobuf_EnumDescriptorProto;
7037
+ struct google_protobuf_EnumDescriptorProto_EnumReservedRange;
7038
+ struct google_protobuf_EnumValueDescriptorProto;
7039
+ struct google_protobuf_ServiceDescriptorProto;
7040
+ struct google_protobuf_MethodDescriptorProto;
7041
+ struct google_protobuf_FileOptions;
7042
+ struct google_protobuf_MessageOptions;
7043
+ struct google_protobuf_FieldOptions;
7044
+ struct google_protobuf_OneofOptions;
7045
+ struct google_protobuf_EnumOptions;
7046
+ struct google_protobuf_EnumValueOptions;
7047
+ struct google_protobuf_ServiceOptions;
7048
+ struct google_protobuf_MethodOptions;
7049
+ struct google_protobuf_UninterpretedOption;
7050
+ struct google_protobuf_UninterpretedOption_NamePart;
7051
+ struct google_protobuf_SourceCodeInfo;
7052
+ struct google_protobuf_SourceCodeInfo_Location;
7053
+ struct google_protobuf_GeneratedCodeInfo;
7054
+ struct google_protobuf_GeneratedCodeInfo_Annotation;
7055
+ typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
7056
+ typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
7057
+ typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
7058
+ typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
7059
+ typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
7060
+ typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
7061
+ typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
7062
+ typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
7063
+ typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
7064
+ typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
7065
+ typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
7066
+ typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
7067
+ typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
7068
+ typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
7069
+ typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
7070
+ typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
7071
+ typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
7072
+ typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
7073
+ typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
7074
+ typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
7075
+ typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
7076
+ typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
7077
+ typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
7078
+ typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
7079
+ typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
7080
+ typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
7081
+ typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
7082
+ extern const upb_msglayout google_protobuf_FileDescriptorSet_msginit;
7083
+ extern const upb_msglayout google_protobuf_FileDescriptorProto_msginit;
7084
+ extern const upb_msglayout google_protobuf_DescriptorProto_msginit;
7085
+ extern const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit;
7086
+ extern const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit;
7087
+ extern const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit;
7088
+ extern const upb_msglayout google_protobuf_FieldDescriptorProto_msginit;
7089
+ extern const upb_msglayout google_protobuf_OneofDescriptorProto_msginit;
7090
+ extern const upb_msglayout google_protobuf_EnumDescriptorProto_msginit;
7091
+ extern const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit;
7092
+ extern const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit;
7093
+ extern const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit;
7094
+ extern const upb_msglayout google_protobuf_MethodDescriptorProto_msginit;
7095
+ extern const upb_msglayout google_protobuf_FileOptions_msginit;
7096
+ extern const upb_msglayout google_protobuf_MessageOptions_msginit;
7097
+ extern const upb_msglayout google_protobuf_FieldOptions_msginit;
7098
+ extern const upb_msglayout google_protobuf_OneofOptions_msginit;
7099
+ extern const upb_msglayout google_protobuf_EnumOptions_msginit;
7100
+ extern const upb_msglayout google_protobuf_EnumValueOptions_msginit;
7101
+ extern const upb_msglayout google_protobuf_ServiceOptions_msginit;
7102
+ extern const upb_msglayout google_protobuf_MethodOptions_msginit;
7103
+ extern const upb_msglayout google_protobuf_UninterpretedOption_msginit;
7104
+ extern const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit;
7105
+ extern const upb_msglayout google_protobuf_SourceCodeInfo_msginit;
7106
+ extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit;
7107
+ extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit;
7108
+ extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit;
7109
+
7110
+ /* Enums */
7111
+
7112
+ typedef enum {
7113
+ google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
7114
+ google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
7115
+ google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
7116
+ } google_protobuf_FieldDescriptorProto_Label;
7117
+
7118
+ typedef enum {
7119
+ google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
7120
+ google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
7121
+ google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
7122
+ google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
7123
+ google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
7124
+ google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
7125
+ google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
7126
+ google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
7127
+ google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
7128
+ google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
7129
+ google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
7130
+ google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
7131
+ google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
7132
+ google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
7133
+ google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
7134
+ google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
7135
+ google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
7136
+ google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
7137
+ } google_protobuf_FieldDescriptorProto_Type;
7138
+
7139
+ typedef enum {
7140
+ google_protobuf_FieldOptions_STRING = 0,
7141
+ google_protobuf_FieldOptions_CORD = 1,
7142
+ google_protobuf_FieldOptions_STRING_PIECE = 2
7143
+ } google_protobuf_FieldOptions_CType;
7144
+
7145
+ typedef enum {
7146
+ google_protobuf_FieldOptions_JS_NORMAL = 0,
7147
+ google_protobuf_FieldOptions_JS_STRING = 1,
7148
+ google_protobuf_FieldOptions_JS_NUMBER = 2
7149
+ } google_protobuf_FieldOptions_JSType;
7150
+
7151
+ typedef enum {
7152
+ google_protobuf_FileOptions_SPEED = 1,
7153
+ google_protobuf_FileOptions_CODE_SIZE = 2,
7154
+ google_protobuf_FileOptions_LITE_RUNTIME = 3
7155
+ } google_protobuf_FileOptions_OptimizeMode;
7156
+
7157
+ typedef enum {
7158
+ google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
7159
+ google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
7160
+ google_protobuf_MethodOptions_IDEMPOTENT = 2
7161
+ } google_protobuf_MethodOptions_IdempotencyLevel;
7162
+
7163
+ /* google.protobuf.FileDescriptorSet */
7164
+
7165
+ UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) {
7166
+ return (google_protobuf_FileDescriptorSet *)upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena);
7167
+ }
7168
+ UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_strview buf, upb_arena *arena) {
7169
+ google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena);
7170
+ return (ret && upb_decode(buf, ret, &google_protobuf_FileDescriptorSet_msginit)) ? ret : NULL;
7171
+ }
7172
+ UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) {
7173
+ return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len);
7174
+ }
7175
+
7176
+ UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg, size_t *len) { return (const google_protobuf_FileDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
7177
+
7178
+ UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet *msg, size_t *len) {
7179
+ return (google_protobuf_FileDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
7180
+ }
7181
+ UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet *msg, size_t len, upb_arena *arena) {
7182
+ return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7183
+ }
7184
+ UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet *msg, upb_arena *arena) {
7185
+ struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
7186
+ bool ok = _upb_array_append_accessor(
7187
+ msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7188
+ if (!ok) return NULL;
7189
+ return sub;
7190
+ }
7191
+
7192
+
7193
+ /* google.protobuf.FileDescriptorProto */
7194
+
7195
+ UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) {
7196
+ return (google_protobuf_FileDescriptorProto *)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
7197
+ }
7198
+ UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
7199
+ google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena);
7200
+ return (ret && upb_decode(buf, ret, &google_protobuf_FileDescriptorProto_msginit)) ? ret : NULL;
7201
+ }
7202
+ UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) {
7203
+ return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len);
7204
+ }
7205
+
7206
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 0); }
7207
+ UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
7208
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 1); }
7209
+ UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
7210
+ UPB_INLINE upb_strview const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
7211
+ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
7212
+ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
7213
+ UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(48, 96), len); }
7214
+ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(52, 104), len); }
7215
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 3); }
7216
+ UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_FileOptions*, UPB_SIZE(28, 56)); }
7217
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 4); }
7218
+ UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_SourceCodeInfo*, UPB_SIZE(32, 64)); }
7219
+ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(56, 112), len); }
7220
+ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(60, 120), len); }
7221
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 2); }
7222
+ UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); }
7223
+
7224
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
7225
+ _upb_sethas(msg, 0);
7226
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
7227
+ }
7228
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
7229
+ _upb_sethas(msg, 1);
7230
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
7231
+ }
7232
+ UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
7233
+ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
7234
+ }
7235
+ UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
7236
+ return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
7237
+ }
7238
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto *msg, upb_strview val, upb_arena *arena) {
7239
+ return _upb_array_append_accessor(
7240
+ msg, UPB_SIZE(36, 72), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
7241
+ }
7242
+ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
7243
+ return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
7244
+ }
7245
+ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
7246
+ return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7247
+ }
7248
+ UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
7249
+ struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
7250
+ bool ok = _upb_array_append_accessor(
7251
+ msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7252
+ if (!ok) return NULL;
7253
+ return sub;
7254
+ }
7255
+ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
7256
+ return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
7257
+ }
7258
+ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
7259
+ return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7260
+ }
7261
+ UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
7262
+ struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
7263
+ bool ok = _upb_array_append_accessor(
7264
+ msg, UPB_SIZE(44, 88), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7265
+ if (!ok) return NULL;
7266
+ return sub;
7267
+ }
7268
+ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto *msg, size_t *len) {
7269
+ return (google_protobuf_ServiceDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(48, 96), len);
7270
+ }
7271
+ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
7272
+ return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(48, 96), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7273
+ }
7274
+ UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
7275
+ struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
7276
+ bool ok = _upb_array_append_accessor(
7277
+ msg, UPB_SIZE(48, 96), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7278
+ if (!ok) return NULL;
7279
+ return sub;
7280
+ }
7281
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto *msg, size_t *len) {
7282
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(52, 104), len);
7283
+ }
7284
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
7285
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(52, 104), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7286
+ }
7287
+ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
7288
+ struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
7289
+ bool ok = _upb_array_append_accessor(
7290
+ msg, UPB_SIZE(52, 104), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7291
+ if (!ok) return NULL;
7292
+ return sub;
7293
+ }
7294
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
7295
+ _upb_sethas(msg, 3);
7296
+ UPB_FIELD_AT(msg, google_protobuf_FileOptions*, UPB_SIZE(28, 56)) = value;
7297
+ }
7298
+ UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
7299
+ struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
7300
+ if (sub == NULL) {
7301
+ sub = (struct google_protobuf_FileOptions*)upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
7302
+ if (!sub) return NULL;
7303
+ google_protobuf_FileDescriptorProto_set_options(msg, sub);
7304
+ }
7305
+ return sub;
7306
+ }
7307
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
7308
+ _upb_sethas(msg, 4);
7309
+ UPB_FIELD_AT(msg, google_protobuf_SourceCodeInfo*, UPB_SIZE(32, 64)) = value;
7310
+ }
7311
+ UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
7312
+ struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
7313
+ if (sub == NULL) {
7314
+ sub = (struct google_protobuf_SourceCodeInfo*)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
7315
+ if (!sub) return NULL;
7316
+ google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
7317
+ }
7318
+ return sub;
7319
+ }
7320
+ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
7321
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 112), len);
7322
+ }
7323
+ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
7324
+ return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(56, 112), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
7325
+ }
7326
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
7327
+ return _upb_array_append_accessor(
7328
+ msg, UPB_SIZE(56, 112), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
7329
+ }
7330
+ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
7331
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(60, 120), len);
7332
+ }
7333
+ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
7334
+ return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(60, 120), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
7335
+ }
7336
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
7337
+ return _upb_array_append_accessor(
7338
+ msg, UPB_SIZE(60, 120), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
7339
+ }
7340
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
7341
+ _upb_sethas(msg, 2);
7342
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
7343
+ }
7344
+
7345
+
7346
+ /* google.protobuf.DescriptorProto */
7347
+
7348
+ UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) {
7349
+ return (google_protobuf_DescriptorProto *)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
7350
+ }
7351
+ UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
7352
+ google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena);
7353
+ return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_msginit)) ? ret : NULL;
7354
+ }
7355
+ UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) {
7356
+ return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len);
7357
+ }
7358
+
7359
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto *msg) { return _upb_has_field(msg, 0); }
7360
+ UPB_INLINE upb_strview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
7361
+ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
7362
+ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
7363
+ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
7364
+ UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
7365
+ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
7366
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto *msg) { return _upb_has_field(msg, 1); }
7367
+ UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_MessageOptions*, UPB_SIZE(12, 24)); }
7368
+ UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
7369
+ UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
7370
+ UPB_INLINE upb_strview const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
7371
+
7372
+ UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_strview value) {
7373
+ _upb_sethas(msg, 0);
7374
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
7375
+ }
7376
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto *msg, size_t *len) {
7377
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
7378
+ }
7379
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
7380
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7381
+ }
7382
+ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
7383
+ struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
7384
+ bool ok = _upb_array_append_accessor(
7385
+ msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7386
+ if (!ok) return NULL;
7387
+ return sub;
7388
+ }
7389
+ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto *msg, size_t *len) {
7390
+ return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
7391
+ }
7392
+ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
7393
+ return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7394
+ }
7395
+ UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
7396
+ struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
7397
+ bool ok = _upb_array_append_accessor(
7398
+ msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7399
+ if (!ok) return NULL;
7400
+ return sub;
7401
+ }
7402
+ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto *msg, size_t *len) {
7403
+ return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
7404
+ }
7405
+ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
7406
+ return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7407
+ }
7408
+ UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
7409
+ struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
7410
+ bool ok = _upb_array_append_accessor(
7411
+ msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7412
+ if (!ok) return NULL;
7413
+ return sub;
7414
+ }
7415
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto *msg, size_t *len) {
7416
+ return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
7417
+ }
7418
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
7419
+ return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7420
+ }
7421
+ UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
7422
+ struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
7423
+ bool ok = _upb_array_append_accessor(
7424
+ msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7425
+ if (!ok) return NULL;
7426
+ return sub;
7427
+ }
7428
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto *msg, size_t *len) {
7429
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
7430
+ }
7431
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
7432
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7433
+ }
7434
+ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
7435
+ struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
7436
+ bool ok = _upb_array_append_accessor(
7437
+ msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7438
+ if (!ok) return NULL;
7439
+ return sub;
7440
+ }
7441
+ UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
7442
+ _upb_sethas(msg, 1);
7443
+ UPB_FIELD_AT(msg, google_protobuf_MessageOptions*, UPB_SIZE(12, 24)) = value;
7444
+ }
7445
+ UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
7446
+ struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
7447
+ if (sub == NULL) {
7448
+ sub = (struct google_protobuf_MessageOptions*)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
7449
+ if (!sub) return NULL;
7450
+ google_protobuf_DescriptorProto_set_options(msg, sub);
7451
+ }
7452
+ return sub;
7453
+ }
7454
+ UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto *msg, size_t *len) {
7455
+ return (google_protobuf_OneofDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
7456
+ }
7457
+ UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
7458
+ return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7459
+ }
7460
+ UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
7461
+ struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
7462
+ bool ok = _upb_array_append_accessor(
7463
+ msg, UPB_SIZE(36, 72), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7464
+ if (!ok) return NULL;
7465
+ return sub;
7466
+ }
7467
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto *msg, size_t *len) {
7468
+ return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
7469
+ }
7470
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
7471
+ return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7472
+ }
7473
+ UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
7474
+ struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
7475
+ bool ok = _upb_array_append_accessor(
7476
+ msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7477
+ if (!ok) return NULL;
7478
+ return sub;
7479
+ }
7480
+ UPB_INLINE upb_strview* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto *msg, size_t *len) {
7481
+ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
7482
+ }
7483
+ UPB_INLINE upb_strview* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
7484
+ return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
7485
+ }
7486
+ UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto *msg, upb_strview val, upb_arena *arena) {
7487
+ return _upb_array_append_accessor(
7488
+ msg, UPB_SIZE(44, 88), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
7489
+ }
7490
+
7491
+
7492
+ /* google.protobuf.DescriptorProto.ExtensionRange */
7493
+
7494
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) {
7495
+ return (google_protobuf_DescriptorProto_ExtensionRange *)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
7496
+ }
7497
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_strview buf, upb_arena *arena) {
7498
+ google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
7499
+ return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit)) ? ret : NULL;
7500
+ }
7501
+ UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) {
7502
+ return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len);
7503
+ }
7504
+
7505
+ UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 0); }
7506
+ UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
7507
+ UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 1); }
7508
+ UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
7509
+ UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 2); }
7510
+ UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, const google_protobuf_ExtensionRangeOptions*, UPB_SIZE(12, 16)); }
7511
+
7512
+ UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
7513
+ _upb_sethas(msg, 0);
7514
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
7515
+ }
7516
+ UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
7517
+ _upb_sethas(msg, 1);
7518
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
7519
+ }
7520
+ UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
7521
+ _upb_sethas(msg, 2);
7522
+ UPB_FIELD_AT(msg, google_protobuf_ExtensionRangeOptions*, UPB_SIZE(12, 16)) = value;
7523
+ }
7524
+ UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena) {
7525
+ struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
7526
+ if (sub == NULL) {
7527
+ sub = (struct google_protobuf_ExtensionRangeOptions*)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
7528
+ if (!sub) return NULL;
7529
+ google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
7530
+ }
7531
+ return sub;
7532
+ }
7533
+
7534
+
7535
+ /* google.protobuf.DescriptorProto.ReservedRange */
7536
+
7537
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) {
7538
+ return (google_protobuf_DescriptorProto_ReservedRange *)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
7539
+ }
7540
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_strview buf, upb_arena *arena) {
7541
+ google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
7542
+ return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit)) ? ret : NULL;
7543
+ }
7544
+ UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) {
7545
+ return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len);
7546
+ }
7547
+
7548
+ UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_has_field(msg, 0); }
7549
+ UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
7550
+ UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_has_field(msg, 1); }
7551
+ UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
7552
+
7553
+ UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
7554
+ _upb_sethas(msg, 0);
7555
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
7556
+ }
7557
+ UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
7558
+ _upb_sethas(msg, 1);
7559
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
7560
+ }
7561
+
7562
+
7563
+ /* google.protobuf.ExtensionRangeOptions */
7564
+
7565
+ UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) {
7566
+ return (google_protobuf_ExtensionRangeOptions *)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
7567
+ }
7568
+ UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_strview buf, upb_arena *arena) {
7569
+ google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena);
7570
+ return (ret && upb_decode(buf, ret, &google_protobuf_ExtensionRangeOptions_msginit)) ? ret : NULL;
7571
+ }
7572
+ UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) {
7573
+ return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len);
7574
+ }
7575
+
7576
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
7577
+
7578
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t *len) {
7579
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
7580
+ }
7581
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t len, upb_arena *arena) {
7582
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7583
+ }
7584
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena) {
7585
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
7586
+ bool ok = _upb_array_append_accessor(
7587
+ msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7588
+ if (!ok) return NULL;
7589
+ return sub;
7590
+ }
7591
+
7592
+
7593
+ /* google.protobuf.FieldDescriptorProto */
7594
+
7595
+ UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) {
7596
+ return (google_protobuf_FieldDescriptorProto *)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
7597
+ }
7598
+ UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
7599
+ google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena);
7600
+ return (ret && upb_decode(buf, ret, &google_protobuf_FieldDescriptorProto_msginit)) ? ret : NULL;
7601
+ }
7602
+ UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) {
7603
+ return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len);
7604
+ }
7605
+
7606
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 4); }
7607
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); }
7608
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 5); }
7609
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)); }
7610
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 2); }
7611
+ UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)); }
7612
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 0); }
7613
+ UPB_INLINE google_protobuf_FieldDescriptorProto_Label google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, google_protobuf_FieldDescriptorProto_Label, UPB_SIZE(8, 8)); }
7614
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 1); }
7615
+ UPB_INLINE google_protobuf_FieldDescriptorProto_Type google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, google_protobuf_FieldDescriptorProto_Type, UPB_SIZE(16, 16)); }
7616
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 6); }
7617
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)); }
7618
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 7); }
7619
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 80)); }
7620
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 9); }
7621
+ UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_FieldOptions*, UPB_SIZE(72, 112)); }
7622
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 3); }
7623
+ UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(28, 28)); }
7624
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 8); }
7625
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)); }
7626
+
7627
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
7628
+ _upb_sethas(msg, 4);
7629
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)) = value;
7630
+ }
7631
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
7632
+ _upb_sethas(msg, 5);
7633
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)) = value;
7634
+ }
7635
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
7636
+ _upb_sethas(msg, 2);
7637
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)) = value;
7638
+ }
7639
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Label value) {
7640
+ _upb_sethas(msg, 0);
7641
+ UPB_FIELD_AT(msg, google_protobuf_FieldDescriptorProto_Label, UPB_SIZE(8, 8)) = value;
7642
+ }
7643
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Type value) {
7644
+ _upb_sethas(msg, 1);
7645
+ UPB_FIELD_AT(msg, google_protobuf_FieldDescriptorProto_Type, UPB_SIZE(16, 16)) = value;
7646
+ }
7647
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
7648
+ _upb_sethas(msg, 6);
7649
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value;
7650
+ }
7651
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
7652
+ _upb_sethas(msg, 7);
7653
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 80)) = value;
7654
+ }
7655
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
7656
+ _upb_sethas(msg, 9);
7657
+ UPB_FIELD_AT(msg, google_protobuf_FieldOptions*, UPB_SIZE(72, 112)) = value;
7658
+ }
7659
+ UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto *msg, upb_arena *arena) {
7660
+ struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
7661
+ if (sub == NULL) {
7662
+ sub = (struct google_protobuf_FieldOptions*)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
7663
+ if (!sub) return NULL;
7664
+ google_protobuf_FieldDescriptorProto_set_options(msg, sub);
7665
+ }
7666
+ return sub;
7667
+ }
7668
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
7669
+ _upb_sethas(msg, 3);
7670
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(28, 28)) = value;
7671
+ }
7672
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
7673
+ _upb_sethas(msg, 8);
7674
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)) = value;
7675
+ }
7676
+
7677
+
7678
+ /* google.protobuf.OneofDescriptorProto */
7679
+
7680
+ UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) {
7681
+ return (google_protobuf_OneofDescriptorProto *)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
7682
+ }
7683
+ UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
7684
+ google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena);
7685
+ return (ret && upb_decode(buf, ret, &google_protobuf_OneofDescriptorProto_msginit)) ? ret : NULL;
7686
+ }
7687
+ UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) {
7688
+ return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len);
7689
+ }
7690
+
7691
+ UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto *msg) { return _upb_has_field(msg, 0); }
7692
+ UPB_INLINE upb_strview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
7693
+ UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto *msg) { return _upb_has_field(msg, 1); }
7694
+ UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_OneofOptions*, UPB_SIZE(12, 24)); }
7695
+
7696
+ UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_strview value) {
7697
+ _upb_sethas(msg, 0);
7698
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
7699
+ }
7700
+ UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
7701
+ _upb_sethas(msg, 1);
7702
+ UPB_FIELD_AT(msg, google_protobuf_OneofOptions*, UPB_SIZE(12, 24)) = value;
7703
+ }
7704
+ UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto *msg, upb_arena *arena) {
7705
+ struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
7706
+ if (sub == NULL) {
7707
+ sub = (struct google_protobuf_OneofOptions*)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
7708
+ if (!sub) return NULL;
7709
+ google_protobuf_OneofDescriptorProto_set_options(msg, sub);
7710
+ }
7711
+ return sub;
7712
+ }
7713
+
7714
+
7715
+ /* google.protobuf.EnumDescriptorProto */
7716
+
7717
+ UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) {
7718
+ return (google_protobuf_EnumDescriptorProto *)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
7719
+ }
7720
+ UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
7721
+ google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena);
7722
+ return (ret && upb_decode(buf, ret, &google_protobuf_EnumDescriptorProto_msginit)) ? ret : NULL;
7723
+ }
7724
+ UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) {
7725
+ return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len);
7726
+ }
7727
+
7728
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_field(msg, 0); }
7729
+ UPB_INLINE upb_strview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
7730
+ UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
7731
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_field(msg, 1); }
7732
+ UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_EnumOptions*, UPB_SIZE(12, 24)); }
7733
+ UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
7734
+ UPB_INLINE upb_strview const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
7735
+
7736
+ UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_strview value) {
7737
+ _upb_sethas(msg, 0);
7738
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
7739
+ }
7740
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
7741
+ return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
7742
+ }
7743
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
7744
+ return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7745
+ }
7746
+ UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
7747
+ struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
7748
+ bool ok = _upb_array_append_accessor(
7749
+ msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7750
+ if (!ok) return NULL;
7751
+ return sub;
7752
+ }
7753
+ UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
7754
+ _upb_sethas(msg, 1);
7755
+ UPB_FIELD_AT(msg, google_protobuf_EnumOptions*, UPB_SIZE(12, 24)) = value;
7756
+ }
7757
+ UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
7758
+ struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
7759
+ if (sub == NULL) {
7760
+ sub = (struct google_protobuf_EnumOptions*)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
7761
+ if (!sub) return NULL;
7762
+ google_protobuf_EnumDescriptorProto_set_options(msg, sub);
7763
+ }
7764
+ return sub;
7765
+ }
7766
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
7767
+ return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
7768
+ }
7769
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
7770
+ return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7771
+ }
7772
+ UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
7773
+ struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
7774
+ bool ok = _upb_array_append_accessor(
7775
+ msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7776
+ if (!ok) return NULL;
7777
+ return sub;
7778
+ }
7779
+ UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
7780
+ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
7781
+ }
7782
+ UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
7783
+ return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
7784
+ }
7785
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_strview val, upb_arena *arena) {
7786
+ return _upb_array_append_accessor(
7787
+ msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
7788
+ }
7789
+
7790
+
7791
+ /* google.protobuf.EnumDescriptorProto.EnumReservedRange */
7792
+
7793
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) {
7794
+ return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
7795
+ }
7796
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_strview buf, upb_arena *arena) {
7797
+ google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
7798
+ return (ret && upb_decode(buf, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit)) ? ret : NULL;
7799
+ }
7800
+ UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) {
7801
+ return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len);
7802
+ }
7803
+
7804
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_has_field(msg, 0); }
7805
+ UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
7806
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_has_field(msg, 1); }
7807
+ UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
7808
+
7809
+ UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
7810
+ _upb_sethas(msg, 0);
7811
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
7812
+ }
7813
+ UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
7814
+ _upb_sethas(msg, 1);
7815
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
7816
+ }
7817
+
7818
+
7819
+ /* google.protobuf.EnumValueDescriptorProto */
7820
+
7821
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) {
7822
+ return (google_protobuf_EnumValueDescriptorProto *)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
7823
+ }
7824
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
7825
+ google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena);
7826
+ return (ret && upb_decode(buf, ret, &google_protobuf_EnumValueDescriptorProto_msginit)) ? ret : NULL;
7827
+ }
7828
+ UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) {
7829
+ return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len);
7830
+ }
7831
+
7832
+ UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 1); }
7833
+ UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
7834
+ UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 0); }
7835
+ UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
7836
+ UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 2); }
7837
+ UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_EnumValueOptions*, UPB_SIZE(16, 24)); }
7838
+
7839
+ UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_strview value) {
7840
+ _upb_sethas(msg, 1);
7841
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
7842
+ }
7843
+ UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
7844
+ _upb_sethas(msg, 0);
7845
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
7846
+ }
7847
+ UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
7848
+ _upb_sethas(msg, 2);
7849
+ UPB_FIELD_AT(msg, google_protobuf_EnumValueOptions*, UPB_SIZE(16, 24)) = value;
7850
+ }
7851
+ UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena) {
7852
+ struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
7853
+ if (sub == NULL) {
7854
+ sub = (struct google_protobuf_EnumValueOptions*)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
7855
+ if (!sub) return NULL;
7856
+ google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
7857
+ }
7858
+ return sub;
7859
+ }
7860
+
7861
+
7862
+ /* google.protobuf.ServiceDescriptorProto */
7863
+
7864
+ UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) {
7865
+ return (google_protobuf_ServiceDescriptorProto *)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
7866
+ }
7867
+ UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
7868
+ google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena);
7869
+ return (ret && upb_decode(buf, ret, &google_protobuf_ServiceDescriptorProto_msginit)) ? ret : NULL;
7870
+ }
7871
+ UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) {
7872
+ return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len);
7873
+ }
7874
+
7875
+ UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_field(msg, 0); }
7876
+ UPB_INLINE upb_strview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
7877
+ UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg, size_t *len) { return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
7878
+ UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_field(msg, 1); }
7879
+ UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_ServiceOptions*, UPB_SIZE(12, 24)); }
7880
+
7881
+ UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_strview value) {
7882
+ _upb_sethas(msg, 0);
7883
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
7884
+ }
7885
+ UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto *msg, size_t *len) {
7886
+ return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
7887
+ }
7888
+ UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto *msg, size_t len, upb_arena *arena) {
7889
+ return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
7890
+ }
7891
+ UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
7892
+ struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
7893
+ bool ok = _upb_array_append_accessor(
7894
+ msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
7895
+ if (!ok) return NULL;
7896
+ return sub;
7897
+ }
7898
+ UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
7899
+ _upb_sethas(msg, 1);
7900
+ UPB_FIELD_AT(msg, google_protobuf_ServiceOptions*, UPB_SIZE(12, 24)) = value;
7901
+ }
7902
+ UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
7903
+ struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
7904
+ if (sub == NULL) {
7905
+ sub = (struct google_protobuf_ServiceOptions*)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
7906
+ if (!sub) return NULL;
7907
+ google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
7908
+ }
7909
+ return sub;
7910
+ }
7911
+
7912
+
7913
+ /* google.protobuf.MethodDescriptorProto */
7914
+
7915
+ UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) {
7916
+ return (google_protobuf_MethodDescriptorProto *)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
7917
+ }
7918
+ UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
7919
+ google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena);
7920
+ return (ret && upb_decode(buf, ret, &google_protobuf_MethodDescriptorProto_msginit)) ? ret : NULL;
7921
+ }
7922
+ UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) {
7923
+ return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len);
7924
+ }
7925
+
7926
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 2); }
7927
+ UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
7928
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 3); }
7929
+ UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
7930
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 4); }
7931
+ UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); }
7932
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 5); }
7933
+ UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_MethodOptions*, UPB_SIZE(28, 56)); }
7934
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 0); }
7935
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
7936
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 1); }
7937
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); }
7938
+
7939
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
7940
+ _upb_sethas(msg, 2);
7941
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
7942
+ }
7943
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
7944
+ _upb_sethas(msg, 3);
7945
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
7946
+ }
7947
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
7948
+ _upb_sethas(msg, 4);
7949
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
7950
+ }
7951
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
7952
+ _upb_sethas(msg, 5);
7953
+ UPB_FIELD_AT(msg, google_protobuf_MethodOptions*, UPB_SIZE(28, 56)) = value;
7954
+ }
7955
+ UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto *msg, upb_arena *arena) {
7956
+ struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
7957
+ if (sub == NULL) {
7958
+ sub = (struct google_protobuf_MethodOptions*)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
7959
+ if (!sub) return NULL;
7960
+ google_protobuf_MethodDescriptorProto_set_options(msg, sub);
7961
+ }
7962
+ return sub;
7963
+ }
7964
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
7965
+ _upb_sethas(msg, 0);
7966
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
7967
+ }
7968
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
7969
+ _upb_sethas(msg, 1);
7970
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
7971
+ }
7972
+
7973
+
7974
+ /* google.protobuf.FileOptions */
7975
+
7976
+ UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) {
7977
+ return (google_protobuf_FileOptions *)upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
7978
+ }
7979
+ UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_strview buf, upb_arena *arena) {
7980
+ google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena);
7981
+ return (ret && upb_decode(buf, ret, &google_protobuf_FileOptions_msginit)) ? ret : NULL;
7982
+ }
7983
+ UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) {
7984
+ return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len);
7985
+ }
7986
+
7987
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 10); }
7988
+ UPB_INLINE upb_strview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)); }
7989
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 11); }
7990
+ UPB_INLINE upb_strview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)); }
7991
+ UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 0); }
7992
+ UPB_INLINE google_protobuf_FileOptions_OptimizeMode google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, google_protobuf_FileOptions_OptimizeMode, UPB_SIZE(8, 8)); }
7993
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 1); }
7994
+ UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)); }
7995
+ UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 12); }
7996
+ UPB_INLINE upb_strview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 64)); }
7997
+ UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 2); }
7998
+ UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(17, 17)); }
7999
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 3); }
8000
+ UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(18, 18)); }
8001
+ UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 4); }
8002
+ UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(19, 19)); }
8003
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 5); }
8004
+ UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(20, 20)); }
8005
+ UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 6); }
8006
+ UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(21, 21)); }
8007
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 7); }
8008
+ UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(22, 22)); }
8009
+ UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 8); }
8010
+ UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(23, 23)); }
8011
+ UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 13); }
8012
+ UPB_INLINE upb_strview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(52, 80)); }
8013
+ UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 14); }
8014
+ UPB_INLINE upb_strview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(60, 96)); }
8015
+ UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 15); }
8016
+ UPB_INLINE upb_strview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(68, 112)); }
8017
+ UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 16); }
8018
+ UPB_INLINE upb_strview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(76, 128)); }
8019
+ UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 17); }
8020
+ UPB_INLINE upb_strview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(84, 144)); }
8021
+ UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 9); }
8022
+ UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); }
8023
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(92, 160), len); }
8024
+
8025
+ UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_strview value) {
8026
+ _upb_sethas(msg, 10);
8027
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)) = value;
8028
+ }
8029
+ UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_strview value) {
8030
+ _upb_sethas(msg, 11);
8031
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)) = value;
8032
+ }
8033
+ UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, google_protobuf_FileOptions_OptimizeMode value) {
8034
+ _upb_sethas(msg, 0);
8035
+ UPB_FIELD_AT(msg, google_protobuf_FileOptions_OptimizeMode, UPB_SIZE(8, 8)) = value;
8036
+ }
8037
+ UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
8038
+ _upb_sethas(msg, 1);
8039
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)) = value;
8040
+ }
8041
+ UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_strview value) {
8042
+ _upb_sethas(msg, 12);
8043
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 64)) = value;
8044
+ }
8045
+ UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
8046
+ _upb_sethas(msg, 2);
8047
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(17, 17)) = value;
8048
+ }
8049
+ UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
8050
+ _upb_sethas(msg, 3);
8051
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(18, 18)) = value;
8052
+ }
8053
+ UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
8054
+ _upb_sethas(msg, 4);
8055
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(19, 19)) = value;
8056
+ }
8057
+ UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
8058
+ _upb_sethas(msg, 5);
8059
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(20, 20)) = value;
8060
+ }
8061
+ UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
8062
+ _upb_sethas(msg, 6);
8063
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(21, 21)) = value;
8064
+ }
8065
+ UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
8066
+ _upb_sethas(msg, 7);
8067
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(22, 22)) = value;
8068
+ }
8069
+ UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
8070
+ _upb_sethas(msg, 8);
8071
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(23, 23)) = value;
8072
+ }
8073
+ UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
8074
+ _upb_sethas(msg, 13);
8075
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(52, 80)) = value;
8076
+ }
8077
+ UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
8078
+ _upb_sethas(msg, 14);
8079
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(60, 96)) = value;
8080
+ }
8081
+ UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
8082
+ _upb_sethas(msg, 15);
8083
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(68, 112)) = value;
8084
+ }
8085
+ UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
8086
+ _upb_sethas(msg, 16);
8087
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(76, 128)) = value;
8088
+ }
8089
+ UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
8090
+ _upb_sethas(msg, 17);
8091
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(84, 144)) = value;
8092
+ }
8093
+ UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
8094
+ _upb_sethas(msg, 9);
8095
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value;
8096
+ }
8097
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions *msg, size_t *len) {
8098
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(92, 160), len);
8099
+ }
8100
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions *msg, size_t len, upb_arena *arena) {
8101
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(92, 160), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8102
+ }
8103
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions *msg, upb_arena *arena) {
8104
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8105
+ bool ok = _upb_array_append_accessor(
8106
+ msg, UPB_SIZE(92, 160), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8107
+ if (!ok) return NULL;
8108
+ return sub;
8109
+ }
8110
+
8111
+
8112
+ /* google.protobuf.MessageOptions */
8113
+
8114
+ UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_arena *arena) {
8115
+ return (google_protobuf_MessageOptions *)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
8116
+ }
8117
+ UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_strview buf, upb_arena *arena) {
8118
+ google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena);
8119
+ return (ret && upb_decode(buf, ret, &google_protobuf_MessageOptions_msginit)) ? ret : NULL;
8120
+ }
8121
+ UPB_INLINE char *google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions *msg, upb_arena *arena, size_t *len) {
8122
+ return upb_encode(msg, &google_protobuf_MessageOptions_msginit, arena, len);
8123
+ }
8124
+
8125
+ UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 0); }
8126
+ UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
8127
+ UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 1); }
8128
+ UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); }
8129
+ UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 2); }
8130
+ UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(3, 3)); }
8131
+ UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 3); }
8132
+ UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)); }
8133
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(8, 8), len); }
8134
+
8135
+ UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
8136
+ _upb_sethas(msg, 0);
8137
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
8138
+ }
8139
+ UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
8140
+ _upb_sethas(msg, 1);
8141
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
8142
+ }
8143
+ UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
8144
+ _upb_sethas(msg, 2);
8145
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(3, 3)) = value;
8146
+ }
8147
+ UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
8148
+ _upb_sethas(msg, 3);
8149
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)) = value;
8150
+ }
8151
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t *len) {
8152
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len);
8153
+ }
8154
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t len, upb_arena *arena) {
8155
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8156
+ }
8157
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_arena *arena) {
8158
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8159
+ bool ok = _upb_array_append_accessor(
8160
+ msg, UPB_SIZE(8, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8161
+ if (!ok) return NULL;
8162
+ return sub;
8163
+ }
8164
+
8165
+
8166
+ /* google.protobuf.FieldOptions */
8167
+
8168
+ UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_arena *arena) {
8169
+ return (google_protobuf_FieldOptions *)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
8170
+ }
8171
+ UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_strview buf, upb_arena *arena) {
8172
+ google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena);
8173
+ return (ret && upb_decode(buf, ret, &google_protobuf_FieldOptions_msginit)) ? ret : NULL;
8174
+ }
8175
+ UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions *msg, upb_arena *arena, size_t *len) {
8176
+ return upb_encode(msg, &google_protobuf_FieldOptions_msginit, arena, len);
8177
+ }
8178
+
8179
+ UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 0); }
8180
+ UPB_INLINE google_protobuf_FieldOptions_CType google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, google_protobuf_FieldOptions_CType, UPB_SIZE(8, 8)); }
8181
+ UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 2); }
8182
+ UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); }
8183
+ UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 3); }
8184
+ UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)); }
8185
+ UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 4); }
8186
+ UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)); }
8187
+ UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 1); }
8188
+ UPB_INLINE google_protobuf_FieldOptions_JSType google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, google_protobuf_FieldOptions_JSType, UPB_SIZE(16, 16)); }
8189
+ UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 5); }
8190
+ UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(27, 27)); }
8191
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(28, 32), len); }
8192
+
8193
+ UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_CType value) {
8194
+ _upb_sethas(msg, 0);
8195
+ UPB_FIELD_AT(msg, google_protobuf_FieldOptions_CType, UPB_SIZE(8, 8)) = value;
8196
+ }
8197
+ UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
8198
+ _upb_sethas(msg, 2);
8199
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value;
8200
+ }
8201
+ UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
8202
+ _upb_sethas(msg, 3);
8203
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)) = value;
8204
+ }
8205
+ UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
8206
+ _upb_sethas(msg, 4);
8207
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)) = value;
8208
+ }
8209
+ UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_JSType value) {
8210
+ _upb_sethas(msg, 1);
8211
+ UPB_FIELD_AT(msg, google_protobuf_FieldOptions_JSType, UPB_SIZE(16, 16)) = value;
8212
+ }
8213
+ UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
8214
+ _upb_sethas(msg, 5);
8215
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(27, 27)) = value;
8216
+ }
8217
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t *len) {
8218
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len);
8219
+ }
8220
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t len, upb_arena *arena) {
8221
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8222
+ }
8223
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_arena *arena) {
8224
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8225
+ bool ok = _upb_array_append_accessor(
8226
+ msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8227
+ if (!ok) return NULL;
8228
+ return sub;
8229
+ }
8230
+
8231
+
8232
+ /* google.protobuf.OneofOptions */
8233
+
8234
+ UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_arena *arena) {
8235
+ return (google_protobuf_OneofOptions *)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
8236
+ }
8237
+ UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_strview buf, upb_arena *arena) {
8238
+ google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena);
8239
+ return (ret && upb_decode(buf, ret, &google_protobuf_OneofOptions_msginit)) ? ret : NULL;
8240
+ }
8241
+ UPB_INLINE char *google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions *msg, upb_arena *arena, size_t *len) {
8242
+ return upb_encode(msg, &google_protobuf_OneofOptions_msginit, arena, len);
8243
+ }
8244
+
8245
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
8246
+
8247
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t *len) {
8248
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
8249
+ }
8250
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t len, upb_arena *arena) {
8251
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8252
+ }
8253
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_arena *arena) {
8254
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8255
+ bool ok = _upb_array_append_accessor(
8256
+ msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8257
+ if (!ok) return NULL;
8258
+ return sub;
8259
+ }
8260
+
8261
+
8262
+ /* google.protobuf.EnumOptions */
8263
+
8264
+ UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_arena *arena) {
8265
+ return (google_protobuf_EnumOptions *)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
8266
+ }
8267
+ UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_strview buf, upb_arena *arena) {
8268
+ google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena);
8269
+ return (ret && upb_decode(buf, ret, &google_protobuf_EnumOptions_msginit)) ? ret : NULL;
8270
+ }
8271
+ UPB_INLINE char *google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions *msg, upb_arena *arena, size_t *len) {
8272
+ return upb_encode(msg, &google_protobuf_EnumOptions_msginit, arena, len);
8273
+ }
8274
+
8275
+ UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions *msg) { return _upb_has_field(msg, 0); }
8276
+ UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
8277
+ UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions *msg) { return _upb_has_field(msg, 1); }
8278
+ UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); }
8279
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
8280
+
8281
+ UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
8282
+ _upb_sethas(msg, 0);
8283
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
8284
+ }
8285
+ UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
8286
+ _upb_sethas(msg, 1);
8287
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
8288
+ }
8289
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t *len) {
8290
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
8291
+ }
8292
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t len, upb_arena *arena) {
8293
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8294
+ }
8295
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_arena *arena) {
8296
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8297
+ bool ok = _upb_array_append_accessor(
8298
+ msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8299
+ if (!ok) return NULL;
8300
+ return sub;
8301
+ }
8302
+
8303
+
8304
+ /* google.protobuf.EnumValueOptions */
8305
+
8306
+ UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_arena *arena) {
8307
+ return (google_protobuf_EnumValueOptions *)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
8308
+ }
8309
+ UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_strview buf, upb_arena *arena) {
8310
+ google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena);
8311
+ return (ret && upb_decode(buf, ret, &google_protobuf_EnumValueOptions_msginit)) ? ret : NULL;
8312
+ }
8313
+ UPB_INLINE char *google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions *msg, upb_arena *arena, size_t *len) {
8314
+ return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, arena, len);
8315
+ }
8316
+
8317
+ UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions *msg) { return _upb_has_field(msg, 0); }
8318
+ UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
8319
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
8320
+
8321
+ UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
8322
+ _upb_sethas(msg, 0);
8323
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
8324
+ }
8325
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t *len) {
8326
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
8327
+ }
8328
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t len, upb_arena *arena) {
8329
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8330
+ }
8331
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_arena *arena) {
8332
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8333
+ bool ok = _upb_array_append_accessor(
8334
+ msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8335
+ if (!ok) return NULL;
8336
+ return sub;
8337
+ }
8338
+
8339
+
8340
+ /* google.protobuf.ServiceOptions */
8341
+
8342
+ UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_arena *arena) {
8343
+ return (google_protobuf_ServiceOptions *)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
8344
+ }
8345
+ UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_strview buf, upb_arena *arena) {
8346
+ google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena);
8347
+ return (ret && upb_decode(buf, ret, &google_protobuf_ServiceOptions_msginit)) ? ret : NULL;
8348
+ }
8349
+ UPB_INLINE char *google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions *msg, upb_arena *arena, size_t *len) {
8350
+ return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, arena, len);
8351
+ }
8352
+
8353
+ UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions *msg) { return _upb_has_field(msg, 0); }
8354
+ UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
8355
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
8356
+
8357
+ UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
8358
+ _upb_sethas(msg, 0);
8359
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
8360
+ }
8361
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t *len) {
8362
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
8363
+ }
8364
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t len, upb_arena *arena) {
8365
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8366
+ }
8367
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_arena *arena) {
8368
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8369
+ bool ok = _upb_array_append_accessor(
8370
+ msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8371
+ if (!ok) return NULL;
8372
+ return sub;
8373
+ }
8374
+
8375
+
8376
+ /* google.protobuf.MethodOptions */
8377
+
8378
+ UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_arena *arena) {
8379
+ return (google_protobuf_MethodOptions *)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
8380
+ }
8381
+ UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_strview buf, upb_arena *arena) {
8382
+ google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena);
8383
+ return (ret && upb_decode(buf, ret, &google_protobuf_MethodOptions_msginit)) ? ret : NULL;
8384
+ }
8385
+ UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions *msg, upb_arena *arena, size_t *len) {
8386
+ return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len);
8387
+ }
8388
+
8389
+ UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions *msg) { return _upb_has_field(msg, 1); }
8390
+ UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)); }
8391
+ UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions *msg) { return _upb_has_field(msg, 0); }
8392
+ UPB_INLINE google_protobuf_MethodOptions_IdempotencyLevel google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { return UPB_FIELD_AT(msg, google_protobuf_MethodOptions_IdempotencyLevel, UPB_SIZE(8, 8)); }
8393
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(20, 24), len); }
8394
+
8395
+ UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
8396
+ _upb_sethas(msg, 1);
8397
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)) = value;
8398
+ }
8399
+ UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, google_protobuf_MethodOptions_IdempotencyLevel value) {
8400
+ _upb_sethas(msg, 0);
8401
+ UPB_FIELD_AT(msg, google_protobuf_MethodOptions_IdempotencyLevel, UPB_SIZE(8, 8)) = value;
8402
+ }
8403
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t *len) {
8404
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 24), len);
8405
+ }
8406
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t len, upb_arena *arena) {
8407
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8408
+ }
8409
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_arena *arena) {
8410
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8411
+ bool ok = _upb_array_append_accessor(
8412
+ msg, UPB_SIZE(20, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8413
+ if (!ok) return NULL;
8414
+ return sub;
8415
+ }
6687
8416
 
6688
- /* Like upb_msg_init() / upb_msg_uninit(), except the message's memory is
6689
- * allocated / freed from the given upb_alloc. */
6690
- upb_msg *upb_msg_new(const upb_msglayout *l, upb_alloc *a);
6691
- void upb_msg_free(upb_msg *msg, const upb_msglayout *l);
6692
8417
 
6693
- /* Returns the upb_alloc for the given message. */
6694
- upb_alloc *upb_msg_alloc(const upb_msg *msg, const upb_msglayout *l);
8418
+ /* google.protobuf.UninterpretedOption */
6695
8419
 
6696
- /* Packs the tree of messages rooted at "msg" into a single hunk of memory,
6697
- * allocated from the given allocator. */
6698
- void *upb_msg_pack(const upb_msg *msg, const upb_msglayout *l,
6699
- void *p, size_t *ofs, size_t size);
8420
+ UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_arena *arena) {
8421
+ return (google_protobuf_UninterpretedOption *)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
8422
+ }
8423
+ UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_strview buf, upb_arena *arena) {
8424
+ google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena);
8425
+ return (ret && upb_decode(buf, ret, &google_protobuf_UninterpretedOption_msginit)) ? ret : NULL;
8426
+ }
8427
+ UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption *msg, upb_arena *arena, size_t *len) {
8428
+ return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, arena, len);
8429
+ }
6700
8430
 
6701
- /* Read-only message API. Can be safely called by anyone. */
8431
+ UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg, size_t *len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(56, 80), len); }
8432
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 3); }
8433
+ UPB_INLINE upb_strview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); }
8434
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 0); }
8435
+ UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)); }
8436
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 1); }
8437
+ UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)); }
8438
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 2); }
8439
+ UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(24, 24)); }
8440
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 4); }
8441
+ UPB_INLINE upb_strview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)); }
8442
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 5); }
8443
+ UPB_INLINE upb_strview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)); }
6702
8444
 
6703
- /* Returns the value associated with this field:
6704
- * - for scalar fields (including strings), the value directly.
6705
- * - return upb_msg*, or upb_map* for msg/map.
6706
- * If the field is unset for these field types, returns NULL.
6707
- *
6708
- * TODO(haberman): should we let users store cached array/map/msg
6709
- * pointers here for fields that are unset? Could be useful for the
6710
- * strongly-owned submessage model (ie. generated C API that doesn't use
6711
- * arenas).
6712
- */
6713
- upb_msgval upb_msg_get(const upb_msg *msg,
6714
- const upb_fielddef *f,
6715
- const upb_msglayout *l);
8445
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption *msg, size_t *len) {
8446
+ return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 80), len);
8447
+ }
8448
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption *msg, size_t len, upb_arena *arena) {
8449
+ return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_resize_accessor(msg, UPB_SIZE(56, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8450
+ }
8451
+ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption *msg, upb_arena *arena) {
8452
+ struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
8453
+ bool ok = _upb_array_append_accessor(
8454
+ msg, UPB_SIZE(56, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8455
+ if (!ok) return NULL;
8456
+ return sub;
8457
+ }
8458
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
8459
+ _upb_sethas(msg, 3);
8460
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)) = value;
8461
+ }
8462
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
8463
+ _upb_sethas(msg, 0);
8464
+ UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)) = value;
8465
+ }
8466
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
8467
+ _upb_sethas(msg, 1);
8468
+ UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)) = value;
8469
+ }
8470
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
8471
+ _upb_sethas(msg, 2);
8472
+ UPB_FIELD_AT(msg, double, UPB_SIZE(24, 24)) = value;
8473
+ }
8474
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
8475
+ _upb_sethas(msg, 4);
8476
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)) = value;
8477
+ }
8478
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
8479
+ _upb_sethas(msg, 5);
8480
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value;
8481
+ }
6716
8482
 
6717
- /* May only be called for fields where upb_fielddef_haspresence(f) == true. */
6718
- bool upb_msg_has(const upb_msg *msg,
6719
- const upb_fielddef *f,
6720
- const upb_msglayout *l);
6721
8483
 
6722
- /* Returns NULL if no field in the oneof is set. */
6723
- const upb_fielddef *upb_msg_getoneofcase(const upb_msg *msg,
6724
- const upb_oneofdef *o,
6725
- const upb_msglayout *l);
8484
+ /* google.protobuf.UninterpretedOption.NamePart */
6726
8485
 
6727
- /* Returns true if any field in the oneof is set. */
6728
- bool upb_msg_hasoneof(const upb_msg *msg,
6729
- const upb_oneofdef *o,
6730
- const upb_msglayout *l);
8486
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_arena *arena) {
8487
+ return (google_protobuf_UninterpretedOption_NamePart *)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
8488
+ }
8489
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_strview buf, upb_arena *arena) {
8490
+ google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
8491
+ return (ret && upb_decode(buf, ret, &google_protobuf_UninterpretedOption_NamePart_msginit)) ? ret : NULL;
8492
+ }
8493
+ UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart *msg, upb_arena *arena, size_t *len) {
8494
+ return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len);
8495
+ }
6731
8496
 
8497
+ UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_has_field(msg, 1); }
8498
+ UPB_INLINE upb_strview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
8499
+ UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_has_field(msg, 0); }
8500
+ UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
6732
8501
 
6733
- /* Mutable message API. May only be called by the owner of the message who
6734
- * knows its ownership scheme and how to keep it consistent. */
8502
+ UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_strview value) {
8503
+ _upb_sethas(msg, 1);
8504
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
8505
+ }
8506
+ UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
8507
+ _upb_sethas(msg, 0);
8508
+ UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
8509
+ }
6735
8510
 
6736
- /* Sets the given field to the given value. Does not perform any memory
6737
- * management: if you overwrite a pointer to a msg/array/map/string without
6738
- * cleaning it up (or using an arena) it will leak.
6739
- */
6740
- bool upb_msg_set(upb_msg *msg,
6741
- const upb_fielddef *f,
6742
- upb_msgval val,
6743
- const upb_msglayout *l);
6744
8511
 
6745
- /* For a primitive field, set it back to its default. For repeated, string, and
6746
- * submessage fields set it back to NULL. This could involve releasing some
6747
- * internal memory (for example, from an extension dictionary), but it is not
6748
- * recursive in any way and will not recover any memory that may be used by
6749
- * arrays/maps/strings/msgs that this field may have pointed to.
6750
- */
6751
- bool upb_msg_clearfield(upb_msg *msg,
6752
- const upb_fielddef *f,
6753
- const upb_msglayout *l);
8512
+ /* google.protobuf.SourceCodeInfo */
6754
8513
 
6755
- /* Clears all fields in the oneof such that none of them are set. */
6756
- bool upb_msg_clearoneof(upb_msg *msg,
6757
- const upb_oneofdef *o,
6758
- const upb_msglayout *l);
8514
+ UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_arena *arena) {
8515
+ return (google_protobuf_SourceCodeInfo *)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
8516
+ }
8517
+ UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_strview buf, upb_arena *arena) {
8518
+ google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena);
8519
+ return (ret && upb_decode(buf, ret, &google_protobuf_SourceCodeInfo_msginit)) ? ret : NULL;
8520
+ }
8521
+ UPB_INLINE char *google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo *msg, upb_arena *arena, size_t *len) {
8522
+ return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, arena, len);
8523
+ }
6759
8524
 
6760
- /* TODO(haberman): copyfrom()/mergefrom()? */
8525
+ UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg, size_t *len) { return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
6761
8526
 
8527
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo *msg, size_t *len) {
8528
+ return (google_protobuf_SourceCodeInfo_Location**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
8529
+ }
8530
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo *msg, size_t len, upb_arena *arena) {
8531
+ return (google_protobuf_SourceCodeInfo_Location**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8532
+ }
8533
+ UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo *msg, upb_arena *arena) {
8534
+ struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
8535
+ bool ok = _upb_array_append_accessor(
8536
+ msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8537
+ if (!ok) return NULL;
8538
+ return sub;
8539
+ }
6762
8540
 
6763
- /** upb_array *****************************************************************/
6764
8541
 
6765
- /* A upb_array stores data for a repeated field. The memory management
6766
- * semantics are the same as upb_msg. A upb_array allocates dynamic
6767
- * memory internally for the array elements. */
8542
+ /* google.protobuf.SourceCodeInfo.Location */
6768
8543
 
6769
- size_t upb_array_sizeof(upb_fieldtype_t type);
6770
- void upb_array_init(upb_array *arr, upb_fieldtype_t type, upb_alloc *a);
6771
- void upb_array_uninit(upb_array *arr);
6772
- upb_array *upb_array_new(upb_fieldtype_t type, upb_alloc *a);
6773
- void upb_array_free(upb_array *arr);
8544
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_arena *arena) {
8545
+ return (google_protobuf_SourceCodeInfo_Location *)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
8546
+ }
8547
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_strview buf, upb_arena *arena) {
8548
+ google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena);
8549
+ return (ret && upb_decode(buf, ret, &google_protobuf_SourceCodeInfo_Location_msginit)) ? ret : NULL;
8550
+ }
8551
+ UPB_INLINE char *google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location *msg, upb_arena *arena, size_t *len) {
8552
+ return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, arena, len);
8553
+ }
6774
8554
 
6775
- /* Read-only interface. Safe for anyone to call. */
8555
+ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
8556
+ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
8557
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_has_field(msg, 0); }
8558
+ UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
8559
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_has_field(msg, 1); }
8560
+ UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
8561
+ UPB_INLINE upb_strview const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
6776
8562
 
6777
- size_t upb_array_size(const upb_array *arr);
6778
- upb_fieldtype_t upb_array_type(const upb_array *arr);
6779
- upb_msgval upb_array_get(const upb_array *arr, size_t i);
8563
+ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
8564
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
8565
+ }
8566
+ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
8567
+ return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
8568
+ }
8569
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) {
8570
+ return _upb_array_append_accessor(
8571
+ msg, UPB_SIZE(20, 40), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
8572
+ }
8573
+ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
8574
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
8575
+ }
8576
+ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
8577
+ return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
8578
+ }
8579
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) {
8580
+ return _upb_array_append_accessor(
8581
+ msg, UPB_SIZE(24, 48), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
8582
+ }
8583
+ UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) {
8584
+ _upb_sethas(msg, 0);
8585
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
8586
+ }
8587
+ UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) {
8588
+ _upb_sethas(msg, 1);
8589
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
8590
+ }
8591
+ UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
8592
+ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
8593
+ }
8594
+ UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
8595
+ return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
8596
+ }
8597
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview val, upb_arena *arena) {
8598
+ return _upb_array_append_accessor(
8599
+ msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
8600
+ }
6780
8601
 
6781
- /* Write interface. May only be called by the message's owner who can enforce
6782
- * its memory management invariants. */
6783
8602
 
6784
- bool upb_array_set(upb_array *arr, size_t i, upb_msgval val);
8603
+ /* google.protobuf.GeneratedCodeInfo */
6785
8604
 
8605
+ UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_arena *arena) {
8606
+ return (google_protobuf_GeneratedCodeInfo *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_msginit, arena);
8607
+ }
8608
+ UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_strview buf, upb_arena *arena) {
8609
+ google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena);
8610
+ return (ret && upb_decode(buf, ret, &google_protobuf_GeneratedCodeInfo_msginit)) ? ret : NULL;
8611
+ }
8612
+ UPB_INLINE char *google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena, size_t *len) {
8613
+ return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, arena, len);
8614
+ }
6786
8615
 
6787
- /** upb_map *******************************************************************/
8616
+ UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg, size_t *len) { return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
6788
8617
 
6789
- /* A upb_map stores data for a map field. The memory management semantics are
6790
- * the same as upb_msg, with one notable exception. upb_map will internally
6791
- * store a copy of all string keys, but *not* any string values or submessages.
6792
- * So you must ensure that any string or message values outlive the map, and you
6793
- * must delete them manually when they are no longer required. */
8618
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t *len) {
8619
+ return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
8620
+ }
8621
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t len, upb_arena *arena) {
8622
+ return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
8623
+ }
8624
+ UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena) {
8625
+ struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
8626
+ bool ok = _upb_array_append_accessor(
8627
+ msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
8628
+ if (!ok) return NULL;
8629
+ return sub;
8630
+ }
6794
8631
 
6795
- size_t upb_map_sizeof(upb_fieldtype_t ktype, upb_fieldtype_t vtype);
6796
- bool upb_map_init(upb_map *map, upb_fieldtype_t ktype, upb_fieldtype_t vtype,
6797
- upb_alloc *a);
6798
- void upb_map_uninit(upb_map *map);
6799
- upb_map *upb_map_new(upb_fieldtype_t ktype, upb_fieldtype_t vtype, upb_alloc *a);
6800
- void upb_map_free(upb_map *map);
6801
8632
 
6802
- /* Read-only interface. Safe for anyone to call. */
8633
+ /* google.protobuf.GeneratedCodeInfo.Annotation */
6803
8634
 
6804
- size_t upb_map_size(const upb_map *map);
6805
- upb_fieldtype_t upb_map_keytype(const upb_map *map);
6806
- upb_fieldtype_t upb_map_valuetype(const upb_map *map);
6807
- bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val);
8635
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_arena *arena) {
8636
+ return (google_protobuf_GeneratedCodeInfo_Annotation *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
8637
+ }
8638
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_strview buf, upb_arena *arena) {
8639
+ google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
8640
+ return (ret && upb_decode(buf, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit)) ? ret : NULL;
8641
+ }
8642
+ UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_arena *arena, size_t *len) {
8643
+ return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, len);
8644
+ }
6808
8645
 
6809
- /* Write interface. May only be called by the message's owner who can enforce
6810
- * its memory management invariants. */
8646
+ UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); }
8647
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 2); }
8648
+ UPB_INLINE upb_strview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); }
8649
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 0); }
8650
+ UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
8651
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 1); }
8652
+ UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
6811
8653
 
6812
- /* Sets or overwrites an entry in the map. Return value indicates whether
6813
- * the operation succeeded or failed with OOM, and also whether an existing
6814
- * key was replaced or not. */
6815
- bool upb_map_set(upb_map *map,
6816
- upb_msgval key, upb_msgval val,
6817
- upb_msgval *valremoved);
8654
+ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) {
8655
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len);
8656
+ }
8657
+ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t len, upb_arena *arena) {
8658
+ return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
8659
+ }
8660
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t val, upb_arena *arena) {
8661
+ return _upb_array_append_accessor(
8662
+ msg, UPB_SIZE(20, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
8663
+ }
8664
+ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_strview value) {
8665
+ _upb_sethas(msg, 2);
8666
+ UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)) = value;
8667
+ }
8668
+ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
8669
+ _upb_sethas(msg, 0);
8670
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
8671
+ }
8672
+ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
8673
+ _upb_sethas(msg, 1);
8674
+ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
8675
+ }
6818
8676
 
6819
- /* Deletes an entry in the map. Returns true if the key was present. */
6820
- bool upb_map_del(upb_map *map, upb_msgval key);
6821
8677
 
8678
+ UPB_END_EXTERN_C
6822
8679
 
6823
- /** upb_mapiter ***************************************************************/
6824
8680
 
6825
- /* For iterating over a map. Map iterators are invalidated by mutations to the
6826
- * map, but an invalidated iterator will never return junk or crash the process.
6827
- * An invalidated iterator may return entries that were already returned though,
6828
- * and if you keep invalidating the iterator during iteration, the program may
6829
- * enter an infinite loop. */
8681
+ #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
6830
8682
 
6831
- size_t upb_mapiter_sizeof();
6832
8683
 
6833
- void upb_mapiter_begin(upb_mapiter *i, const upb_map *t);
6834
- upb_mapiter *upb_mapiter_new(const upb_map *t, upb_alloc *a);
6835
- void upb_mapiter_free(upb_mapiter *i, upb_alloc *a);
6836
- void upb_mapiter_next(upb_mapiter *i);
6837
- bool upb_mapiter_done(const upb_mapiter *i);
8684
+ #ifndef UPB_MSGFACTORY_H_
8685
+ #define UPB_MSGFACTORY_H_
6838
8686
 
6839
- upb_msgval upb_mapiter_key(const upb_mapiter *i);
6840
- upb_msgval upb_mapiter_value(const upb_mapiter *i);
6841
- void upb_mapiter_setdone(upb_mapiter *i);
6842
- bool upb_mapiter_isequal(const upb_mapiter *i1, const upb_mapiter *i2);
8687
+ #ifdef __cplusplus
8688
+ namespace upb {
8689
+ class MessageFactory;
8690
+ }
8691
+ #endif
6843
8692
 
8693
+ UPB_DECLARE_TYPE(upb::MessageFactory, upb_msgfactory)
6844
8694
 
6845
- /** Handlers ******************************************************************/
8695
+ /** upb_msgfactory ************************************************************/
6846
8696
 
6847
- /* These are the handlers used internally by upb_msgfactory_getmergehandlers().
6848
- * They write scalar data to a known offset from the message pointer.
8697
+ /* A upb_msgfactory contains a cache of upb_msglayout, upb_handlers, and
8698
+ * upb_visitorplan objects. These are the objects necessary to represent,
8699
+ * populate, and and visit upb_msg objects.
6849
8700
  *
6850
- * These would be trivial for anyone to implement themselves, but it's better
6851
- * to use these because some JITs will recognize and specialize these instead
6852
- * of actually calling the function. */
8701
+ * These caches are all populated by upb_msgdef, and lazily created on demand.
8702
+ */
6853
8703
 
6854
- /* Sets a handler for the given primitive field that will write the data at the
6855
- * given offset. If hasbit > 0, also sets a hasbit at the given bit offset
6856
- * (addressing each byte low to high). */
6857
- bool upb_msg_setscalarhandler(upb_handlers *h,
6858
- const upb_fielddef *f,
6859
- size_t offset,
6860
- int32_t hasbit);
8704
+ /* Creates and destroys a msgfactory, respectively. The messages for this
8705
+ * msgfactory must come from |symtab| (which should outlive the msgfactory). */
8706
+ upb_msgfactory *upb_msgfactory_new(const upb_symtab *symtab);
8707
+ void upb_msgfactory_free(upb_msgfactory *f);
6861
8708
 
6862
- /* If the given handler is a msghandlers_primitive field, returns true and sets
6863
- * *type, *offset and *hasbit. Otherwise returns false. */
6864
- bool upb_msg_getscalarhandlerdata(const upb_handlers *h,
6865
- upb_selector_t s,
6866
- upb_fieldtype_t *type,
6867
- size_t *offset,
6868
- int32_t *hasbit);
8709
+ const upb_symtab *upb_msgfactory_symtab(const upb_msgfactory *f);
6869
8710
 
6870
- UPB_END_EXTERN_C
8711
+ /* The functions to get cached objects, lazily creating them on demand. These
8712
+ * all require:
8713
+ *
8714
+ * - m is in upb_msgfactory_symtab(f)
8715
+ * - upb_msgdef_mapentry(m) == false (since map messages can't have layouts).
8716
+ *
8717
+ * The returned objects will live for as long as the msgfactory does.
8718
+ *
8719
+ * TODO(haberman): consider making this thread-safe and take a const
8720
+ * upb_msgfactory. */
8721
+ const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f,
8722
+ const upb_msgdef *m);
6871
8723
 
6872
- #endif /* UPB_MSG_H_ */
8724
+
8725
+ #endif /* UPB_MSGFACTORY_H_ */
6873
8726
  /*
6874
8727
  ** upb::descriptor::Reader (upb_descreader)
6875
8728
  **
@@ -6972,53 +8825,6 @@ inline FileDef* Reader::file(size_t i) const {
6972
8825
 
6973
8826
  UPB_BEGIN_EXTERN_C
6974
8827
 
6975
- /* Enums */
6976
-
6977
- typedef enum {
6978
- google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
6979
- google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
6980
- google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
6981
- } google_protobuf_FieldDescriptorProto_Label;
6982
-
6983
- typedef enum {
6984
- google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
6985
- google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
6986
- google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
6987
- google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
6988
- google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
6989
- google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
6990
- google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
6991
- google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
6992
- google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
6993
- google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
6994
- google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
6995
- google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
6996
- google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
6997
- google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
6998
- google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
6999
- google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
7000
- google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
7001
- google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
7002
- } google_protobuf_FieldDescriptorProto_Type;
7003
-
7004
- typedef enum {
7005
- google_protobuf_FieldOptions_STRING = 0,
7006
- google_protobuf_FieldOptions_CORD = 1,
7007
- google_protobuf_FieldOptions_STRING_PIECE = 2
7008
- } google_protobuf_FieldOptions_CType;
7009
-
7010
- typedef enum {
7011
- google_protobuf_FieldOptions_JS_NORMAL = 0,
7012
- google_protobuf_FieldOptions_JS_STRING = 1,
7013
- google_protobuf_FieldOptions_JS_NUMBER = 2
7014
- } google_protobuf_FieldOptions_JSType;
7015
-
7016
- typedef enum {
7017
- google_protobuf_FileOptions_SPEED = 1,
7018
- google_protobuf_FileOptions_CODE_SIZE = 2,
7019
- google_protobuf_FileOptions_LITE_RUNTIME = 3
7020
- } google_protobuf_FileOptions_OptimizeMode;
7021
-
7022
8828
  /* MessageDefs: call these functions to get a ref to a msgdef. */
7023
8829
  const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_get(const void *owner);
7024
8830
  const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(const void *owner);
@@ -7206,6 +9012,8 @@ UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_string
7206
9012
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_javanano_use_deprecated_package(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 38); }
7207
9013
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_objc_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 36); }
7208
9014
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_optimize_for(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 9); }
9015
+ UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 40); }
9016
+ UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_namespace(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 41); }
7209
9017
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_py_generic_services(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 18); }
7210
9018
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 999); }
7211
9019
  UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 3); }
@@ -7923,14 +9731,8 @@ inline const DecoderMethod *CodeCache::GetDecoderMethod(
7923
9731
 
7924
9732
  #endif /* UPB_DECODER_H_ */
7925
9733
 
7926
- /* C++ names are not actually used since this type isn't exposed to users. */
7927
- #ifdef __cplusplus
7928
- namespace upb {
7929
- namespace pb {
7930
- class MessageGroup;
7931
- } /* namespace pb */
7932
- } /* namespace upb */
7933
- #endif
9734
+ #ifndef __cplusplus
9735
+
7934
9736
  UPB_DECLARE_DERIVED_TYPE(upb::pb::MessageGroup, upb::RefCounted,
7935
9737
  mgroup, upb_refcounted)
7936
9738
 
@@ -7993,7 +9795,7 @@ typedef enum {
7993
9795
 
7994
9796
  #define OP_MAX OP_HALT
7995
9797
 
7996
- UPB_INLINE opcode getop(uint32_t instr) { return instr & 0xff; }
9798
+ UPB_INLINE opcode getop(uint32_t instr) { return (opcode)(instr & 0xff); }
7997
9799
 
7998
9800
  /* Method group; represents a set of decoder methods that had their code
7999
9801
  * emitted together, and must therefore be freed together. Immutable once
@@ -8240,6 +10042,8 @@ UPB_INLINE void upb_pbdecoder_unpackdispatch(uint64_t dispatch, uint64_t *ofs,
8240
10042
 
8241
10043
  #define CHECK_RETURN(x) { int32_t ret = x; if (ret >= 0) return ret; }
8242
10044
 
10045
+ #endif /* __cplusplus */
10046
+
8243
10047
  #endif /* UPB_DECODER_INT_H_ */
8244
10048
  /*
8245
10049
  ** A number of routines for varint manipulation (we keep them all around to
@@ -8257,21 +10061,9 @@ UPB_INLINE void upb_pbdecoder_unpackdispatch(uint64_t dispatch, uint64_t *ofs,
8257
10061
  extern "C" {
8258
10062
  #endif
8259
10063
 
8260
- /* A list of types as they are encoded on-the-wire. */
8261
- typedef enum {
8262
- UPB_WIRE_TYPE_VARINT = 0,
8263
- UPB_WIRE_TYPE_64BIT = 1,
8264
- UPB_WIRE_TYPE_DELIMITED = 2,
8265
- UPB_WIRE_TYPE_START_GROUP = 3,
8266
- UPB_WIRE_TYPE_END_GROUP = 4,
8267
- UPB_WIRE_TYPE_32BIT = 5
8268
- } upb_wiretype_t;
8269
-
8270
10064
  #define UPB_MAX_WIRE_TYPE 5
8271
10065
 
8272
- /* The maximum number of bytes that it takes to encode a 64-bit varint.
8273
- * Note that with a better encoding this could be 9 (TODO: write up a
8274
- * wiki document about this). */
10066
+ /* The maximum number of bytes that it takes to encode a 64-bit varint. */
8275
10067
  #define UPB_PB_VARINT_MAX_LEN 10
8276
10068
 
8277
10069
  /* Array of the "native" (ie. non-packed-repeated) wire type for the given a
@@ -8304,16 +10096,8 @@ UPB_INLINE upb_decoderet upb_decoderet_make(const char *p, uint64_t val) {
8304
10096
  return ret;
8305
10097
  }
8306
10098
 
8307
- /* Four functions for decoding a varint of at most eight bytes. They are all
8308
- * functionally identical, but are implemented in different ways and likely have
8309
- * different performance profiles. We keep them around for performance testing.
8310
- *
8311
- * Note that these functions may not read byte-by-byte, so they must not be used
8312
- * unless there are at least eight bytes left in the buffer! */
8313
10099
  upb_decoderet upb_vdecode_max8_branch32(upb_decoderet r);
8314
10100
  upb_decoderet upb_vdecode_max8_branch64(upb_decoderet r);
8315
- upb_decoderet upb_vdecode_max8_wright(upb_decoderet r);
8316
- upb_decoderet upb_vdecode_max8_massimino(upb_decoderet r);
8317
10101
 
8318
10102
  /* Template for a function that checks the first two bytes with branching
8319
10103
  * and dispatches 2-10 bytes with a separate function. Note that this may read
@@ -8338,8 +10122,6 @@ UPB_INLINE upb_decoderet upb_vdecode_check2_ ## name(const char *_p) { \
8338
10122
 
8339
10123
  UPB_VARINT_DECODER_CHECK2(branch32, upb_vdecode_max8_branch32)
8340
10124
  UPB_VARINT_DECODER_CHECK2(branch64, upb_vdecode_max8_branch64)
8341
- UPB_VARINT_DECODER_CHECK2(wright, upb_vdecode_max8_wright)
8342
- UPB_VARINT_DECODER_CHECK2(massimino, upb_vdecode_max8_massimino)
8343
10125
  #undef UPB_VARINT_DECODER_CHECK2
8344
10126
 
8345
10127
  /* Our canonical functions for decoding varints, based on the currently
@@ -8351,10 +10133,6 @@ UPB_INLINE upb_decoderet upb_vdecode_fast(const char *p) {
8351
10133
  return upb_vdecode_check2_branch32(p);
8352
10134
  }
8353
10135
 
8354
- UPB_INLINE upb_decoderet upb_vdecode_max8_fast(upb_decoderet r) {
8355
- return upb_vdecode_max8_massimino(r);
8356
- }
8357
-
8358
10136
 
8359
10137
  /* Encoding *******************************************************************/
8360
10138
 
@@ -8677,7 +10455,7 @@ UPB_DECLARE_DERIVED_TYPE(upb::json::ParserMethod, upb::RefCounted,
8677
10455
  * constructed. This hint may be an overestimate for some build configurations.
8678
10456
  * But if the parser library is upgraded without recompiling the application,
8679
10457
  * it may be an underestimate. */
8680
- #define UPB_JSON_PARSER_SIZE 4112
10458
+ #define UPB_JSON_PARSER_SIZE 5712
8681
10459
 
8682
10460
  #ifdef __cplusplus
8683
10461
 
@@ -8686,7 +10464,8 @@ UPB_DECLARE_DERIVED_TYPE(upb::json::ParserMethod, upb::RefCounted,
8686
10464
  class upb::json::Parser {
8687
10465
  public:
8688
10466
  static Parser* Create(Environment* env, const ParserMethod* method,
8689
- Sink* output);
10467
+ const SymbolTable* symtab,
10468
+ Sink* output, bool ignore_json_unknown);
8690
10469
 
8691
10470
  BytesSink* input();
8692
10471
 
@@ -8720,7 +10499,9 @@ UPB_BEGIN_EXTERN_C
8720
10499
 
8721
10500
  upb_json_parser* upb_json_parser_create(upb_env* e,
8722
10501
  const upb_json_parsermethod* m,
8723
- upb_sink* output);
10502
+ const upb_symtab* symtab,
10503
+ upb_sink* output,
10504
+ bool ignore_json_unknown);
8724
10505
  upb_bytessink *upb_json_parser_input(upb_json_parser *p);
8725
10506
 
8726
10507
  upb_json_parsermethod* upb_json_parsermethod_new(const upb_msgdef* md,
@@ -8740,8 +10521,10 @@ UPB_END_EXTERN_C
8740
10521
  namespace upb {
8741
10522
  namespace json {
8742
10523
  inline Parser* Parser::Create(Environment* env, const ParserMethod* method,
8743
- Sink* output) {
8744
- return upb_json_parser_create(env, method, output);
10524
+ const SymbolTable* symtab,
10525
+ Sink* output, bool ignore_json_unknown) {
10526
+ return upb_json_parser_create(
10527
+ env, method, symtab, output, ignore_json_unknown);
8745
10528
  }
8746
10529
  inline BytesSink* Parser::input() {
8747
10530
  return upb_json_parser_input(this);
@@ -8790,7 +10573,7 @@ UPB_DECLARE_TYPE(upb::json::Printer, upb_json_printer)
8790
10573
 
8791
10574
  /* upb::json::Printer *********************************************************/
8792
10575
 
8793
- #define UPB_JSON_PRINTER_SIZE 176
10576
+ #define UPB_JSON_PRINTER_SIZE 192
8794
10577
 
8795
10578
  #ifdef __cplusplus
8796
10579
 
@@ -8851,3 +10634,8 @@ inline reffed_ptr Printer::NewHandlers(
8851
10634
  #endif
8852
10635
 
8853
10636
  #endif /* UPB_JSON_TYPED_PRINTER_H_ */
10637
+
10638
+ #undef UPB_SIZE
10639
+ #undef UPB_FIELD_AT
10640
+ #undef UPB_READ_ONEOF
10641
+ #undef UPB_WRITE_ONEOF