blob: 9142a6d13aa69610acb31fa2777e51eeb175dae9 [file] [log] [blame]
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07001// Ruby is still using proto3 enum semantics for proto2
2#define UPB_DISABLE_PROTO2_ENUM_CHECKING
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003/* Amalgamated source file */
Joshua Habermandd69a482021-05-17 22:40:33 -07004
5/*
Eric Salo8809a112022-11-21 13:01:06 -08006 * This is where we define internal portability macros used across upb.
Joshua Habermandd69a482021-05-17 22:40:33 -07007 *
Eric Salo8809a112022-11-21 13:01:06 -08008 * All of these macros are undef'd in undef.inc to avoid leaking them to users.
Joshua Habermandd69a482021-05-17 22:40:33 -07009 *
10 * The correct usage is:
11 *
Protobuf Team Botfea76452023-09-12 20:32:11 +000012 * #include "upb/upb/foobar.h"
13 * #include "upb/upb/baz.h"
Joshua Habermandd69a482021-05-17 22:40:33 -070014 *
15 * // MUST be last included header.
Protobuf Team Botfea76452023-09-12 20:32:11 +000016 * #include "upb/upb/port/def.inc"
Joshua Habermandd69a482021-05-17 22:40:33 -070017 *
18 * // Code for this file.
19 * // <...>
20 *
21 * // Can be omitted for .c files, required for .h.
Protobuf Team Botfea76452023-09-12 20:32:11 +000022 * #include "upb/upb/port/undef.inc"
Joshua Habermandd69a482021-05-17 22:40:33 -070023 *
24 * This file is private and must not be included by users!
25 */
Joshua Haberman9abf6e22021-01-13 12:16:25 -080026
27#if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
Mike Kruskalfd0b1a52022-10-14 16:27:22 -070028 (defined(__cplusplus) && __cplusplus >= 201402L) || \
Joshua Haberman9abf6e22021-01-13 12:16:25 -080029 (defined(_MSC_VER) && _MSC_VER >= 1900))
Mike Kruskalfd0b1a52022-10-14 16:27:22 -070030#error upb requires C99 or C++14 or MSVC >= 2015.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080031#endif
32
Joshua Habermand3995ec2022-09-30 16:54:39 -070033// Portable check for GCC minimum version:
34// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
35#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
36#define UPB_GNUC_MIN(x, y) \
37 (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
38#else
39#define UPB_GNUC_MIN(x, y) 0
40#endif
41
42#include <assert.h>
43#include <setjmp.h>
44#include <stdbool.h>
Joshua Habermand3995ec2022-09-30 16:54:39 -070045#include <stdint.h>
Eric Salo8809a112022-11-21 13:01:06 -080046#include <stdio.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -080047
Adam Cozzette7d5592e2023-08-23 12:15:26 -070048#ifndef UINTPTR_MAX
49Error, UINTPTR_MAX is undefined
50#endif
51
Joshua Haberman9abf6e22021-01-13 12:16:25 -080052#if UINTPTR_MAX == 0xffffffff
53#define UPB_SIZE(size32, size64) size32
54#else
55#define UPB_SIZE(size32, size64) size64
56#endif
57
58/* If we always read/write as a consistent type to each address, this shouldn't
59 * violate aliasing.
60 */
61#define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs)))
62
Joshua Haberman9abf6e22021-01-13 12:16:25 -080063#define UPB_MAPTYPE_STRING 0
64
Eric Salo3f36a912022-12-05 14:12:25 -080065// UPB_EXPORT: always generate a public symbol.
66#if defined(__GNUC__) || defined(__clang__)
67#define UPB_EXPORT __attribute__((visibility("default"))) __attribute__((used))
68#else
69#define UPB_EXPORT
70#endif
71
72// UPB_INLINE: inline if possible, emit standalone code if required.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080073#ifdef __cplusplus
74#define UPB_INLINE inline
75#elif defined (__GNUC__) || defined(__clang__)
76#define UPB_INLINE static __inline__
77#else
78#define UPB_INLINE static
79#endif
80
Eric Salo3f36a912022-12-05 14:12:25 -080081#ifdef UPB_BUILD_API
82#define UPB_API UPB_EXPORT
83#define UPB_API_INLINE UPB_EXPORT
84#else
85#define UPB_API
86#define UPB_API_INLINE UPB_INLINE
87#endif
88
Joshua Habermand3995ec2022-09-30 16:54:39 -070089#define UPB_MALLOC_ALIGN 8
Joshua Haberman9abf6e22021-01-13 12:16:25 -080090#define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align))
91#define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
Joshua Habermand3995ec2022-09-30 16:54:39 -070092#define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, UPB_MALLOC_ALIGN)
Mike Kruskal232ecf42023-01-14 00:09:40 -080093#ifdef __clang__
94#define UPB_ALIGN_OF(type) _Alignof(type)
95#else
Joshua Haberman9abf6e22021-01-13 12:16:25 -080096#define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
Mike Kruskal232ecf42023-01-14 00:09:40 -080097#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080098
Eric Salo8809a112022-11-21 13:01:06 -080099// Hints to the compiler about likely/unlikely branches.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800100#if defined (__GNUC__) || defined(__clang__)
Eric Salo8809a112022-11-21 13:01:06 -0800101#define UPB_LIKELY(x) __builtin_expect((bool)(x), 1)
102#define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800103#else
104#define UPB_LIKELY(x) (x)
105#define UPB_UNLIKELY(x) (x)
106#endif
107
Eric Salo8809a112022-11-21 13:01:06 -0800108// Macros for function attributes on compilers that support them.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800109#ifdef __GNUC__
110#define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
111#define UPB_NOINLINE __attribute__((noinline))
112#define UPB_NORETURN __attribute__((__noreturn__))
113#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg)))
114#elif defined(_MSC_VER)
115#define UPB_NOINLINE
116#define UPB_FORCEINLINE
117#define UPB_NORETURN __declspec(noreturn)
118#define UPB_PRINTF(str, first_vararg)
119#else /* !defined(__GNUC__) */
120#define UPB_FORCEINLINE
121#define UPB_NOINLINE
122#define UPB_NORETURN
123#define UPB_PRINTF(str, first_vararg)
124#endif
125
126#define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
127#define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
128
129#define UPB_UNUSED(var) (void)var
130
Eric Salo8809a112022-11-21 13:01:06 -0800131// UPB_ASSUME(): in release mode, we tell the compiler to assume this is true.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800132#ifdef NDEBUG
133#ifdef __GNUC__
134#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable()
135#elif defined _MSC_VER
136#define UPB_ASSUME(expr) if (!(expr)) __assume(0)
137#else
138#define UPB_ASSUME(expr) do {} while (false && (expr))
139#endif
140#else
141#define UPB_ASSUME(expr) assert(expr)
142#endif
143
144/* UPB_ASSERT(): in release mode, we use the expression without letting it be
145 * evaluated. This prevents "unused variable" warnings. */
146#ifdef NDEBUG
147#define UPB_ASSERT(expr) do {} while (false && (expr))
148#else
149#define UPB_ASSERT(expr) assert(expr)
150#endif
151
152#if defined(__GNUC__) || defined(__clang__)
153#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
Eric Salo10505992022-12-12 12:16:36 -0800154#elif defined(_MSC_VER)
155#define UPB_UNREACHABLE() \
156 do { \
157 assert(0); \
158 __assume(0); \
159 } while (0)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800160#else
161#define UPB_UNREACHABLE() do { assert(0); } while(0)
162#endif
163
164/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */
165#ifdef __APPLE__
166#define UPB_SETJMP(buf) _setjmp(buf)
167#define UPB_LONGJMP(buf, val) _longjmp(buf, val)
168#else
169#define UPB_SETJMP(buf) setjmp(buf)
170#define UPB_LONGJMP(buf, val) longjmp(buf, val)
171#endif
172
Eric Salodfb71552023-03-22 12:35:09 -0700173#ifdef __GNUC__
174#define UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -0700175#define UPB_ATOMIC(T) _Atomic(T)
Eric Salodfb71552023-03-22 12:35:09 -0700176#else
Deanna Garciac7d979d2023-04-14 17:22:13 -0700177#define UPB_ATOMIC(T) T
Eric Salodfb71552023-03-22 12:35:09 -0700178#endif
179
Joshua Habermandd69a482021-05-17 22:40:33 -0700180/* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */
181#define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr))
182
Deanna Garciac7d979d2023-04-14 17:22:13 -0700183#define UPB_PRIVATE(x) x##_dont_copy_me__upb_internal_use_only
184
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800185/* Configure whether fasttable is switched on or not. *************************/
186
Joshua Habermandd69a482021-05-17 22:40:33 -0700187#ifdef __has_attribute
188#define UPB_HAS_ATTRIBUTE(x) __has_attribute(x)
189#else
190#define UPB_HAS_ATTRIBUTE(x) 0
191#endif
192
193#if UPB_HAS_ATTRIBUTE(musttail)
194#define UPB_MUSTTAIL __attribute__((musttail))
195#else
196#define UPB_MUSTTAIL
197#endif
198
199#undef UPB_HAS_ATTRIBUTE
200
201/* This check is not fully robust: it does not require that we have "musttail"
202 * support available. We need tail calls to avoid consuming arbitrary amounts
203 * of stack space.
204 *
205 * GCC/Clang can mostly be trusted to generate tail calls as long as
206 * optimization is enabled, but, debug builds will not generate tail calls
207 * unless "musttail" is available.
208 *
209 * We should probably either:
210 * 1. require that the compiler supports musttail.
211 * 2. add some fallback code for when musttail isn't available (ie. return
212 * instead of tail calling). This is safe and portable, but this comes at
213 * a CPU cost.
214 */
215#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800216#define UPB_FASTTABLE_SUPPORTED 1
217#else
218#define UPB_FASTTABLE_SUPPORTED 0
219#endif
220
221/* define UPB_ENABLE_FASTTABLE to force fast table support.
222 * This is useful when we want to ensure we are really getting fasttable,
223 * for example for testing or benchmarking. */
224#if defined(UPB_ENABLE_FASTTABLE)
225#if !UPB_FASTTABLE_SUPPORTED
Joshua Habermandd69a482021-05-17 22:40:33 -0700226#error fasttable is x86-64/ARM64 only and requires GCC or Clang.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800227#endif
228#define UPB_FASTTABLE 1
229/* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible.
230 * This is useful for releasing code that might be used on multiple platforms,
231 * for example the PHP or Ruby C extensions. */
232#elif defined(UPB_TRY_ENABLE_FASTTABLE)
233#define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
234#else
235#define UPB_FASTTABLE 0
236#endif
237
238/* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully
Mike Kruskal232ecf42023-01-14 00:09:40 -0800239 * degrade to non-fasttable if the runtime or platform do not support it. */
240#if !UPB_FASTTABLE
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800241#define UPB_FASTTABLE_INIT(...)
Mike Kruskal232ecf42023-01-14 00:09:40 -0800242#define UPB_FASTTABLE_MASK(mask) -1
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800243#else
244#define UPB_FASTTABLE_INIT(...) __VA_ARGS__
Mike Kruskal232ecf42023-01-14 00:09:40 -0800245#define UPB_FASTTABLE_MASK(mask) mask
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800246#endif
247
248#undef UPB_FASTTABLE_SUPPORTED
249
Joshua Habermand3995ec2022-09-30 16:54:39 -0700250/* ASAN poisoning (for arena).
251 * If using UPB from an interpreted language like Ruby, a build of the
Joshua Haberman488b8b92022-09-30 18:07:16 -0700252 * interpreter compiled with ASAN enabled must be used in order to get sane and
Joshua Habermand3995ec2022-09-30 16:54:39 -0700253 * expected behavior.
254 */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800255
Sandy Zhange3b09432023-08-07 09:30:02 -0700256/* Due to preprocessor limitations, the conditional logic for setting
257 * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner.
258 * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html.
259 */
260#if defined(__has_feature)
261#if __has_feature(address_sanitizer)
262#define UPB_CLANG_ASAN 1
263#else
264#define UPB_CLANG_ASAN 0
265#endif
266#else
267#define UPB_CLANG_ASAN 0
268#endif
269
270#if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800271#define UPB_ASAN 1
Sandy Zhange3b09432023-08-07 09:30:02 -0700272#define UPB_ASAN_GUARD_SIZE 32
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800273#ifdef __cplusplus
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700274 extern "C" {
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800275#endif
276void __asan_poison_memory_region(void const volatile *addr, size_t size);
277void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
278#ifdef __cplusplus
279} /* extern "C" */
280#endif
281#define UPB_POISON_MEMORY_REGION(addr, size) \
282 __asan_poison_memory_region((addr), (size))
283#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
284 __asan_unpoison_memory_region((addr), (size))
285#else
286#define UPB_ASAN 0
Sandy Zhange3b09432023-08-07 09:30:02 -0700287#define UPB_ASAN_GUARD_SIZE 0
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800288#define UPB_POISON_MEMORY_REGION(addr, size) \
289 ((void)(addr), (void)(size))
290#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
291 ((void)(addr), (void)(size))
Joshua Habermandd69a482021-05-17 22:40:33 -0700292#endif
293
Joshua Haberman7ecf43f2022-03-14 13:11:29 -0700294/* Disable proto2 arena behavior (TEMPORARY) **********************************/
295
296#ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING
297#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1
298#else
299#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0
300#endif
301
Joshua Habermand3995ec2022-09-30 16:54:39 -0700302#if defined(__cplusplus)
303#if defined(__clang__) || UPB_GNUC_MIN(6, 0)
304// https://gcc.gnu.org/gcc-6/changes.html
305#if __cplusplus >= 201402L
306#define UPB_DEPRECATED [[deprecated]]
307#else
308#define UPB_DEPRECATED __attribute__((deprecated))
309#endif
310#else
311#define UPB_DEPRECATED
312#endif
313#else
314#define UPB_DEPRECATED
315#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800316
Mike Kruskal232ecf42023-01-14 00:09:40 -0800317// begin:google_only
318// #define UPB_IS_GOOGLE3
319// end:google_only
320
321#if defined(UPB_IS_GOOGLE3) && !defined(UPB_BOOTSTRAP_STAGE0)
322#define UPB_DESC(sym) proto2_##sym
323#else
324#define UPB_DESC(sym) google_protobuf_##sym
325#endif
326
Eric Salo8809a112022-11-21 13:01:06 -0800327#ifndef UPB_BASE_STATUS_H_
328#define UPB_BASE_STATUS_H_
329
330#include <stdarg.h>
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700331
332// Must be last.
333
Eric Salo8809a112022-11-21 13:01:06 -0800334#define _kUpb_Status_MaxMessage 127
335
336typedef struct {
337 bool ok;
338 char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated.
339} upb_Status;
340
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700341#ifdef __cplusplus
342extern "C" {
343#endif
344
Eric Salo3f36a912022-12-05 14:12:25 -0800345UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status);
346UPB_API bool upb_Status_IsOk(const upb_Status* status);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700347
Eric Salo8809a112022-11-21 13:01:06 -0800348// These are no-op if |status| is NULL.
Eric Salo3f36a912022-12-05 14:12:25 -0800349UPB_API void upb_Status_Clear(upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -0800350void upb_Status_SetErrorMessage(upb_Status* status, const char* msg);
351void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...)
352 UPB_PRINTF(2, 3);
353void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt,
354 va_list args) UPB_PRINTF(2, 0);
355void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt,
356 va_list args) UPB_PRINTF(2, 0);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700357
358#ifdef __cplusplus
359} /* extern "C" */
360#endif
361
362
Eric Salo8809a112022-11-21 13:01:06 -0800363#endif /* UPB_BASE_STATUS_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700364
Adam Cozzette8059da22023-08-16 07:57:14 -0700365#ifndef UPB_COLLECTIONS_INTERNAL_ARRAY_H_
366#define UPB_COLLECTIONS_INTERNAL_ARRAY_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700367
368#include <string.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800369
Joshua Habermandd69a482021-05-17 22:40:33 -0700370
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700371#ifndef UPB_COLLECTIONS_ARRAY_H_
372#define UPB_COLLECTIONS_ARRAY_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700373
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000374#include <stddef.h>
375
Joshua Habermand3995ec2022-09-30 16:54:39 -0700376
Eric Salo8809a112022-11-21 13:01:06 -0800377#ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_
378#define UPB_BASE_DESCRIPTOR_CONSTANTS_H_
379
Eric Salodfb71552023-03-22 12:35:09 -0700380// Must be last.
381
Eric Salo8809a112022-11-21 13:01:06 -0800382// The types a field can have. Note that this list is not identical to the
383// types defined in descriptor.proto, which gives INT32 and SINT32 separate
384// types (we distinguish the two with the "integer encoding" enum below).
385// This enum is an internal convenience only and has no meaning outside of upb.
386typedef enum {
387 kUpb_CType_Bool = 1,
388 kUpb_CType_Float = 2,
389 kUpb_CType_Int32 = 3,
390 kUpb_CType_UInt32 = 4,
Protobuf Team Bot986cbb62023-09-19 15:03:51 +0000391 kUpb_CType_Enum = 5, // Enum values are int32. TODO: rename
Eric Salo8809a112022-11-21 13:01:06 -0800392 kUpb_CType_Message = 6,
393 kUpb_CType_Double = 7,
394 kUpb_CType_Int64 = 8,
395 kUpb_CType_UInt64 = 9,
396 kUpb_CType_String = 10,
397 kUpb_CType_Bytes = 11
398} upb_CType;
399
400// The repeated-ness of each field; this matches descriptor.proto.
401typedef enum {
402 kUpb_Label_Optional = 1,
403 kUpb_Label_Required = 2,
404 kUpb_Label_Repeated = 3
405} upb_Label;
406
407// Descriptor types, as defined in descriptor.proto.
408typedef enum {
409 kUpb_FieldType_Double = 1,
410 kUpb_FieldType_Float = 2,
411 kUpb_FieldType_Int64 = 3,
412 kUpb_FieldType_UInt64 = 4,
413 kUpb_FieldType_Int32 = 5,
414 kUpb_FieldType_Fixed64 = 6,
415 kUpb_FieldType_Fixed32 = 7,
416 kUpb_FieldType_Bool = 8,
417 kUpb_FieldType_String = 9,
418 kUpb_FieldType_Group = 10,
419 kUpb_FieldType_Message = 11,
420 kUpb_FieldType_Bytes = 12,
421 kUpb_FieldType_UInt32 = 13,
422 kUpb_FieldType_Enum = 14,
423 kUpb_FieldType_SFixed32 = 15,
424 kUpb_FieldType_SFixed64 = 16,
425 kUpb_FieldType_SInt32 = 17,
426 kUpb_FieldType_SInt64 = 18,
427} upb_FieldType;
428
429#define kUpb_FieldType_SizeOf 19
430
Eric Salodfb71552023-03-22 12:35:09 -0700431#ifdef __cplusplus
432extern "C" {
433#endif
434
435UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) {
436 // clang-format off
437 const unsigned kUnpackableTypes =
438 (1 << kUpb_FieldType_String) |
439 (1 << kUpb_FieldType_Bytes) |
440 (1 << kUpb_FieldType_Message) |
441 (1 << kUpb_FieldType_Group);
442 // clang-format on
443 return (1 << type) & ~kUnpackableTypes;
444}
445
446#ifdef __cplusplus
447} /* extern "C" */
448#endif
449
450
Eric Salo8809a112022-11-21 13:01:06 -0800451#endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */
452
Eric Salo8809a112022-11-21 13:01:06 -0800453/* upb_Arena is a specific allocator implementation that uses arena allocation.
454 * The user provides an allocator that will be used to allocate the underlying
455 * arena blocks. Arenas by nature do not require the individual allocations
456 * to be freed. However the Arena does allow users to register cleanup
457 * functions that will run when the arena is destroyed.
Joshua Habermandd69a482021-05-17 22:40:33 -0700458 *
Eric Salo8809a112022-11-21 13:01:06 -0800459 * A upb_Arena is *not* thread-safe.
460 *
461 * You could write a thread-safe arena allocator that satisfies the
462 * upb_alloc interface, but it would not be as efficient for the
463 * single-threaded case. */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800464
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700465#ifndef UPB_MEM_ARENA_H_
466#define UPB_MEM_ARENA_H_
Joshua Habermandd69a482021-05-17 22:40:33 -0700467
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700468#include <stddef.h>
469#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800470#include <string.h>
471
472
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700473#ifndef UPB_MEM_ALLOC_H_
474#define UPB_MEM_ALLOC_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700475
476// Must be last.
477
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800478#ifdef __cplusplus
479extern "C" {
480#endif
481
Joshua Habermand3995ec2022-09-30 16:54:39 -0700482typedef struct upb_alloc upb_alloc;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800483
Joshua Habermand3995ec2022-09-30 16:54:39 -0700484/* A combined `malloc()`/`free()` function.
485 * If `size` is 0 then the function acts like `free()`, otherwise it acts like
486 * `realloc()`. Only `oldsize` bytes from a previous allocation are
487 * preserved. */
488typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize,
489 size_t size);
490
491/* A upb_alloc is a possibly-stateful allocator object.
492 *
493 * It could either be an arena allocator (which doesn't require individual
494 * `free()` calls) or a regular `malloc()` (which does). The client must
495 * therefore free memory unless it knows that the allocator is an arena
496 * allocator. */
497struct upb_alloc {
498 upb_alloc_func* func;
499};
500
501UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) {
502 UPB_ASSERT(alloc);
503 return alloc->func(alloc, NULL, 0, size);
504}
505
506UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize,
507 size_t size) {
508 UPB_ASSERT(alloc);
509 return alloc->func(alloc, ptr, oldsize, size);
510}
511
512UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) {
513 UPB_ASSERT(alloc);
514 alloc->func(alloc, ptr, 0, 0);
515}
516
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700517// The global allocator used by upb. Uses the standard malloc()/free().
Joshua Habermand3995ec2022-09-30 16:54:39 -0700518
519extern upb_alloc upb_alloc_global;
520
521/* Functions that hard-code the global malloc.
522 *
523 * We still get benefit because we can put custom logic into our global
524 * allocator, like injecting out-of-memory faults in debug/testing builds. */
525
526UPB_INLINE void* upb_gmalloc(size_t size) {
527 return upb_malloc(&upb_alloc_global, size);
528}
529
530UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) {
531 return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
532}
533
534UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); }
535
536#ifdef __cplusplus
537} /* extern "C" */
538#endif
539
540
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700541#endif /* UPB_MEM_ALLOC_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700542
543// Must be last.
544
Joshua Habermand3995ec2022-09-30 16:54:39 -0700545typedef struct upb_Arena upb_Arena;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800546
547typedef struct {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700548 char *ptr, *end;
549} _upb_ArenaHead;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800550
Eric Salo8809a112022-11-21 13:01:06 -0800551#ifdef __cplusplus
552extern "C" {
553#endif
554
Mike Kruskal3bc50492022-12-01 13:34:12 -0800555// Creates an arena from the given initial block (if any -- n may be 0).
556// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
557// is a fixed-size arena and cannot grow.
Eric Salo3f36a912022-12-05 14:12:25 -0800558UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc);
Mike Kruskal3bc50492022-12-01 13:34:12 -0800559
Eric Salo3f36a912022-12-05 14:12:25 -0800560UPB_API void upb_Arena_Free(upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -0800561UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b);
562
Joshua Habermand3995ec2022-09-30 16:54:39 -0700563void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size);
564size_t upb_Arena_SpaceAllocated(upb_Arena* arena);
565uint32_t upb_Arena_DebugRefCount(upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800566
Joshua Habermand3995ec2022-09-30 16:54:39 -0700567UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) {
568 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
569 return (size_t)(h->end - h->ptr);
570}
571
Eric Salo3f36a912022-12-05 14:12:25 -0800572UPB_API_INLINE void* upb_Arena_Malloc(upb_Arena* a, size_t size) {
Eric Salo8809a112022-11-21 13:01:06 -0800573 size = UPB_ALIGN_MALLOC(size);
Sandy Zhange3b09432023-08-07 09:30:02 -0700574 size_t span = size + UPB_ASAN_GUARD_SIZE;
575 if (UPB_UNLIKELY(_upb_ArenaHas(a) < span)) {
Eric Salo8809a112022-11-21 13:01:06 -0800576 return _upb_Arena_SlowMalloc(a, size);
577 }
578
579 // We have enough space to do a fast malloc.
Joshua Habermand3995ec2022-09-30 16:54:39 -0700580 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
581 void* ret = h->ptr;
582 UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret);
583 UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size);
584 UPB_UNPOISON_MEMORY_REGION(ret, size);
585
Sandy Zhange3b09432023-08-07 09:30:02 -0700586 h->ptr += span;
Joshua Habermand3995ec2022-09-30 16:54:39 -0700587
588 return ret;
589}
590
Joshua Habermand3995ec2022-09-30 16:54:39 -0700591// Shrinks the last alloc from arena.
592// REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena.
593// We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if
594// this was not the last alloc.
Eric Salo3f36a912022-12-05 14:12:25 -0800595UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
596 size_t oldsize, size_t size) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700597 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
598 oldsize = UPB_ALIGN_MALLOC(oldsize);
599 size = UPB_ALIGN_MALLOC(size);
Sandy Zhange3b09432023-08-07 09:30:02 -0700600 // Must be the last alloc.
601 UPB_ASSERT((char*)ptr + oldsize == h->ptr - UPB_ASAN_GUARD_SIZE);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700602 UPB_ASSERT(size <= oldsize);
603 h->ptr = (char*)ptr + size;
604}
605
Eric Salo3f36a912022-12-05 14:12:25 -0800606UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
607 size_t size) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700608 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
609 oldsize = UPB_ALIGN_MALLOC(oldsize);
610 size = UPB_ALIGN_MALLOC(size);
611 bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr;
612
613 if (is_most_recent_alloc) {
614 ptrdiff_t diff = size - oldsize;
615 if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) {
616 h->ptr += diff;
617 return ptr;
618 }
619 } else if (size <= oldsize) {
620 return ptr;
621 }
622
623 void* ret = upb_Arena_Malloc(a, size);
624
625 if (ret && oldsize > 0) {
626 memcpy(ret, ptr, UPB_MIN(oldsize, size));
627 }
628
629 return ret;
630}
631
Eric Salo3f36a912022-12-05 14:12:25 -0800632UPB_API_INLINE upb_Arena* upb_Arena_New(void) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700633 return upb_Arena_Init(NULL, 0, &upb_alloc_global);
634}
635
636#ifdef __cplusplus
637} /* extern "C" */
638#endif
639
640
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700641#endif /* UPB_MEM_ARENA_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700642
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000643// Users should include array.h or map.h instead.
644// IWYU pragma: private, include "upb/upb/collections/array.h"
645
646#ifndef UPB_MESSAGE_VALUE_H_
647#define UPB_MESSAGE_VALUE_H_
648
649#include <stdint.h>
650
651#ifndef UPB_BASE_STRING_VIEW_H_
652#define UPB_BASE_STRING_VIEW_H_
653
654#include <string.h>
655
Joshua Habermand3995ec2022-09-30 16:54:39 -0700656// Must be last.
657
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000658#define UPB_STRINGVIEW_INIT(ptr, len) \
659 { ptr, len }
660
661#define UPB_STRINGVIEW_FORMAT "%.*s"
662#define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data
663
664// LINT.IfChange(struct_definition)
665typedef struct {
666 const char* data;
667 size_t size;
668} upb_StringView;
669// LINT.ThenChange(
670// GoogleInternalName0,
671// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string
672// )
673
674#ifdef __cplusplus
675extern "C" {
676#endif
677
678UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data,
679 size_t size) {
680 upb_StringView ret;
681 ret.data = data;
682 ret.size = size;
683 return ret;
684}
685
686UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) {
687 return upb_StringView_FromDataAndSize(data, strlen(data));
688}
689
690UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
691 return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
692}
693
694#ifdef __cplusplus
695} /* extern "C" */
696#endif
697
698
699#endif /* UPB_BASE_STRING_VIEW_H_ */
700
701#ifndef UPB_MINI_TABLE_TYPES_H_
702#define UPB_MINI_TABLE_TYPES_H_
703
704#include <stdint.h>
705
706
707#ifndef UPB_MESSAGE_TYPES_H_
708#define UPB_MESSAGE_TYPES_H_
709
710// This typedef is in a leaf header to resolve a circular dependency between
711// messages and mini tables.
712typedef void upb_Message;
713
714#endif /* UPB_MESSAGE_TYPES_H_ */
715
716// Must be last.
717
718#ifdef __cplusplus
719extern "C" {
720#endif
721
722// When a upb_Message* is stored in a message, array, or map, it is stored in a
723// tagged form. If the tag bit is set, the referenced upb_Message is of type
724// _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of
725// that field's true message type. This forms the basis of what we call
726// "dynamic tree shaking."
727//
728// See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for
729// more information.
730typedef uintptr_t upb_TaggedMessagePtr;
731
732// Internal-only because empty messages cannot be created by the user.
733UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr,
734 bool empty) {
735 UPB_ASSERT(((uintptr_t)ptr & 1) == 0);
736 return (uintptr_t)ptr | (empty ? 1 : 0);
737}
738
739// Users who enable unlinked sub-messages must use this to test whether a
740// message is empty before accessing it. If a message is empty, it must be
741// first promoted using the interfaces in message/promote.h.
742UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) {
743 return ptr & 1;
744}
745
746UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage(
747 upb_TaggedMessagePtr ptr) {
748 return (upb_Message*)(ptr & ~(uintptr_t)1);
749}
750
751UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
752 upb_TaggedMessagePtr ptr) {
753 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr));
754 return _upb_TaggedMessagePtr_GetMessage(ptr);
755}
756
757UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage(
758 upb_TaggedMessagePtr ptr) {
759 UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr));
760 return _upb_TaggedMessagePtr_GetMessage(ptr);
761}
762
763#ifdef __cplusplus
764} /* extern "C" */
765#endif
766
767
768#endif /* UPB_MINI_TABLE_TYPES_H_ */
769
770typedef union {
771 bool bool_val;
772 float float_val;
773 double double_val;
774 int32_t int32_val;
775 int64_t int64_val;
776 uint32_t uint32_val;
777 uint64_t uint64_val;
778 const struct upb_Array* array_val;
779 const struct upb_Map* map_val;
780 const upb_Message* msg_val;
781 upb_StringView str_val;
782
783 // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of
784 // msg_val if unlinked sub-messages may possibly be in use. See the
785 // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more
786 // information.
787 upb_TaggedMessagePtr tagged_msg_val;
788} upb_MessageValue;
789
790typedef union {
791 struct upb_Array* array;
792 struct upb_Map* map;
793 upb_Message* msg;
794} upb_MutableMessageValue;
795
796#endif /* UPB_MESSAGE_VALUE_H_ */
797
798// Must be last.
799
800typedef struct upb_Array upb_Array;
801
Joshua Habermand3995ec2022-09-30 16:54:39 -0700802#ifdef __cplusplus
803extern "C" {
804#endif
805
Eric Salob598b2d2022-12-22 23:14:27 -0800806// Creates a new array on the given arena that holds elements of this type.
807UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700808
Eric Salob598b2d2022-12-22 23:14:27 -0800809// Returns the number of elements in the array.
810UPB_API size_t upb_Array_Size(const upb_Array* arr);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700811
Eric Salob598b2d2022-12-22 23:14:27 -0800812// Returns the given element, which must be within the array's current size.
813UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700814
Eric Salob598b2d2022-12-22 23:14:27 -0800815// Sets the given element, which must be within the array's current size.
816UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700817
Eric Salob598b2d2022-12-22 23:14:27 -0800818// Appends an element to the array. Returns false on allocation failure.
819UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val,
820 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700821
Eric Salob598b2d2022-12-22 23:14:27 -0800822// Moves elements within the array using memmove().
823// Like memmove(), the source and destination elements may be overlapping.
824UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx,
825 size_t count);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700826
Eric Salob598b2d2022-12-22 23:14:27 -0800827// Inserts one or more empty elements into the array.
828// Existing elements are shifted right.
829// The new elements have undefined state and must be set with `upb_Array_Set()`.
830// REQUIRES: `i <= upb_Array_Size(arr)`
831UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count,
832 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700833
Eric Salob598b2d2022-12-22 23:14:27 -0800834// Deletes one or more elements from the array.
835// Existing elements are shifted left.
836// REQUIRES: `i + count <= upb_Array_Size(arr)`
837UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700838
Eric Salob598b2d2022-12-22 23:14:27 -0800839// Changes the size of a vector. New elements are initialized to NULL/0.
840// Returns false on allocation failure.
841UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700842
Jie Luo3560e232023-06-12 00:33:50 -0700843// Returns pointer to array data.
844UPB_API const void* upb_Array_DataPtr(const upb_Array* arr);
845
846// Returns mutable pointer to array data.
847UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr);
848
Joshua Habermand3995ec2022-09-30 16:54:39 -0700849#ifdef __cplusplus
850} /* extern "C" */
851#endif
852
853
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700854#endif /* UPB_COLLECTIONS_ARRAY_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700855
856// Must be last.
857
858#ifdef __cplusplus
859extern "C" {
860#endif
861
Eric Salo8809a112022-11-21 13:01:06 -0800862// LINT.IfChange(struct_definition)
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700863// Our internal representation for repeated fields.
Joshua Habermand3995ec2022-09-30 16:54:39 -0700864struct upb_Array {
865 uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
866 size_t size; /* The number of elements in the array. */
867 size_t capacity; /* Allocated storage. Measured in elements. */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700868};
Eric Salo8809a112022-11-21 13:01:06 -0800869// LINT.ThenChange(GoogleInternalName1)
Joshua Habermand3995ec2022-09-30 16:54:39 -0700870
Eric Salob7d54ac2022-12-29 11:59:42 -0800871UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) {
872 size_t ret = arr->data & 7;
873 UPB_ASSERT(ret <= 4);
874 return ret;
875}
876
Joshua Habermand3995ec2022-09-30 16:54:39 -0700877UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) {
Eric Salob7d54ac2022-12-29 11:59:42 -0800878 _upb_Array_ElementSizeLg2(arr); // Check assertion.
Joshua Habermand3995ec2022-09-30 16:54:39 -0700879 return (void*)(arr->data & ~(uintptr_t)7);
880}
881
882UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) {
883 UPB_ASSERT(elem_size_lg2 <= 4);
884 return (uintptr_t)ptr | elem_size_lg2;
885}
886
887UPB_INLINE void* _upb_array_ptr(upb_Array* arr) {
888 return (void*)_upb_array_constptr(arr);
889}
890
891UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) {
892 UPB_ASSERT(elem_size_lg2 <= 4);
893 UPB_ASSERT(((uintptr_t)ptr & 7) == 0);
894 return (uintptr_t)ptr | (unsigned)elem_size_lg2;
895}
896
Eric Salob7d54ac2022-12-29 11:59:42 -0800897extern const char _upb_Array_CTypeSizeLg2Table[];
898
899UPB_INLINE size_t _upb_Array_CTypeSizeLg2(upb_CType ctype) {
900 return _upb_Array_CTypeSizeLg2Table[ctype];
901}
902
Joshua Habermand3995ec2022-09-30 16:54:39 -0700903UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity,
904 int elem_size_lg2) {
Eric Salob7d54ac2022-12-29 11:59:42 -0800905 UPB_ASSERT(elem_size_lg2 <= 4);
Joshua Haberman77559732022-10-03 11:13:05 -0700906 const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN);
907 const size_t bytes = arr_size + (init_capacity << elem_size_lg2);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700908 upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes);
909 if (!arr) return NULL;
910 arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2);
911 arr->size = 0;
912 arr->capacity = init_capacity;
913 return arr;
914}
915
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700916// Resizes the capacity of the array to be at least min_size.
Joshua Habermand3995ec2022-09-30 16:54:39 -0700917bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena);
918
Joshua Habermand3995ec2022-09-30 16:54:39 -0700919UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size,
920 upb_Arena* arena) {
921 if (arr->capacity < size) return _upb_array_realloc(arr, size, arena);
922 return true;
923}
924
Eric Salob598b2d2022-12-22 23:14:27 -0800925// Resize without initializing new elements.
926UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size,
927 upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -0700928 UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking.
Joshua Habermand3995ec2022-09-30 16:54:39 -0700929 if (!_upb_array_reserve(arr, size, arena)) return false;
930 arr->size = size;
931 return true;
932}
933
Eric Salob7d54ac2022-12-29 11:59:42 -0800934// This function is intended for situations where elem_size is compile-time
935// constant or a known expression of the form (1 << lg2), so that the expression
936// i*elem_size does not result in an actual multiplication.
937UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data,
938 size_t elem_size) {
939 UPB_ASSERT(i < arr->size);
940 UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr));
941 char* arr_data = (char*)_upb_array_ptr(arr);
942 memcpy(arr_data + (i * elem_size), data, elem_size);
943}
944
Joshua Habermand3995ec2022-09-30 16:54:39 -0700945UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) {
946 *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL;
947}
948
Joshua Habermand3995ec2022-09-30 16:54:39 -0700949#ifdef __cplusplus
950} /* extern "C" */
951#endif
952
953
Adam Cozzette8059da22023-08-16 07:57:14 -0700954#endif /* UPB_COLLECTIONS_INTERNAL_ARRAY_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700955
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700956#ifndef UPB_COLLECTIONS_MAP_H_
957#define UPB_COLLECTIONS_MAP_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700958
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000959#include <stddef.h>
960
Joshua Habermand3995ec2022-09-30 16:54:39 -0700961
962// Must be last.
963
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000964typedef struct upb_Map upb_Map;
965
Joshua Habermand3995ec2022-09-30 16:54:39 -0700966#ifdef __cplusplus
967extern "C" {
968#endif
969
Eric Salob7d54ac2022-12-29 11:59:42 -0800970// Creates a new map on the given arena with the given key/value size.
971UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type,
972 upb_CType value_type);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700973
Eric Salob7d54ac2022-12-29 11:59:42 -0800974// Returns the number of entries in the map.
975UPB_API size_t upb_Map_Size(const upb_Map* map);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700976
Eric Salob7d54ac2022-12-29 11:59:42 -0800977// Stores a value for the given key into |*val| (or the zero value if the key is
978// not present). Returns whether the key was present. The |val| pointer may be
979// NULL, in which case the function tests whether the given key is present.
980UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key,
981 upb_MessageValue* val);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700982
Eric Salob7d54ac2022-12-29 11:59:42 -0800983// Removes all entries in the map.
984UPB_API void upb_Map_Clear(upb_Map* map);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700985
986typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700987 kUpb_MapInsertStatus_Inserted = 0,
988 kUpb_MapInsertStatus_Replaced = 1,
989 kUpb_MapInsertStatus_OutOfMemory = 2,
Joshua Habermand3995ec2022-09-30 16:54:39 -0700990} upb_MapInsertStatus;
991
Eric Salob7d54ac2022-12-29 11:59:42 -0800992// Sets the given key to the given value, returning whether the key was inserted
993// or replaced. If the key was inserted, then any existing iterators will be
994// invalidated.
995UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key,
996 upb_MessageValue val,
997 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700998
Eric Salob7d54ac2022-12-29 11:59:42 -0800999// Sets the given key to the given value. Returns false if memory allocation
1000// failed. If the key is newly inserted, then any existing iterators will be
1001// invalidated.
1002UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key,
1003 upb_MessageValue val, upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07001004 return upb_Map_Insert(map, key, val, arena) !=
1005 kUpb_MapInsertStatus_OutOfMemory;
1006}
1007
Eric Salo8809a112022-11-21 13:01:06 -08001008// Deletes this key from the table. Returns true if the key was present.
Eric Salob598b2d2022-12-22 23:14:27 -08001009// If present and |val| is non-NULL, stores the deleted value.
Eric Salob7d54ac2022-12-29 11:59:42 -08001010UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
1011 upb_MessageValue* val);
Eric Salob598b2d2022-12-22 23:14:27 -08001012
Eric Salob598b2d2022-12-22 23:14:27 -08001013// (DEPRECATED and going away soon. Do not use.)
Eric Salob7d54ac2022-12-29 11:59:42 -08001014UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key,
1015 upb_MessageValue* val) {
1016 return upb_Map_Delete(map, key, val);
Eric Salob598b2d2022-12-22 23:14:27 -08001017}
Joshua Habermand3995ec2022-09-30 16:54:39 -07001018
Eric Salo8809a112022-11-21 13:01:06 -08001019// Map iteration:
1020//
1021// size_t iter = kUpb_Map_Begin;
1022// upb_MessageValue key, val;
1023// while (upb_Map_Next(map, &key, &val, &iter)) {
1024// ...
1025// }
1026
1027#define kUpb_Map_Begin ((size_t)-1)
1028
1029// Advances to the next entry. Returns false if no more entries are present.
1030// Otherwise returns true and populates both *key and *value.
Eric Salob7d54ac2022-12-29 11:59:42 -08001031UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key,
1032 upb_MessageValue* val, size_t* iter);
Eric Salo8809a112022-11-21 13:01:06 -08001033
Jie Luo3560e232023-06-12 00:33:50 -07001034// Sets the value for the entry pointed to by iter.
1035// WARNING: this does not currently work for string values!
1036UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter,
1037 upb_MessageValue val);
1038
Eric Salo8809a112022-11-21 13:01:06 -08001039// DEPRECATED iterator, slated for removal.
1040
Joshua Habermand3995ec2022-09-30 16:54:39 -07001041/* Map iteration:
1042 *
1043 * size_t iter = kUpb_Map_Begin;
1044 * while (upb_MapIterator_Next(map, &iter)) {
1045 * upb_MessageValue key = upb_MapIterator_Key(map, iter);
1046 * upb_MessageValue val = upb_MapIterator_Value(map, iter);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001047 * }
1048 */
1049
Eric Salo8809a112022-11-21 13:01:06 -08001050// Advances to the next entry. Returns false if no more entries are present.
Jason Lunn67dee292023-07-13 13:15:26 -07001051UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001052
Eric Salob7d54ac2022-12-29 11:59:42 -08001053// Returns true if the iterator still points to a valid entry, or false if the
1054// iterator is past the last element. It is an error to call this function with
1055// kUpb_Map_Begin (you must call next() at least once first).
Jason Lunn67dee292023-07-13 13:15:26 -07001056UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001057
Eric Salob7d54ac2022-12-29 11:59:42 -08001058// Returns the key and value for this entry of the map.
Jason Lunn67dee292023-07-13 13:15:26 -07001059UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter);
1060UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001061
Joshua Habermand3995ec2022-09-30 16:54:39 -07001062#ifdef __cplusplus
1063} /* extern "C" */
1064#endif
1065
1066
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001067#endif /* UPB_COLLECTIONS_MAP_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07001068
Eric Salo8809a112022-11-21 13:01:06 -08001069// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
Joshua Habermand3995ec2022-09-30 16:54:39 -07001070
Adam Cozzette8059da22023-08-16 07:57:14 -07001071#ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_
1072#define UPB_COLLECTIONS_INTERNAL_MAP_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07001073
1074
Eric Salo8809a112022-11-21 13:01:06 -08001075#ifndef UPB_HASH_STR_TABLE_H_
1076#define UPB_HASH_STR_TABLE_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07001077
1078
Joshua Habermandd69a482021-05-17 22:40:33 -07001079/*
1080 * upb_table
1081 *
1082 * This header is INTERNAL-ONLY! Its interfaces are not public or stable!
1083 * This file defines very fast int->upb_value (inttable) and string->upb_value
1084 * (strtable) hash tables.
1085 *
1086 * The table uses chained scatter with Brent's variation (inspired by the Lua
1087 * implementation of hash tables). The hash function for strings is Austin
1088 * Appleby's "MurmurHash."
1089 *
1090 * The inttable uses uintptr_t as its key, which guarantees it can be used to
1091 * store pointers or integers of at least 32 bits (upb isn't really useful on
1092 * systems where sizeof(void*) < 4).
1093 *
1094 * The table must be homogeneous (all values of the same type). In debug
1095 * mode, we check this on insert and lookup.
1096 */
1097
Eric Salo8809a112022-11-21 13:01:06 -08001098#ifndef UPB_HASH_COMMON_H_
1099#define UPB_HASH_COMMON_H_
Joshua Habermandd69a482021-05-17 22:40:33 -07001100
Joshua Habermandd69a482021-05-17 22:40:33 -07001101#include <string.h>
1102
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001103
Joshua Habermanf41049a2022-01-21 14:41:25 -08001104// Must be last.
1105
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001106#ifdef __cplusplus
1107extern "C" {
1108#endif
1109
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001110/* upb_value ******************************************************************/
1111
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001112typedef struct {
1113 uint64_t val;
1114} upb_value;
1115
Joshua Habermanf41049a2022-01-21 14:41:25 -08001116UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001117
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001118/* For each value ctype, define the following set of functions:
1119 *
1120 * // Get/set an int32 from a upb_value.
1121 * int32_t upb_value_getint32(upb_value val);
1122 * void upb_value_setint32(upb_value *val, int32_t cval);
1123 *
1124 * // Construct a new upb_value from an int32.
1125 * upb_value upb_value_int32(int32_t val); */
Protobuf Team Bot4d0e8052023-09-13 15:50:57 +00001126#define FUNCS(name, membername, type_t, converter) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08001127 UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \
1128 val->val = (converter)cval; \
1129 } \
1130 UPB_INLINE upb_value upb_value_##name(type_t val) { \
1131 upb_value ret; \
1132 upb_value_set##name(&ret, val); \
1133 return ret; \
1134 } \
1135 UPB_INLINE type_t upb_value_get##name(upb_value val) { \
1136 return (type_t)(converter)val.val; \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001137 }
1138
Protobuf Team Bot4d0e8052023-09-13 15:50:57 +00001139FUNCS(int32, int32, int32_t, int32_t)
1140FUNCS(int64, int64, int64_t, int64_t)
1141FUNCS(uint32, uint32, uint32_t, uint32_t)
1142FUNCS(uint64, uint64, uint64_t, uint64_t)
1143FUNCS(bool, _bool, bool, bool)
1144FUNCS(cstr, cstr, char*, uintptr_t)
1145FUNCS(uintptr, uptr, uintptr_t, uintptr_t)
1146FUNCS(ptr, ptr, void*, uintptr_t)
1147FUNCS(constptr, constptr, const void*, uintptr_t)
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001148
1149#undef FUNCS
1150
Joshua Habermanf41049a2022-01-21 14:41:25 -08001151UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001152 memcpy(&val->val, &cval, sizeof(cval));
1153}
1154
Joshua Habermanf41049a2022-01-21 14:41:25 -08001155UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001156 memcpy(&val->val, &cval, sizeof(cval));
1157}
1158
1159UPB_INLINE upb_value upb_value_float(float cval) {
1160 upb_value ret;
1161 upb_value_setfloat(&ret, cval);
1162 return ret;
1163}
1164
1165UPB_INLINE upb_value upb_value_double(double cval) {
1166 upb_value ret;
1167 upb_value_setdouble(&ret, cval);
1168 return ret;
1169}
1170
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001171/* upb_tabkey *****************************************************************/
1172
1173/* Either:
1174 * 1. an actual integer key, or
1175 * 2. a pointer to a string prefixed by its uint32_t length, owned by us.
1176 *
1177 * ...depending on whether this is a string table or an int table. We would
1178 * make this a union of those two types, but C89 doesn't support statically
1179 * initializing a non-first union member. */
1180typedef uintptr_t upb_tabkey;
1181
Joshua Habermanf41049a2022-01-21 14:41:25 -08001182UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001183 char* mem = (char*)key;
1184 if (len) memcpy(len, mem, sizeof(*len));
1185 return mem + sizeof(*len);
1186}
1187
Joshua Habermanf41049a2022-01-21 14:41:25 -08001188UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) {
1189 upb_StringView ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001190 uint32_t len;
1191 ret.data = upb_tabstr(key, &len);
1192 ret.size = len;
1193 return ret;
1194}
1195
1196/* upb_tabval *****************************************************************/
1197
1198typedef struct upb_tabval {
1199 uint64_t val;
1200} upb_tabval;
1201
Joshua Habermanf41049a2022-01-21 14:41:25 -08001202#define UPB_TABVALUE_EMPTY_INIT \
1203 { -1 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001204
1205/* upb_table ******************************************************************/
1206
1207typedef struct _upb_tabent {
1208 upb_tabkey key;
1209 upb_tabval val;
1210
1211 /* Internal chaining. This is const so we can create static initializers for
1212 * tables. We cast away const sometimes, but *only* when the containing
1213 * upb_table is known to be non-const. This requires a bit of care, but
1214 * the subtlety is confined to table.c. */
Joshua Habermanf41049a2022-01-21 14:41:25 -08001215 const struct _upb_tabent* next;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001216} upb_tabent;
1217
1218typedef struct {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001219 size_t count; /* Number of entries in the hash part. */
1220 uint32_t mask; /* Mask to turn hash value -> bucket. */
1221 uint32_t max_count; /* Max count before we hit our load limit. */
1222 uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
1223 upb_tabent* entries;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001224} upb_table;
1225
Eric Salo8809a112022-11-21 13:01:06 -08001226UPB_INLINE size_t upb_table_size(const upb_table* t) {
1227 return t->size_lg2 ? 1 << t->size_lg2 : 0;
1228}
1229
1230// Internal-only functions, in .h file only out of necessity.
Mike Kruskal04e81352022-11-23 11:07:53 -08001231
Eric Salo8809a112022-11-21 13:01:06 -08001232UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; }
1233
Mike Kruskal04e81352022-11-23 11:07:53 -08001234uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed);
1235
Eric Salo8809a112022-11-21 13:01:06 -08001236#ifdef __cplusplus
1237} /* extern "C" */
1238#endif
1239
1240
1241#endif /* UPB_HASH_COMMON_H_ */
1242
1243// Must be last.
1244
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001245typedef struct {
1246 upb_table t;
1247} upb_strtable;
1248
Eric Salo8809a112022-11-21 13:01:06 -08001249#ifdef __cplusplus
1250extern "C" {
1251#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001252
Eric Salo8809a112022-11-21 13:01:06 -08001253// Initialize a table. If memory allocation failed, false is returned and
1254// the table is uninitialized.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001255bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001256
Eric Salo8809a112022-11-21 13:01:06 -08001257// Returns the number of values in the table.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001258UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001259 return t->t.count;
1260}
1261
Joshua Habermanf41049a2022-01-21 14:41:25 -08001262void upb_strtable_clear(upb_strtable* t);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001263
Eric Salo8809a112022-11-21 13:01:06 -08001264// Inserts the given key into the hashtable with the given value.
1265// The key must not already exist in the hash table. The key is not required
1266// to be NULL-terminated, and the table will make an internal copy of the key.
1267//
1268// If a table resize was required but memory allocation failed, false is
1269// returned and the table is unchanged. */
Joshua Habermanf41049a2022-01-21 14:41:25 -08001270bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len,
1271 upb_value val, upb_Arena* a);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001272
Eric Salo8809a112022-11-21 13:01:06 -08001273// Looks up key in this table, returning "true" if the key was found.
1274// If v is non-NULL, copies the value for this key into *v.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001275bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len,
1276 upb_value* v);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001277
Eric Salo8809a112022-11-21 13:01:06 -08001278// For NULL-terminated strings.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001279UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key,
1280 upb_value* v) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001281 return upb_strtable_lookup2(t, key, strlen(key), v);
1282}
1283
Eric Salo8809a112022-11-21 13:01:06 -08001284// Removes an item from the table. Returns true if the remove was successful,
1285// and stores the removed item in *val if non-NULL.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001286bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len,
1287 upb_value* val);
1288
1289UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key,
1290 upb_value* v) {
1291 return upb_strtable_remove2(t, key, strlen(key), v);
1292}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001293
Eric Salo8809a112022-11-21 13:01:06 -08001294// Exposed for testing only.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001295bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001296
Eric Salo8809a112022-11-21 13:01:06 -08001297/* Iteration over strtable:
Joshua Habermanf41049a2022-01-21 14:41:25 -08001298 *
Eric Salo8809a112022-11-21 13:01:06 -08001299 * intptr_t iter = UPB_STRTABLE_BEGIN;
Joshua Habermanf41049a2022-01-21 14:41:25 -08001300 * upb_StringView key;
1301 * upb_value val;
1302 * while (upb_strtable_next2(t, &key, &val, &iter)) {
1303 * // ...
1304 * }
1305 */
1306
1307#define UPB_STRTABLE_BEGIN -1
1308
1309bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key,
1310 upb_value* val, intptr_t* iter);
1311void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter);
Jie Luo3560e232023-06-12 00:33:50 -07001312void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v);
Joshua Habermanf41049a2022-01-21 14:41:25 -08001313
1314/* DEPRECATED iterators, slated for removal.
1315 *
Eric Salo8809a112022-11-21 13:01:06 -08001316 * Iterators for string tables. We are subject to some kind of unusual
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001317 * design constraints:
1318 *
1319 * For high-level languages:
1320 * - we must be able to guarantee that we don't crash or corrupt memory even if
1321 * the program accesses an invalidated iterator.
1322 *
1323 * For C++11 range-based for:
1324 * - iterators must be copyable
1325 * - iterators must be comparable
1326 * - it must be possible to construct an "end" value.
1327 *
1328 * Iteration order is undefined.
1329 *
1330 * Modifying the table invalidates iterators. upb_{str,int}table_done() is
1331 * guaranteed to work even on an invalidated iterator, as long as the table it
1332 * is iterating over has not been freed. Calling next() or accessing data from
1333 * an invalidated iterator yields unspecified elements from the table, but it is
1334 * guaranteed not to crash and to return real table elements (except when done()
1335 * is true). */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001336/* upb_strtable_iter **********************************************************/
1337
1338/* upb_strtable_iter i;
1339 * upb_strtable_begin(&i, t);
1340 * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
1341 * const char *key = upb_strtable_iter_key(&i);
1342 * const upb_value val = upb_strtable_iter_value(&i);
1343 * // ...
1344 * }
1345 */
1346
1347typedef struct {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001348 const upb_strtable* t;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001349 size_t index;
1350} upb_strtable_iter;
1351
Eric Salo8809a112022-11-21 13:01:06 -08001352UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) {
1353 return &i->t->t.entries[i->index];
1354}
1355
Joshua Habermanf41049a2022-01-21 14:41:25 -08001356void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t);
1357void upb_strtable_next(upb_strtable_iter* i);
1358bool upb_strtable_done(const upb_strtable_iter* i);
1359upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i);
1360upb_value upb_strtable_iter_value(const upb_strtable_iter* i);
1361void upb_strtable_iter_setdone(upb_strtable_iter* i);
1362bool upb_strtable_iter_isequal(const upb_strtable_iter* i1,
1363 const upb_strtable_iter* i2);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001364
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001365#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08001366} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001367#endif
1368
1369
Eric Salo8809a112022-11-21 13:01:06 -08001370#endif /* UPB_HASH_STR_TABLE_H_ */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001371
Joshua Habermand3995ec2022-09-30 16:54:39 -07001372// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001373
Joshua Habermand3995ec2022-09-30 16:54:39 -07001374struct upb_Map {
Eric Salo8809a112022-11-21 13:01:06 -08001375 // Size of key and val, based on the map type.
1376 // Strings are represented as '0' because they must be handled specially.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001377 char key_size;
1378 char val_size;
1379
1380 upb_strtable table;
Joshua Habermand3995ec2022-09-30 16:54:39 -07001381};
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001382
Eric Salo8809a112022-11-21 13:01:06 -08001383#ifdef __cplusplus
1384extern "C" {
1385#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001386
Eric Salo8809a112022-11-21 13:01:06 -08001387// Converting between internal table representation and user values.
1388//
1389// _upb_map_tokey() and _upb_map_fromkey() are inverses.
1390// _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
1391//
1392// These functions account for the fact that strings are treated differently
1393// from other types when stored in a map.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001394
Joshua Habermanf41049a2022-01-21 14:41:25 -08001395UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001396 if (size == UPB_MAPTYPE_STRING) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001397 return *(upb_StringView*)key;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001398 } else {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001399 return upb_StringView_FromDataAndSize((const char*)key, size);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001400 }
1401}
1402
Joshua Habermanf41049a2022-01-21 14:41:25 -08001403UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001404 if (size == UPB_MAPTYPE_STRING) {
1405 memcpy(out, &key, sizeof(key));
1406 } else {
1407 memcpy(out, key.data, size);
1408 }
1409}
1410
Joshua Habermanf41049a2022-01-21 14:41:25 -08001411UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size,
1412 upb_value* msgval, upb_Arena* a) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001413 if (size == UPB_MAPTYPE_STRING) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001414 upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001415 if (!strp) return false;
Joshua Habermanf41049a2022-01-21 14:41:25 -08001416 *strp = *(upb_StringView*)val;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001417 *msgval = upb_value_ptr(strp);
1418 } else {
1419 memcpy(msgval, val, size);
1420 }
1421 return true;
1422}
1423
1424UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
1425 if (size == UPB_MAPTYPE_STRING) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001426 const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val);
1427 memcpy(out, strp, sizeof(upb_StringView));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001428 } else {
1429 memcpy(out, &val, size);
1430 }
1431}
1432
Eric Salo8809a112022-11-21 13:01:06 -08001433UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) {
1434 upb_strtable_iter it;
1435 it.t = &map->table;
1436 it.index = *iter;
1437 upb_strtable_next(&it);
1438 *iter = it.index;
1439 if (upb_strtable_done(&it)) return NULL;
1440 return (void*)str_tabent(&it);
1441}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001442
Eric Salo8809a112022-11-21 13:01:06 -08001443UPB_INLINE void _upb_Map_Clear(upb_Map* map) {
1444 upb_strtable_clear(&map->table);
1445}
1446
Eric Salob598b2d2022-12-22 23:14:27 -08001447UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size,
1448 upb_value* val) {
Eric Salo8809a112022-11-21 13:01:06 -08001449 upb_StringView k = _upb_map_tokey(key, key_size);
Eric Salob598b2d2022-12-22 23:14:27 -08001450 return upb_strtable_remove2(&map->table, k.data, k.size, val);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001451}
1452
Joshua Habermanf41049a2022-01-21 14:41:25 -08001453UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key,
1454 size_t key_size, void* val, size_t val_size) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001455 upb_value tabval;
Joshua Habermanf41049a2022-01-21 14:41:25 -08001456 upb_StringView k = _upb_map_tokey(key, key_size);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001457 bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
1458 if (ret && val) {
1459 _upb_map_fromvalue(tabval, val, val_size);
1460 }
1461 return ret;
1462}
1463
Eric Salo8809a112022-11-21 13:01:06 -08001464UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key,
1465 size_t key_size, void* val,
1466 size_t val_size, upb_Arena* a) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001467 upb_StringView strkey = _upb_map_tokey(key, key_size);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001468 upb_value tabval = {0};
Joshua Habermand3995ec2022-09-30 16:54:39 -07001469 if (!_upb_map_tovalue(val, val_size, &tabval, a)) {
Eric Salo8809a112022-11-21 13:01:06 -08001470 return kUpb_MapInsertStatus_OutOfMemory;
Joshua Habermand3995ec2022-09-30 16:54:39 -07001471 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001472
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00001473 // TODO: add overwrite operation to minimize number of lookups.
Joshua Habermand3995ec2022-09-30 16:54:39 -07001474 bool removed =
1475 upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL);
1476 if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) {
Eric Salo8809a112022-11-21 13:01:06 -08001477 return kUpb_MapInsertStatus_OutOfMemory;
Joshua Habermand3995ec2022-09-30 16:54:39 -07001478 }
Eric Salo8809a112022-11-21 13:01:06 -08001479 return removed ? kUpb_MapInsertStatus_Replaced
1480 : kUpb_MapInsertStatus_Inserted;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001481}
1482
Eric Salo8809a112022-11-21 13:01:06 -08001483UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) {
1484 return map->table.t.count;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001485}
1486
Eric Salob7d54ac2022-12-29 11:59:42 -08001487// Strings/bytes are special-cased in maps.
1488extern char _upb_Map_CTypeSizeTable[12];
1489
1490UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) {
1491 return _upb_Map_CTypeSizeTable[ctype];
1492}
1493
Eric Salo8809a112022-11-21 13:01:06 -08001494// Creates a new map on the given arena with this key/value type.
1495upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
1496
1497#ifdef __cplusplus
1498} /* extern "C" */
1499#endif
1500
1501
Adam Cozzette8059da22023-08-16 07:57:14 -07001502#endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */
Mike Kruskal3bc50492022-12-01 13:34:12 -08001503
1504// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
1505
Adam Cozzette8059da22023-08-16 07:57:14 -07001506#ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
1507#define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
Mike Kruskal3bc50492022-12-01 13:34:12 -08001508
1509#include <stdlib.h>
1510
1511
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00001512#ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
1513#define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
1514
1515
1516#ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_
1517#define UPB_MINI_TABLE_INTERNAL_TYPES_H_
1518
1519typedef struct upb_Message_InternalData upb_Message_InternalData;
1520
1521typedef struct {
1522 union {
1523 upb_Message_InternalData* internal;
1524
1525 // Force 8-byte alignment, since the data members may contain members that
1526 // require 8-byte alignment.
1527 double d;
1528 };
1529} upb_Message_Internal;
1530
1531#endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_
1532
1533// Map entries aren't actually stored for map fields, they are only used during
1534// parsing. For parsing, it helps a lot if all map entry messages have the same
1535// layout. The layout code in mini_table/decode.c will ensure that all map
1536// entries have this layout.
1537//
1538// Note that users can and do create map entries directly, which will also use
1539// this layout.
1540//
1541// NOTE: sync with wire/decode.c.
1542typedef struct {
1543 // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
1544 // and the uint64_t helps make this clear.
1545 uint64_t hasbits;
1546 union {
1547 upb_StringView str; // For str/bytes.
1548 upb_value val; // For all other types.
1549 } k;
1550 union {
1551 upb_StringView str; // For str/bytes.
1552 upb_value val; // For all other types.
1553 } v;
1554} upb_MapEntryData;
1555
1556typedef struct {
1557 upb_Message_Internal internal;
1558 upb_MapEntryData data;
1559} upb_MapEntry;
1560
1561#endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
1562
Adam Cozzette8059da22023-08-16 07:57:14 -07001563#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
1564#define UPB_MESSAGE_INTERNAL_EXTENSION_H_
Mike Kruskal3bc50492022-12-01 13:34:12 -08001565
1566
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07001567// Public APIs for message operations that do not depend on the schema.
Eric Salo8809a112022-11-21 13:01:06 -08001568//
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07001569// MiniTable-based accessors live in accessors.h.
Eric Salo8809a112022-11-21 13:01:06 -08001570
1571#ifndef UPB_MESSAGE_MESSAGE_H_
1572#define UPB_MESSAGE_MESSAGE_H_
1573
Protobuf Team Bot75af7f92023-09-06 18:07:53 +00001574#include <stddef.h>
1575
Eric Salo8809a112022-11-21 13:01:06 -08001576
Protobuf Team Bot473d20d2023-09-15 22:27:16 +00001577#ifndef UPB_MINI_TABLE_MESSAGE_H_
1578#define UPB_MINI_TABLE_MESSAGE_H_
1579
1580
1581#ifndef UPB_MINI_TABLE_ENUM_H_
1582#define UPB_MINI_TABLE_ENUM_H_
1583
1584
1585#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
1586#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
1587
1588#include <stdint.h>
1589
1590// Must be last.
1591
1592struct upb_MiniTableEnum {
1593 uint32_t mask_limit; // Limit enum value that can be tested with mask.
1594 uint32_t value_count; // Number of values after the bitfield.
1595 uint32_t data[]; // Bitmask + enumerated values follow.
1596};
1597
1598typedef enum {
1599 _kUpb_FastEnumCheck_ValueIsInEnum = 0,
1600 _kUpb_FastEnumCheck_ValueIsNotInEnum = 1,
1601 _kUpb_FastEnumCheck_CannotCheckFast = 2,
1602} _kUpb_FastEnumCheck_Status;
1603
1604#ifdef __cplusplus
1605extern "C" {
1606#endif
1607
1608UPB_INLINE _kUpb_FastEnumCheck_Status _upb_MiniTable_CheckEnumValueFast(
1609 const struct upb_MiniTableEnum* e, uint32_t val) {
1610 if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast;
1611 uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32);
1612 return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum
1613 : _kUpb_FastEnumCheck_ValueIsNotInEnum;
1614}
1615
1616UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow(
1617 const struct upb_MiniTableEnum* e, uint32_t val) {
1618 if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32));
1619 // OPT: binary search long lists?
1620 const uint32_t* start = &e->data[e->mask_limit / 32];
1621 const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count];
1622 for (const uint32_t* p = start; p < limit; p++) {
1623 if (*p == val) return true;
1624 }
1625 return false;
1626}
1627
1628#ifdef __cplusplus
1629} /* extern "C" */
1630#endif
1631
1632
1633#endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */
1634
1635// Must be last
1636
1637typedef struct upb_MiniTableEnum upb_MiniTableEnum;
1638
1639// Validates enum value against range defined by enum mini table.
1640UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e,
1641 uint32_t val) {
1642 _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val);
1643 if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) {
1644 return _upb_MiniTable_CheckEnumValueSlow(e, val);
1645 }
1646 return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false;
1647}
1648
1649
1650#endif /* UPB_MINI_TABLE_ENUM_H_ */
1651
1652#ifndef UPB_MINI_TABLE_FIELD_H_
1653#define UPB_MINI_TABLE_FIELD_H_
1654
1655
1656#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
1657#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
1658
1659#include <stdint.h>
1660
1661
1662// Must be last.
1663
1664struct upb_MiniTableField {
1665 uint32_t number;
1666 uint16_t offset;
1667 int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index
1668
1669 // Indexes into `upb_MiniTable.subs`
1670 // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM
1671 uint16_t UPB_PRIVATE(submsg_index);
1672
1673 uint8_t UPB_PRIVATE(descriptortype);
1674
1675 // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift)
1676 uint8_t mode;
1677};
1678
1679#define kUpb_NoSub ((uint16_t)-1)
1680
1681typedef enum {
1682 kUpb_FieldMode_Map = 0,
1683 kUpb_FieldMode_Array = 1,
1684 kUpb_FieldMode_Scalar = 2,
1685} upb_FieldMode;
1686
1687// Mask to isolate the upb_FieldMode from field.mode.
1688#define kUpb_FieldMode_Mask 3
1689
1690// Extra flags on the mode field.
1691typedef enum {
1692 kUpb_LabelFlags_IsPacked = 4,
1693 kUpb_LabelFlags_IsExtension = 8,
1694 // Indicates that this descriptor type is an "alternate type":
1695 // - for Int32, this indicates that the actual type is Enum (but was
1696 // rewritten to Int32 because it is an open enum that requires no check).
1697 // - for Bytes, this indicates that the actual type is String (but does
1698 // not require any UTF-8 check).
1699 kUpb_LabelFlags_IsAlternate = 16,
1700} upb_LabelFlags;
1701
1702// Note: we sort by this number when calculating layout order.
1703typedef enum {
1704 kUpb_FieldRep_1Byte = 0,
1705 kUpb_FieldRep_4Byte = 1,
1706 kUpb_FieldRep_StringView = 2,
1707 kUpb_FieldRep_8Byte = 3,
1708
1709 kUpb_FieldRep_NativePointer =
1710 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte),
1711 kUpb_FieldRep_Max = kUpb_FieldRep_8Byte,
1712} upb_FieldRep;
1713
1714#define kUpb_FieldRep_Shift 6
1715
1716UPB_INLINE upb_FieldRep
1717_upb_MiniTableField_GetRep(const struct upb_MiniTableField* field) {
1718 return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift);
1719}
1720
1721#ifdef __cplusplus
1722extern "C" {
1723#endif
1724
1725UPB_INLINE upb_FieldMode
1726upb_FieldMode_Get(const struct upb_MiniTableField* field) {
1727 return (upb_FieldMode)(field->mode & 3);
1728}
1729
1730UPB_INLINE void _upb_MiniTableField_CheckIsArray(
1731 const struct upb_MiniTableField* field) {
1732 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer);
1733 UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array);
1734 UPB_ASSUME(field->presence == 0);
1735}
1736
1737UPB_INLINE void _upb_MiniTableField_CheckIsMap(
1738 const struct upb_MiniTableField* field) {
1739 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer);
1740 UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map);
1741 UPB_ASSUME(field->presence == 0);
1742}
1743
1744UPB_INLINE bool upb_IsRepeatedOrMap(const struct upb_MiniTableField* field) {
1745 // This works because upb_FieldMode has no value 3.
1746 return !(field->mode & kUpb_FieldMode_Scalar);
1747}
1748
1749UPB_INLINE bool upb_IsSubMessage(const struct upb_MiniTableField* field) {
1750 return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message ||
1751 field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group;
1752}
1753
1754#ifdef __cplusplus
1755} /* extern "C" */
1756#endif
1757
1758
1759#endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */
1760
1761#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1762#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1763
1764
1765// Must be last.
1766
1767struct upb_Decoder;
1768typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr,
1769 upb_Message* msg, intptr_t table,
1770 uint64_t hasbits, uint64_t data);
1771typedef struct {
1772 uint64_t field_data;
1773 _upb_FieldParser* field_parser;
1774} _upb_FastTable_Entry;
1775
1776typedef enum {
1777 kUpb_ExtMode_NonExtendable = 0, // Non-extendable message.
1778 kUpb_ExtMode_Extendable = 1, // Normal extendable message.
1779 kUpb_ExtMode_IsMessageSet = 2, // MessageSet message.
1780 kUpb_ExtMode_IsMessageSet_ITEM =
1781 3, // MessageSet item (temporary only, see decode.c)
1782
1783 // During table building we steal a bit to indicate that the message is a map
1784 // entry. *Only* used during table building!
1785 kUpb_ExtMode_IsMapEntry = 4,
1786} upb_ExtMode;
1787
1788union upb_MiniTableSub;
1789
1790// upb_MiniTable represents the memory layout of a given upb_MessageDef.
1791// The members are public so generated code can initialize them,
1792// but users MUST NOT directly read or write any of its members.
1793struct upb_MiniTable {
1794 const union upb_MiniTableSub* subs;
1795 const struct upb_MiniTableField* fields;
1796
1797 // Must be aligned to sizeof(void*). Doesn't include internal members like
1798 // unknown fields, extension dict, pointer to msglayout, etc.
1799 uint16_t size;
1800
1801 uint16_t field_count;
1802 uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1
1803 uint8_t dense_below;
1804 uint8_t table_mask;
1805 uint8_t required_count; // Required fields have the lowest hasbits.
1806
1807 // To statically initialize the tables of variable length, we need a flexible
1808 // array member, and we need to compile in gnu99 mode (constant initialization
1809 // of flexible array members is a GNU extension, not in C99 unfortunately.
1810 _upb_FastTable_Entry fasttable[];
1811};
1812
1813#ifdef __cplusplus
1814extern "C" {
1815#endif
1816
1817// A MiniTable for an empty message, used for unlinked sub-messages.
1818extern const struct upb_MiniTable _kUpb_MiniTable_Empty;
1819
1820// Computes a bitmask in which the |l->required_count| lowest bits are set,
1821// except that we skip the lowest bit (because upb never uses hasbit 0).
1822//
1823// Sample output:
1824// requiredmask(1) => 0b10 (0x2)
1825// requiredmask(5) => 0b111110 (0x3e)
1826UPB_INLINE uint64_t upb_MiniTable_requiredmask(const struct upb_MiniTable* l) {
1827 int n = l->required_count;
1828 assert(0 < n && n <= 63);
1829 return ((1ULL << n) - 1) << 1;
1830}
1831
1832#ifdef __cplusplus
1833} /* extern "C" */
1834#endif
1835
1836
1837#endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */
1838
1839#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_
1840#define UPB_MINI_TABLE_INTERNAL_SUB_H_
1841
1842
1843union upb_MiniTableSub {
1844 const struct upb_MiniTable* submsg;
1845 const struct upb_MiniTableEnum* subenum;
1846};
1847
1848#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
1849
1850// Must be last.
1851
1852#ifdef __cplusplus
1853extern "C" {
1854#endif
1855
1856typedef struct upb_MiniTableField upb_MiniTableField;
1857
1858UPB_API_INLINE upb_FieldType
1859upb_MiniTableField_Type(const upb_MiniTableField* field) {
1860 if (field->mode & kUpb_LabelFlags_IsAlternate) {
1861 if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) {
1862 return kUpb_FieldType_Enum;
1863 } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) {
1864 return kUpb_FieldType_String;
1865 } else {
1866 UPB_ASSERT(false);
1867 }
1868 }
1869 return (upb_FieldType)field->UPB_PRIVATE(descriptortype);
1870}
1871
1872UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) {
1873 switch (upb_MiniTableField_Type(f)) {
1874 case kUpb_FieldType_Double:
1875 return kUpb_CType_Double;
1876 case kUpb_FieldType_Float:
1877 return kUpb_CType_Float;
1878 case kUpb_FieldType_Int64:
1879 case kUpb_FieldType_SInt64:
1880 case kUpb_FieldType_SFixed64:
1881 return kUpb_CType_Int64;
1882 case kUpb_FieldType_Int32:
1883 case kUpb_FieldType_SFixed32:
1884 case kUpb_FieldType_SInt32:
1885 return kUpb_CType_Int32;
1886 case kUpb_FieldType_UInt64:
1887 case kUpb_FieldType_Fixed64:
1888 return kUpb_CType_UInt64;
1889 case kUpb_FieldType_UInt32:
1890 case kUpb_FieldType_Fixed32:
1891 return kUpb_CType_UInt32;
1892 case kUpb_FieldType_Enum:
1893 return kUpb_CType_Enum;
1894 case kUpb_FieldType_Bool:
1895 return kUpb_CType_Bool;
1896 case kUpb_FieldType_String:
1897 return kUpb_CType_String;
1898 case kUpb_FieldType_Bytes:
1899 return kUpb_CType_Bytes;
1900 case kUpb_FieldType_Group:
1901 case kUpb_FieldType_Message:
1902 return kUpb_CType_Message;
1903 }
1904 UPB_UNREACHABLE();
1905}
1906
1907UPB_API_INLINE bool upb_MiniTableField_IsExtension(
1908 const upb_MiniTableField* field) {
1909 return field->mode & kUpb_LabelFlags_IsExtension;
1910}
1911
1912UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
1913 const upb_MiniTableField* field) {
1914 return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum;
1915}
1916
1917UPB_API_INLINE bool upb_MiniTableField_HasPresence(
1918 const upb_MiniTableField* field) {
1919 if (upb_MiniTableField_IsExtension(field)) {
1920 return !upb_IsRepeatedOrMap(field);
1921 } else {
1922 return field->presence != 0;
1923 }
1924}
1925
1926#ifdef __cplusplus
1927} /* extern "C" */
1928#endif
1929
1930
1931#endif /* UPB_MINI_TABLE_FIELD_H_ */
1932
1933// Must be last.
1934
1935#ifdef __cplusplus
1936extern "C" {
1937#endif
1938
1939typedef struct upb_MiniTable upb_MiniTable;
1940
1941UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
1942 const upb_MiniTable* table, uint32_t number);
1943
1944UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
1945 const upb_MiniTable* t, uint32_t index) {
1946 return &t->fields[index];
1947}
1948
1949// Returns the MiniTable for this message field. If the field is unlinked,
1950// returns NULL.
1951UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
1952 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1953 UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message);
1954 const upb_MiniTable* ret =
1955 mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
1956 UPB_ASSUME(ret);
1957 return ret == &_kUpb_MiniTable_Empty ? NULL : ret;
1958}
1959
1960// Returns the MiniTableEnum for this enum field. If the field is unlinked,
1961// returns NULL.
1962UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
1963 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1964 UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum);
1965 return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum;
1966}
1967
1968// Returns true if this MiniTable field is linked to a MiniTable for the
1969// sub-message.
1970UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
1971 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1972 return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL;
1973}
1974
1975// If this field is in a oneof, returns the first field in the oneof.
1976//
1977// Otherwise returns NULL.
1978//
1979// Usage:
1980// const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f);
1981// do {
1982// ..
1983// } while (upb_MiniTable_NextOneofField(m, &field);
1984//
1985const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m,
1986 const upb_MiniTableField* f);
1987
1988// Iterates to the next field in the oneof. If this is the last field in the
1989// oneof, returns false. The ordering of fields in the oneof is not
1990// guaranteed.
1991// REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated
1992// by prior upb_MiniTable_NextOneofField calls.
1993bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
1994 const upb_MiniTableField** f);
1995
1996#ifdef __cplusplus
1997} /* extern "C" */
1998#endif
1999
2000
2001#endif /* UPB_MINI_TABLE_MESSAGE_H_ */
2002
Eric Salo8809a112022-11-21 13:01:06 -08002003// Must be last.
2004
2005#ifdef __cplusplus
2006extern "C" {
2007#endif
2008
2009// Creates a new message with the given mini_table on the given arena.
Eric Salo10505992022-12-12 12:16:36 -08002010UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table,
2011 upb_Arena* arena);
Eric Salo8809a112022-11-21 13:01:06 -08002012
2013// Adds unknown data (serialized protobuf data) to the given message.
2014// The data is copied into the message instance.
2015void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
2016 upb_Arena* arena);
2017
2018// Returns a reference to the message's unknown data.
2019const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len);
2020
2021// Removes partial unknown data from message.
2022void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len);
2023
2024// Returns the number of extensions present in this message.
2025size_t upb_Message_ExtensionCount(const upb_Message* msg);
2026
2027#ifdef __cplusplus
2028} /* extern "C" */
2029#endif
2030
2031
2032#endif /* UPB_MESSAGE_MESSAGE_H_ */
2033
Mike Kruskal9d435022023-07-11 12:45:07 -07002034#ifndef UPB_MINI_TABLE_EXTENSION_H_
2035#define UPB_MINI_TABLE_EXTENSION_H_
Eric Salo8809a112022-11-21 13:01:06 -08002036
2037
Mike Kruskal9d435022023-07-11 12:45:07 -07002038#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
2039#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
Eric Salo8809a112022-11-21 13:01:06 -08002040
2041
2042// Must be last.
2043
Eric Salo8809a112022-11-21 13:01:06 -08002044struct upb_MiniTableExtension {
Deanna Garcia59cfc2f2023-01-31 13:19:28 -08002045 // Do not move this field. We need to be able to alias pointers.
Mike Kruskal9d435022023-07-11 12:45:07 -07002046 struct upb_MiniTableField field;
Deanna Garcia59cfc2f2023-01-31 13:19:28 -08002047
Mike Kruskal9d435022023-07-11 12:45:07 -07002048 const struct upb_MiniTable* extendee;
2049 union upb_MiniTableSub sub; // NULL unless submessage or proto2 enum
Eric Salo8809a112022-11-21 13:01:06 -08002050};
2051
2052
Mike Kruskal9d435022023-07-11 12:45:07 -07002053#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */
2054
2055// Must be last.
2056
2057typedef struct upb_MiniTableExtension upb_MiniTableExtension;
2058
2059
2060#endif /* UPB_MINI_TABLE_EXTENSION_H_ */
Eric Salo8809a112022-11-21 13:01:06 -08002061
2062// Must be last.
2063
2064// The internal representation of an extension is self-describing: it contains
2065// enough information that we can serialize it to binary format without needing
2066// to look it up in a upb_ExtensionRegistry.
2067//
2068// This representation allocates 16 bytes to data on 64-bit platforms.
2069// This is rather wasteful for scalars (in the extreme case of bool,
2070// it wastes 15 bytes). We accept this because we expect messages to be
2071// the most common extension type.
2072typedef struct {
2073 const upb_MiniTableExtension* ext;
2074 union {
2075 upb_StringView str;
2076 void* ptr;
2077 char scalar_data[8];
2078 } data;
2079} upb_Message_Extension;
2080
2081#ifdef __cplusplus
2082extern "C" {
2083#endif
2084
2085// Adds the given extension data to the given message.
2086// |ext| is copied into the message instance.
2087// This logically replaces any previously-added extension with this number.
2088upb_Message_Extension* _upb_Message_GetOrCreateExtension(
2089 upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena);
2090
2091// Returns an array of extensions for this message.
2092// Note: the array is ordered in reverse relative to the order of creation.
2093const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg,
2094 size_t* count);
2095
2096// Returns an extension for the given field number, or NULL if no extension
2097// exists for this field number.
2098const upb_Message_Extension* _upb_Message_Getext(
2099 const upb_Message* msg, const upb_MiniTableExtension* ext);
2100
Eric Salo8809a112022-11-21 13:01:06 -08002101#ifdef __cplusplus
2102} /* extern "C" */
2103#endif
2104
2105
Adam Cozzette8059da22023-08-16 07:57:14 -07002106#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */
Eric Salo8809a112022-11-21 13:01:06 -08002107
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002108// Must be last.
2109
2110#ifdef __cplusplus
2111extern "C" {
2112#endif
2113
2114// _upb_mapsorter sorts maps and provides ordered iteration over the entries.
2115// Since maps can be recursive (map values can be messages which contain other
2116// maps), _upb_mapsorter can contain a stack of maps.
2117
2118typedef struct {
2119 void const** entries;
2120 int size;
2121 int cap;
2122} _upb_mapsorter;
2123
2124typedef struct {
2125 int start;
2126 int pos;
2127 int end;
2128} _upb_sortedmap;
2129
2130UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) {
2131 s->entries = NULL;
2132 s->size = 0;
2133 s->cap = 0;
2134}
2135
2136UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) {
2137 if (s->entries) free(s->entries);
2138}
2139
2140UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map,
2141 _upb_sortedmap* sorted, upb_MapEntry* ent) {
2142 if (sorted->pos == sorted->end) return false;
2143 const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++];
2144 upb_StringView key = upb_tabstrview(tabent->key);
2145 _upb_map_fromkey(key, &ent->data.k, map->key_size);
2146 upb_value val = {tabent->val.val};
2147 _upb_map_fromvalue(val, &ent->data.v, map->val_size);
2148 return true;
2149}
2150
2151UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s,
2152 _upb_sortedmap* sorted,
2153 const upb_Message_Extension** ext) {
2154 if (sorted->pos == sorted->end) return false;
2155 *ext = (const upb_Message_Extension*)s->entries[sorted->pos++];
2156 return true;
2157}
2158
2159UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s,
2160 _upb_sortedmap* sorted) {
2161 s->size = sorted->start;
2162}
2163
2164bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
2165 const upb_Map* map, _upb_sortedmap* sorted);
2166
2167bool _upb_mapsorter_pushexts(_upb_mapsorter* s,
2168 const upb_Message_Extension* exts, size_t count,
2169 _upb_sortedmap* sorted);
2170
2171#ifdef __cplusplus
2172} /* extern "C" */
2173#endif
2174
2175
Adam Cozzette8059da22023-08-16 07:57:14 -07002176#endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */
2177
Protobuf Team Bot47b9a672023-09-13 05:06:49 +00002178#ifndef UPB_BASE_INTERNAL_LOG2_H_
2179#define UPB_BASE_INTERNAL_LOG2_H_
Adam Cozzette8059da22023-08-16 07:57:14 -07002180
2181// Must be last.
2182
2183#ifdef __cplusplus
2184extern "C" {
2185#endif
2186
2187UPB_INLINE int upb_Log2Ceiling(int x) {
2188 if (x <= 1) return 0;
2189#ifdef __GNUC__
2190 return 32 - __builtin_clz(x - 1);
2191#else
2192 int lg2 = 0;
2193 while ((1 << lg2) < x) lg2++;
2194 return lg2;
2195#endif
2196}
2197
2198UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
2199
2200#ifdef __cplusplus
2201} /* extern "C" */
2202#endif
2203
2204
Protobuf Team Bot47b9a672023-09-13 05:06:49 +00002205#endif /* UPB_BASE_INTERNAL_LOG2_H_ */
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002206
Mike Kruskal9d435022023-07-11 12:45:07 -07002207#ifndef UPB_GENERATED_CODE_SUPPORT_H_
2208#define UPB_GENERATED_CODE_SUPPORT_H_
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002209
Mike Kruskal9d435022023-07-11 12:45:07 -07002210// IWYU pragma: begin_exports
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002211
Mike Kruskal9d435022023-07-11 12:45:07 -07002212// These functions are only used by generated code.
2213
2214#ifndef UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_
2215#define UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_
2216
2217
2218// Must be last.
2219
2220#ifdef __cplusplus
2221extern "C" {
2222#endif
2223
2224// Message map operations, these get the map from the message first.
2225
2226UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
2227 const upb_tabent* ent = (const upb_tabent*)msg;
2228 uint32_t u32len;
2229 upb_StringView k;
2230 k.data = upb_tabstr(ent->key, &u32len);
2231 k.size = u32len;
2232 _upb_map_fromkey(k, key, size);
2233}
2234
2235UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
2236 const upb_tabent* ent = (const upb_tabent*)msg;
2237 upb_value v = {ent->val.val};
2238 _upb_map_fromvalue(v, val, size);
2239}
2240
2241UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
2242 size_t size) {
2243 upb_tabent* ent = (upb_tabent*)msg;
2244 // This is like _upb_map_tovalue() except the entry already exists
2245 // so we can reuse the allocated upb_StringView for string fields.
2246 if (size == UPB_MAPTYPE_STRING) {
2247 upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val;
2248 memcpy(strp, val, sizeof(*strp));
2249 } else {
2250 memcpy(&ent->val.val, val, size);
2251 }
2252}
2253
2254#ifdef __cplusplus
2255} /* extern "C" */
2256#endif
2257
2258
2259#endif /* UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ */
2260
Sandy Zhange3b09432023-08-07 09:30:02 -07002261#ifndef UPB_MESSAGE_ACCESSORS_H_
2262#define UPB_MESSAGE_ACCESSORS_H_
Mike Kruskal9d435022023-07-11 12:45:07 -07002263
Sandy Zhange3b09432023-08-07 09:30:02 -07002264
Adam Cozzette8059da22023-08-16 07:57:14 -07002265#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
2266#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
2267
2268
Sandy Zhange3b09432023-08-07 09:30:02 -07002269/*
2270** Our memory representation for parsing tables and messages themselves.
2271** Functions in this file are used by generated code and possibly reflection.
2272**
2273** The definitions in this file are internal to upb.
2274**/
2275
2276#ifndef UPB_MESSAGE_INTERNAL_H_
2277#define UPB_MESSAGE_INTERNAL_H_
2278
2279#include <stdlib.h>
2280#include <string.h>
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002281
2282
Mike Kruskal3bc50492022-12-01 13:34:12 -08002283#ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
2284#define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
2285
2286
2287// Must be last.
2288
2289#ifdef __cplusplus
2290extern "C" {
2291#endif
2292
2293/* Extension registry: a dynamic data structure that stores a map of:
2294 * (upb_MiniTable, number) -> extension info
2295 *
2296 * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing
2297 * binary format.
2298 *
2299 * upb_ExtensionRegistry is part of the mini-table (msglayout) family of
2300 * objects. Like all mini-table objects, it is suitable for reflection-less
2301 * builds that do not want to expose names into the binary.
2302 *
2303 * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory
2304 * allocation and dynamic initialization:
2305 * * If reflection is being used, then upb_DefPool will construct an appropriate
2306 * upb_ExtensionRegistry automatically.
2307 * * For a mini-table only build, the user must manually construct the
2308 * upb_ExtensionRegistry and populate it with all of the extensions the user
2309 * cares about.
2310 * * A third alternative is to manually unpack relevant extensions after the
2311 * main parse is complete, similar to how Any works. This is perhaps the
2312 * nicest solution from the perspective of reducing dependencies, avoiding
2313 * dynamic memory allocation, and avoiding the need to parse uninteresting
2314 * extensions. The downsides are:
2315 * (1) parse errors are not caught during the main parse
2316 * (2) the CPU hit of parsing comes during access, which could cause an
2317 * undesirable stutter in application performance.
2318 *
2319 * Users cannot directly get or put into this map. Users can only add the
2320 * extensions from a generated module and pass the extension registry to the
2321 * binary decoder.
2322 *
2323 * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use
2324 * reflection do not need to populate a upb_ExtensionRegistry directly.
2325 */
2326
2327typedef struct upb_ExtensionRegistry upb_ExtensionRegistry;
2328
2329// Creates a upb_ExtensionRegistry in the given arena.
2330// The arena must outlive any use of the extreg.
Eric Salo10505992022-12-12 12:16:36 -08002331UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002332
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002333UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r,
2334 const upb_MiniTableExtension* e);
2335
Mike Kruskal3bc50492022-12-01 13:34:12 -08002336// Adds the given extension info for the array |e| of size |count| into the
2337// registry. If there are any errors, the entire array is backed out.
2338// The extensions must outlive the registry.
2339// Possible errors include OOM or an extension number that already exists.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00002340// TODO: There is currently no way to know the exact reason for failure.
Mike Kruskal3bc50492022-12-01 13:34:12 -08002341bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r,
2342 const upb_MiniTableExtension** e,
2343 size_t count);
2344
2345// Looks up the extension (if any) defined for message type |t| and field
2346// number |num|. Returns the extension if found, otherwise NULL.
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002347UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
Mike Kruskal3bc50492022-12-01 13:34:12 -08002348 const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num);
2349
2350#ifdef __cplusplus
2351} /* extern "C" */
2352#endif
2353
2354
2355#endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */
2356
Eric Salo8809a112022-11-21 13:01:06 -08002357// Must be last.
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002358
Eric Salo8809a112022-11-21 13:01:06 -08002359#ifdef __cplusplus
2360extern "C" {
2361#endif
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002362
Eric Salo8809a112022-11-21 13:01:06 -08002363extern const float kUpb_FltInfinity;
2364extern const double kUpb_Infinity;
2365extern const double kUpb_NaN;
2366
2367/* Internal members of a upb_Message that track unknown fields and/or
2368 * extensions. We can change this without breaking binary compatibility. We put
2369 * these before the user's data. The user's upb_Message* points after the
2370 * upb_Message_Internal. */
2371
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00002372struct upb_Message_InternalData {
Eric Salo8809a112022-11-21 13:01:06 -08002373 /* Total size of this structure, including the data that follows.
2374 * Must be aligned to 8, which is alignof(upb_Message_Extension) */
2375 uint32_t size;
2376
2377 /* Offsets relative to the beginning of this structure.
2378 *
2379 * Unknown data grows forward from the beginning to unknown_end.
2380 * Extension data grows backward from size to ext_begin.
2381 * When the two meet, we're out of data and have to realloc.
2382 *
2383 * If we imagine that the final member of this struct is:
2384 * char data[size - overhead]; // overhead =
2385 * sizeof(upb_Message_InternalData)
2386 *
2387 * Then we have:
2388 * unknown data: data[0 .. (unknown_end - overhead)]
2389 * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
2390 uint32_t unknown_end;
2391 uint32_t ext_begin;
2392 /* Data follows, as if there were an array:
2393 * char data[size - sizeof(upb_Message_InternalData)]; */
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00002394};
Eric Salo8809a112022-11-21 13:01:06 -08002395
2396/* Maps upb_CType -> memory size. */
2397extern char _upb_CTypeo_size[12];
2398
2399UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) {
2400 return t->size + sizeof(upb_Message_Internal);
2401}
2402
2403// Inline version upb_Message_New(), for internal use.
2404UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table,
2405 upb_Arena* arena) {
2406 size_t size = upb_msg_sizeof(mini_table);
2407 void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal));
2408 if (UPB_UNLIKELY(!mem)) return NULL;
2409 upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message);
2410 memset(mem, 0, size);
2411 return msg;
2412}
2413
2414UPB_INLINE upb_Message_Internal* upb_Message_Getinternal(
2415 const upb_Message* msg) {
2416 ptrdiff_t size = sizeof(upb_Message_Internal);
2417 return (upb_Message_Internal*)((char*)msg - size);
2418}
2419
Eric Salo8809a112022-11-21 13:01:06 -08002420// Discards the unknown fields for this message only.
2421void _upb_Message_DiscardUnknown_shallow(upb_Message* msg);
2422
2423// Adds unknown data (serialized protobuf data) to the given message.
2424// The data is copied into the message instance.
2425bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
2426 upb_Arena* arena);
2427
Eric Salo8809a112022-11-21 13:01:06 -08002428#ifdef __cplusplus
2429} /* extern "C" */
2430#endif
2431
2432
2433#endif /* UPB_MESSAGE_INTERNAL_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002434
Eric Salo8809a112022-11-21 13:01:06 -08002435// Must be last.
2436
Eric Salob7d54ac2022-12-29 11:59:42 -08002437#if defined(__GNUC__) && !defined(__clang__)
2438// GCC raises incorrect warnings in these functions. It thinks that we are
2439// overrunning buffers, but we carefully write the functions in this file to
2440// guarantee that this is impossible. GCC gets this wrong due it its failure
2441// to perform constant propagation as we expect:
2442// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217
2443// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226
2444//
2445// Unfortunately this also indicates that GCC is not optimizing away the
2446// switch() in cases where it should be, compromising the performance.
2447#pragma GCC diagnostic push
2448#pragma GCC diagnostic ignored "-Warray-bounds"
2449#pragma GCC diagnostic ignored "-Wstringop-overflow"
Mike Kruskal232ecf42023-01-14 00:09:40 -08002450#if __GNUC__ >= 11
Eric Salob7d54ac2022-12-29 11:59:42 -08002451#pragma GCC diagnostic ignored "-Wstringop-overread"
2452#endif
Mike Kruskal232ecf42023-01-14 00:09:40 -08002453#endif
Eric Salob7d54ac2022-12-29 11:59:42 -08002454
Eric Salo8809a112022-11-21 13:01:06 -08002455#ifdef __cplusplus
2456extern "C" {
2457#endif
2458
Mike Kruskal9d435022023-07-11 12:45:07 -07002459// LINT.IfChange(presence_logic)
2460
2461// Hasbit access ///////////////////////////////////////////////////////////////
2462
2463UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; }
2464
2465UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); }
2466
2467UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) {
2468 return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) &
2469 _upb_hasbit_mask(idx)) != 0;
2470}
2471
2472UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) {
2473 (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx);
2474}
2475
2476UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) {
2477 (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx);
2478}
2479
2480UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) {
2481 UPB_ASSERT(f->presence > 0);
2482 return f->presence;
2483}
2484
2485UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg,
2486 const upb_MiniTableField* f) {
2487 return _upb_hasbit(msg, _upb_Message_Hasidx(f));
2488}
2489
2490UPB_INLINE void _upb_sethas_field(const upb_Message* msg,
2491 const upb_MiniTableField* f) {
2492 _upb_sethas(msg, _upb_Message_Hasidx(f));
2493}
2494
2495// Oneof case access ///////////////////////////////////////////////////////////
2496
2497UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) {
2498 UPB_ASSERT(f->presence < 0);
2499 return ~(ptrdiff_t)f->presence;
2500}
2501
2502UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg,
2503 const upb_MiniTableField* f) {
2504 return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t);
2505}
2506
2507UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg,
2508 const upb_MiniTableField* f) {
2509 return *_upb_oneofcase_field((upb_Message*)msg, f);
2510}
2511
2512// LINT.ThenChange(GoogleInternalName2)
Mike Kruskal9d435022023-07-11 12:45:07 -07002513
Eric Salo8809a112022-11-21 13:01:06 -08002514UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) {
2515 return field->presence < 0;
2516}
2517
2518UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg,
2519 const upb_MiniTableField* field) {
2520 return (char*)msg + field->offset;
2521}
2522
2523UPB_INLINE const void* _upb_MiniTableField_GetConstPtr(
2524 const upb_Message* msg, const upb_MiniTableField* field) {
2525 return (char*)msg + field->offset;
2526}
2527
Eric Salo10505992022-12-12 12:16:36 -08002528UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg,
2529 const upb_MiniTableField* field) {
Eric Salo8809a112022-11-21 13:01:06 -08002530 if (field->presence > 0) {
2531 _upb_sethas_field(msg, field);
2532 } else if (_upb_MiniTableField_InOneOf(field)) {
2533 *_upb_oneofcase_field(msg, field) = field->number;
2534 }
2535}
2536
Mike Kruskal3bc50492022-12-01 13:34:12 -08002537UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val,
2538 const upb_MiniTableField* field) {
Eric Salo8809a112022-11-21 13:01:06 -08002539 char zero[16] = {0};
2540 switch (_upb_MiniTableField_GetRep(field)) {
2541 case kUpb_FieldRep_1Byte:
2542 return memcmp(&zero, default_val, 1) != 0;
2543 case kUpb_FieldRep_4Byte:
2544 return memcmp(&zero, default_val, 4) != 0;
2545 case kUpb_FieldRep_8Byte:
2546 return memcmp(&zero, default_val, 8) != 0;
2547 case kUpb_FieldRep_StringView: {
2548 const upb_StringView* sv = (const upb_StringView*)default_val;
2549 return sv->size != 0;
2550 }
2551 }
2552 UPB_UNREACHABLE();
2553}
2554
2555UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from,
2556 const upb_MiniTableField* field) {
2557 switch (_upb_MiniTableField_GetRep(field)) {
2558 case kUpb_FieldRep_1Byte:
2559 memcpy(to, from, 1);
2560 return;
2561 case kUpb_FieldRep_4Byte:
2562 memcpy(to, from, 4);
2563 return;
2564 case kUpb_FieldRep_8Byte:
2565 memcpy(to, from, 8);
2566 return;
2567 case kUpb_FieldRep_StringView: {
2568 memcpy(to, from, sizeof(upb_StringView));
2569 return;
2570 }
2571 }
2572 UPB_UNREACHABLE();
2573}
2574
Eric Salob7d54ac2022-12-29 11:59:42 -08002575UPB_INLINE size_t
2576_upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
2577 const unsigned char table[] = {
2578 0,
2579 3, // kUpb_FieldType_Double = 1,
2580 2, // kUpb_FieldType_Float = 2,
2581 3, // kUpb_FieldType_Int64 = 3,
2582 3, // kUpb_FieldType_UInt64 = 4,
2583 2, // kUpb_FieldType_Int32 = 5,
2584 3, // kUpb_FieldType_Fixed64 = 6,
2585 2, // kUpb_FieldType_Fixed32 = 7,
2586 0, // kUpb_FieldType_Bool = 8,
2587 UPB_SIZE(3, 4), // kUpb_FieldType_String = 9,
2588 UPB_SIZE(2, 3), // kUpb_FieldType_Group = 10,
2589 UPB_SIZE(2, 3), // kUpb_FieldType_Message = 11,
2590 UPB_SIZE(3, 4), // kUpb_FieldType_Bytes = 12,
2591 2, // kUpb_FieldType_UInt32 = 13,
2592 2, // kUpb_FieldType_Enum = 14,
2593 2, // kUpb_FieldType_SFixed32 = 15,
2594 3, // kUpb_FieldType_SFixed64 = 16,
2595 2, // kUpb_FieldType_SInt32 = 17,
2596 3, // kUpb_FieldType_SInt64 = 18,
2597 };
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002598 return table[field->UPB_PRIVATE(descriptortype)];
Eric Salob7d54ac2022-12-29 11:59:42 -08002599}
2600
Eric Salo8809a112022-11-21 13:01:06 -08002601// Here we define universal getter/setter functions for message fields.
2602// These look very branchy and inefficient, but as long as the MiniTableField
2603// values are known at compile time, all the branches are optimized away and
2604// we are left with ideal code. This can happen either through through
2605// literals or UPB_ASSUME():
2606//
Eric Salob598b2d2022-12-22 23:14:27 -08002607// // Via struct literals.
Eric Salo8809a112022-11-21 13:01:06 -08002608// bool FooMessage_set_bool_field(const upb_Message* msg, bool val) {
2609// const upb_MiniTableField field = {1, 0, 0, /* etc... */};
2610// // All value in "field" are compile-time known.
Eric Salo10505992022-12-12 12:16:36 -08002611// _upb_Message_SetNonExtensionField(msg, &field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002612// }
2613//
2614// // Via UPB_ASSUME().
Eric Salo10505992022-12-12 12:16:36 -08002615// UPB_INLINE bool upb_Message_SetBool(upb_Message* msg,
2616// const upb_MiniTableField* field,
2617// bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002618// UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002619// UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2620// UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Eric Salo10505992022-12-12 12:16:36 -08002621// _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002622// }
2623//
2624// As a result, we can use these universal getters/setters for *all* message
2625// accessors: generated code, MiniTable accessors, and reflection. The only
2626// exception is the binary encoder/decoder, which need to be a bit more clever
Eric Salob598b2d2022-12-22 23:14:27 -08002627// about how they read/write the message data, for efficiency.
Eric Salo10505992022-12-12 12:16:36 -08002628//
2629// These functions work on both extensions and non-extensions. If the field
2630// of a setter is known to be a non-extension, the arena may be NULL and the
2631// returned bool value may be ignored since it will always succeed.
Eric Salo8809a112022-11-21 13:01:06 -08002632
Eric Salo10505992022-12-12 12:16:36 -08002633UPB_INLINE bool _upb_Message_HasExtensionField(
2634 const upb_Message* msg, const upb_MiniTableExtension* ext) {
2635 UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field));
2636 return _upb_Message_Getext(msg, ext) != NULL;
2637}
2638
2639UPB_INLINE bool _upb_Message_HasNonExtensionField(
2640 const upb_Message* msg, const upb_MiniTableField* field) {
2641 UPB_ASSERT(upb_MiniTableField_HasPresence(field));
2642 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2643 if (_upb_MiniTableField_InOneOf(field)) {
2644 return _upb_getoneofcase_field(msg, field) == field->number;
2645 } else {
2646 return _upb_hasbit_field(msg, field);
2647 }
2648}
2649
2650static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002651 const upb_Message* msg, const upb_MiniTableField* field,
2652 const void* default_val, void* val) {
2653 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2654 if ((_upb_MiniTableField_InOneOf(field) ||
Mike Kruskal3bc50492022-12-01 13:34:12 -08002655 _upb_MiniTable_ValueIsNonZero(default_val, field)) &&
Eric Salo10505992022-12-12 12:16:36 -08002656 !_upb_Message_HasNonExtensionField(msg, field)) {
Eric Salo8809a112022-11-21 13:01:06 -08002657 _upb_MiniTable_CopyFieldData(val, default_val, field);
2658 return;
2659 }
2660 _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field),
2661 field);
2662}
2663
Eric Salo10505992022-12-12 12:16:36 -08002664UPB_INLINE void _upb_Message_GetExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002665 const upb_Message* msg, const upb_MiniTableExtension* mt_ext,
2666 const void* default_val, void* val) {
2667 UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field));
2668 const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext);
2669 if (ext) {
2670 _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field);
2671 } else {
2672 _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field);
2673 }
2674}
2675
Eric Salo10505992022-12-12 12:16:36 -08002676UPB_INLINE void _upb_Message_GetField(const upb_Message* msg,
2677 const upb_MiniTableField* field,
2678 const void* default_val, void* val) {
Eric Salo8809a112022-11-21 13:01:06 -08002679 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002680 _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field,
2681 default_val, val);
Eric Salo8809a112022-11-21 13:01:06 -08002682 } else {
Eric Salo10505992022-12-12 12:16:36 -08002683 _upb_Message_GetNonExtensionField(msg, field, default_val, val);
Eric Salo8809a112022-11-21 13:01:06 -08002684 }
2685}
2686
Eric Salo10505992022-12-12 12:16:36 -08002687UPB_INLINE void _upb_Message_SetNonExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002688 upb_Message* msg, const upb_MiniTableField* field, const void* val) {
2689 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Eric Salo10505992022-12-12 12:16:36 -08002690 _upb_Message_SetPresence(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08002691 _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val,
2692 field);
2693}
2694
Eric Salo10505992022-12-12 12:16:36 -08002695UPB_INLINE bool _upb_Message_SetExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002696 upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val,
2697 upb_Arena* a) {
Eric Salo10505992022-12-12 12:16:36 -08002698 UPB_ASSERT(a);
Eric Salo8809a112022-11-21 13:01:06 -08002699 upb_Message_Extension* ext =
2700 _upb_Message_GetOrCreateExtension(msg, mt_ext, a);
2701 if (!ext) return false;
2702 _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field);
2703 return true;
2704}
2705
Eric Salo10505992022-12-12 12:16:36 -08002706UPB_INLINE bool _upb_Message_SetField(upb_Message* msg,
2707 const upb_MiniTableField* field,
2708 const void* val, upb_Arena* a) {
Eric Salo8809a112022-11-21 13:01:06 -08002709 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002710 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2711 return _upb_Message_SetExtensionField(msg, ext, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08002712 } else {
Eric Salo10505992022-12-12 12:16:36 -08002713 _upb_Message_SetNonExtensionField(msg, field, val);
Eric Salo8809a112022-11-21 13:01:06 -08002714 return true;
2715 }
2716}
2717
Eric Salo10505992022-12-12 12:16:36 -08002718UPB_INLINE void _upb_Message_ClearExtensionField(
2719 upb_Message* msg, const upb_MiniTableExtension* ext_l) {
2720 upb_Message_Internal* in = upb_Message_Getinternal(msg);
2721 if (!in->internal) return;
2722 const upb_Message_Extension* base =
2723 UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension);
2724 upb_Message_Extension* ext =
2725 (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l);
2726 if (ext) {
2727 *ext = *base;
2728 in->internal->ext_begin += sizeof(upb_Message_Extension);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002729 }
2730}
2731
Eric Salo10505992022-12-12 12:16:36 -08002732UPB_INLINE void _upb_Message_ClearNonExtensionField(
Mike Kruskal3bc50492022-12-01 13:34:12 -08002733 upb_Message* msg, const upb_MiniTableField* field) {
2734 if (field->presence > 0) {
Eric Salob598b2d2022-12-22 23:14:27 -08002735 _upb_clearhas(msg, _upb_Message_Hasidx(field));
Mike Kruskal3bc50492022-12-01 13:34:12 -08002736 } else if (_upb_MiniTableField_InOneOf(field)) {
2737 uint32_t* oneof_case = _upb_oneofcase_field(msg, field);
2738 if (*oneof_case != field->number) return;
2739 *oneof_case = 0;
2740 }
2741 const char zeros[16] = {0};
2742 _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros,
2743 field);
2744}
2745
Jie Luo3560e232023-06-12 00:33:50 -07002746UPB_INLINE void _upb_Message_AssertMapIsUntagged(
2747 const upb_Message* msg, const upb_MiniTableField* field) {
Adam Cozzette7d5592e2023-08-23 12:15:26 -07002748 UPB_UNUSED(msg);
Jie Luo3560e232023-06-12 00:33:50 -07002749 _upb_MiniTableField_CheckIsMap(field);
2750#ifndef NDEBUG
2751 upb_TaggedMessagePtr default_val = 0;
2752 upb_TaggedMessagePtr tagged;
2753 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
2754 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged));
2755#endif
2756}
2757
Mike Kruskal232ecf42023-01-14 00:09:40 -08002758UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08002759 upb_Message* msg, const upb_MiniTableField* field, size_t key_size,
2760 size_t val_size, upb_Arena* arena) {
2761 _upb_MiniTableField_CheckIsMap(field);
Jie Luo3560e232023-06-12 00:33:50 -07002762 _upb_Message_AssertMapIsUntagged(msg, field);
Eric Salob7d54ac2022-12-29 11:59:42 -08002763 upb_Map* map = NULL;
2764 upb_Map* default_map_value = NULL;
2765 _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map);
2766 if (!map) {
2767 map = _upb_Map_New(arena, key_size, val_size);
2768 // Check again due to: https://godbolt.org/z/7WfaoKG1r
2769 _upb_MiniTableField_CheckIsMap(field);
2770 _upb_Message_SetNonExtensionField(msg, field, &map);
2771 }
2772 return map;
2773}
2774
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002775#ifdef __cplusplus
2776} /* extern "C" */
2777#endif
2778
2779#if defined(__GNUC__) && !defined(__clang__)
2780#pragma GCC diagnostic pop
2781#endif
2782
2783
Sandy Zhange3b09432023-08-07 09:30:02 -07002784#endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002785
2786// Must be last.
2787
2788#ifdef __cplusplus
2789extern "C" {
2790#endif
Eric Salo10505992022-12-12 12:16:36 -08002791
2792UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg,
2793 const upb_MiniTableField* field) {
Mike Kruskal3bc50492022-12-01 13:34:12 -08002794 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002795 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2796 _upb_Message_ClearExtensionField(msg, ext);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002797 } else {
Eric Salo10505992022-12-12 12:16:36 -08002798 _upb_Message_ClearNonExtensionField(msg, field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002799 }
2800}
2801
Jie Luof36a5c62023-05-23 17:56:18 -07002802UPB_API_INLINE void upb_Message_Clear(upb_Message* msg,
2803 const upb_MiniTable* l) {
2804 // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction.
2805 char* mem = (char*)msg - sizeof(upb_Message_Internal);
2806 memset(mem, 0, upb_msg_sizeof(l));
2807}
2808
Eric Salo10505992022-12-12 12:16:36 -08002809UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg,
2810 const upb_MiniTableField* field) {
2811 if (upb_MiniTableField_IsExtension(field)) {
2812 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2813 return _upb_Message_HasExtensionField(msg, ext);
2814 } else {
2815 return _upb_Message_HasNonExtensionField(msg, field);
2816 }
Mike Kruskal3bc50492022-12-01 13:34:12 -08002817}
Eric Salo8809a112022-11-21 13:01:06 -08002818
Eric Salob598b2d2022-12-22 23:14:27 -08002819UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
2820 const upb_Message* message, const upb_MiniTableField* oneof_field) {
2821 UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field));
2822 return _upb_getoneofcase_field(message, oneof_field);
2823}
2824
Eric Salo10505992022-12-12 12:16:36 -08002825UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
2826 const upb_MiniTableField* field,
2827 bool default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002828 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002829 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002830 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002831 bool ret;
Eric Salo10505992022-12-12 12:16:36 -08002832 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002833 return ret;
2834}
2835
Eric Salo10505992022-12-12 12:16:36 -08002836UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
2837 const upb_MiniTableField* field,
2838 bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002839 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002840 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002841 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002842 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002843}
2844
Eric Salo10505992022-12-12 12:16:36 -08002845UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
2846 const upb_MiniTableField* field,
2847 int32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002848 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2849 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Eric Salo8809a112022-11-21 13:01:06 -08002850 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002851 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002852 int32_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002853 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002854 return ret;
2855}
2856
Eric Salo10505992022-12-12 12:16:36 -08002857UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
2858 const upb_MiniTableField* field,
2859 int32_t value, upb_Arena* a) {
Deanna Garciab26afb52023-04-25 13:37:18 -07002860 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2861 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Eric Salo8809a112022-11-21 13:01:06 -08002862 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002863 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002864 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002865}
2866
Eric Salo10505992022-12-12 12:16:36 -08002867UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
2868 const upb_MiniTableField* field,
2869 uint32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002870 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Eric Salo8809a112022-11-21 13:01:06 -08002871 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002872 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002873 uint32_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002874 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002875 return ret;
2876}
2877
Eric Salo10505992022-12-12 12:16:36 -08002878UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
2879 const upb_MiniTableField* field,
2880 uint32_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002881 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Eric Salo8809a112022-11-21 13:01:06 -08002882 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002883 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002884 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002885}
2886
Deanna Garciab26afb52023-04-25 13:37:18 -07002887UPB_API_INLINE void upb_Message_SetClosedEnum(
Eric Salo3f36a912022-12-05 14:12:25 -08002888 upb_Message* msg, const upb_MiniTable* msg_mini_table,
2889 const upb_MiniTableField* field, int32_t value) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002890 UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field));
Eric Salo8809a112022-11-21 13:01:06 -08002891 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002892 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002893 UPB_ASSERT(upb_MiniTableEnum_CheckValue(
2894 upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value));
Eric Salo10505992022-12-12 12:16:36 -08002895 _upb_Message_SetNonExtensionField(msg, field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002896}
2897
Eric Salo10505992022-12-12 12:16:36 -08002898UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
2899 const upb_MiniTableField* field,
2900 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002901 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Eric Salo8809a112022-11-21 13:01:06 -08002902 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002903 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002904 int64_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002905 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002906 return ret;
2907}
2908
Eric Salo10505992022-12-12 12:16:36 -08002909UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
2910 const upb_MiniTableField* field,
2911 int64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002912 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Eric Salo8809a112022-11-21 13:01:06 -08002913 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002914 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002915 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002916}
2917
Eric Salo10505992022-12-12 12:16:36 -08002918UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
2919 const upb_MiniTableField* field,
2920 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002921 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Eric Salo8809a112022-11-21 13:01:06 -08002922 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002923 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002924 uint64_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002925 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002926 return ret;
2927}
2928
Eric Salo10505992022-12-12 12:16:36 -08002929UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
2930 const upb_MiniTableField* field,
2931 uint64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002932 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Eric Salo8809a112022-11-21 13:01:06 -08002933 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002934 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002935 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002936}
2937
Eric Salo10505992022-12-12 12:16:36 -08002938UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
2939 const upb_MiniTableField* field,
2940 float default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002941 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Eric Salo8809a112022-11-21 13:01:06 -08002942 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002943 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002944 float ret;
Eric Salo10505992022-12-12 12:16:36 -08002945 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002946 return ret;
2947}
2948
Eric Salo10505992022-12-12 12:16:36 -08002949UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
2950 const upb_MiniTableField* field,
2951 float value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002952 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Eric Salo8809a112022-11-21 13:01:06 -08002953 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002954 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002955 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002956}
2957
Eric Salo10505992022-12-12 12:16:36 -08002958UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
2959 const upb_MiniTableField* field,
2960 double default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002961 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Eric Salo8809a112022-11-21 13:01:06 -08002962 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002963 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002964 double ret;
Eric Salo10505992022-12-12 12:16:36 -08002965 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002966 return ret;
2967}
2968
Eric Salo10505992022-12-12 12:16:36 -08002969UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
2970 const upb_MiniTableField* field,
2971 double value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002972 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Eric Salo8809a112022-11-21 13:01:06 -08002973 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002974 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002975 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002976}
2977
Eric Salo3f36a912022-12-05 14:12:25 -08002978UPB_API_INLINE upb_StringView
Eric Salo10505992022-12-12 12:16:36 -08002979upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
2980 upb_StringView def_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002981 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2982 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Eric Salo8809a112022-11-21 13:01:06 -08002983 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002984 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002985 upb_StringView ret;
Eric Salo10505992022-12-12 12:16:36 -08002986 _upb_Message_GetField(msg, field, &def_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002987 return ret;
2988}
2989
Eric Salo10505992022-12-12 12:16:36 -08002990UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
2991 const upb_MiniTableField* field,
2992 upb_StringView value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002993 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2994 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Eric Salo8809a112022-11-21 13:01:06 -08002995 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002996 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002997 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002998}
2999
Jie Luo3560e232023-06-12 00:33:50 -07003000UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
Eric Salo8809a112022-11-21 13:01:06 -08003001 const upb_Message* msg, const upb_MiniTableField* field,
3002 upb_Message* default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003003 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08003004 UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
3005 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003006 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Jie Luo3560e232023-06-12 00:33:50 -07003007 upb_TaggedMessagePtr tagged;
3008 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
3009 return tagged;
Eric Salo8809a112022-11-21 13:01:06 -08003010}
3011
Jie Luo3560e232023-06-12 00:33:50 -07003012UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
3013 const upb_Message* msg, const upb_MiniTableField* field,
3014 upb_Message* default_val) {
3015 upb_TaggedMessagePtr tagged =
3016 upb_Message_GetTaggedMessagePtr(msg, field, default_val);
3017 return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged);
3018}
3019
3020// For internal use only; users cannot set tagged messages because only the
3021// parser and the message copier are allowed to directly create an empty
3022// message.
3023UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
3024 upb_Message* msg, const upb_MiniTable* mini_table,
3025 const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003026 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08003027 UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
3028 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003029 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Deanna Garciac7d979d2023-04-14 17:22:13 -07003030 UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg);
Eric Salo10505992022-12-12 12:16:36 -08003031 _upb_Message_SetNonExtensionField(msg, field, &sub_message);
Eric Salo8809a112022-11-21 13:01:06 -08003032}
3033
Jie Luo3560e232023-06-12 00:33:50 -07003034UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
3035 const upb_MiniTable* mini_table,
3036 const upb_MiniTableField* field,
3037 upb_Message* sub_message) {
3038 _upb_Message_SetTaggedMessagePtr(
3039 msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false));
3040}
3041
Mike Kruskal232ecf42023-01-14 00:09:40 -08003042UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
Eric Salo8809a112022-11-21 13:01:06 -08003043 upb_Message* msg, const upb_MiniTable* mini_table,
3044 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003045 UPB_ASSERT(arena);
3046 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08003047 upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*);
3048 if (!sub_message) {
3049 const upb_MiniTable* sub_mini_table =
Deanna Garciac7d979d2023-04-14 17:22:13 -07003050 mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
Eric Salo8809a112022-11-21 13:01:06 -08003051 UPB_ASSERT(sub_mini_table);
3052 sub_message = _upb_Message_New(sub_mini_table, arena);
3053 *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message;
Eric Salo10505992022-12-12 12:16:36 -08003054 _upb_Message_SetPresence(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08003055 }
3056 return sub_message;
3057}
3058
Eric Salob598b2d2022-12-22 23:14:27 -08003059UPB_API_INLINE const upb_Array* upb_Message_GetArray(
Eric Salo8809a112022-11-21 13:01:06 -08003060 const upb_Message* msg, const upb_MiniTableField* field) {
Eric Salob7d54ac2022-12-29 11:59:42 -08003061 _upb_MiniTableField_CheckIsArray(field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07003062 upb_Array* ret;
Eric Salo8809a112022-11-21 13:01:06 -08003063 const upb_Array* default_val = NULL;
Eric Salo10505992022-12-12 12:16:36 -08003064 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08003065 return ret;
3066}
3067
Eric Salob598b2d2022-12-22 23:14:27 -08003068UPB_API_INLINE upb_Array* upb_Message_GetMutableArray(
Eric Salo8809a112022-11-21 13:01:06 -08003069 upb_Message* msg, const upb_MiniTableField* field) {
Eric Salob7d54ac2022-12-29 11:59:42 -08003070 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003071 return (upb_Array*)upb_Message_GetArray(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08003072}
3073
Eric Salob598b2d2022-12-22 23:14:27 -08003074UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
Eric Salob7d54ac2022-12-29 11:59:42 -08003075 upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003076 UPB_ASSERT(arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08003077 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003078 upb_Array* array = upb_Message_GetMutableArray(msg, field);
3079 if (!array) {
Eric Salob7d54ac2022-12-29 11:59:42 -08003080 array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field));
3081 // Check again due to: https://godbolt.org/z/7WfaoKG1r
3082 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003083 _upb_Message_SetField(msg, field, &array, arena);
3084 }
3085 return array;
3086}
3087
Jie Luof36a5c62023-05-23 17:56:18 -07003088UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized(
Eric Salob7d54ac2022-12-29 11:59:42 -08003089 upb_Message* msg, const upb_MiniTableField* field, size_t size,
3090 upb_Arena* arena) {
3091 _upb_MiniTableField_CheckIsArray(field);
3092 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena);
3093 if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL;
Eric Salob7d54ac2022-12-29 11:59:42 -08003094 return _upb_array_ptr(arr);
3095}
Eric Salo10505992022-12-12 12:16:36 -08003096
Eric Salob7d54ac2022-12-29 11:59:42 -08003097UPB_API_INLINE const upb_Map* upb_Message_GetMap(
3098 const upb_Message* msg, const upb_MiniTableField* field) {
3099 _upb_MiniTableField_CheckIsMap(field);
Jie Luo3560e232023-06-12 00:33:50 -07003100 _upb_Message_AssertMapIsUntagged(msg, field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07003101 upb_Map* ret;
Eric Salob7d54ac2022-12-29 11:59:42 -08003102 const upb_Map* default_val = NULL;
3103 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
3104 return ret;
3105}
3106
Jie Luo3560e232023-06-12 00:33:50 -07003107UPB_API_INLINE upb_Map* upb_Message_GetMutableMap(
3108 upb_Message* msg, const upb_MiniTableField* field) {
3109 return (upb_Map*)upb_Message_GetMap(msg, field);
3110}
3111
Mike Kruskal232ecf42023-01-14 00:09:40 -08003112UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
Eric Salob598b2d2022-12-22 23:14:27 -08003113 upb_Message* msg, const upb_MiniTable* map_entry_mini_table,
3114 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003115 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salob7d54ac2022-12-29 11:59:42 -08003116 const upb_MiniTableField* map_entry_key_field =
3117 &map_entry_mini_table->fields[0];
3118 const upb_MiniTableField* map_entry_value_field =
3119 &map_entry_mini_table->fields[1];
Mike Kruskal232ecf42023-01-14 00:09:40 -08003120 return _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08003121 msg, field,
3122 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)),
3123 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)),
3124 arena);
Eric Salob598b2d2022-12-22 23:14:27 -08003125}
3126
3127// Updates a map entry given an entry message.
3128upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map,
3129 const upb_MiniTable* mini_table,
3130 const upb_MiniTableField* field,
3131 upb_Message* map_entry_message,
3132 upb_Arena* arena);
3133
Mike Kruskal9d435022023-07-11 12:45:07 -07003134// Compares two messages by serializing them and calling memcmp().
3135bool upb_Message_IsExactlyEqual(const upb_Message* m1, const upb_Message* m2,
3136 const upb_MiniTable* layout);
3137
Eric Salo8809a112022-11-21 13:01:06 -08003138#ifdef __cplusplus
3139} /* extern "C" */
3140#endif
3141
3142
3143#endif // UPB_MESSAGE_ACCESSORS_H_
3144
Mike Kruskal9d435022023-07-11 12:45:07 -07003145#ifndef UPB_MINI_TABLE_DECODE_H_
3146#define UPB_MINI_TABLE_DECODE_H_
3147
3148
3149#ifndef UPB_MINI_TABLE_SUB_H_
3150#define UPB_MINI_TABLE_SUB_H_
3151
3152
3153typedef union upb_MiniTableSub upb_MiniTableSub;
3154
3155#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
3156
3157// Export the newer headers, for legacy users. New users should include the
3158// more specific headers directly.
3159// IWYU pragma: begin_exports
3160
3161#ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3162#define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3163
3164
3165// Must be last.
3166
3167#ifdef __cplusplus
3168extern "C" {
3169#endif
3170
3171// Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor
3172// must be for an enum, not a message.
3173UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data,
3174 size_t len,
3175 upb_Arena* arena,
3176 upb_Status* status);
3177
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00003178// TODO: Deprecated name; update callers.
Mike Kruskal9d435022023-07-11 12:45:07 -07003179UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data,
3180 size_t len,
3181 upb_Arena* arena,
3182 upb_Status* status) {
3183 return upb_MiniDescriptor_BuildEnum(data, len, arena, status);
3184}
3185
3186#ifdef __cplusplus
3187} /* extern "C" */
3188#endif
3189
3190
3191#endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3192
3193// Functions for linking MiniTables together once they are built from a
3194// MiniDescriptor.
3195//
3196// These functions have names like upb_MiniTable_Link() because they operate on
3197// MiniTables. We put them here, rather than in the mini_table/ directory,
3198// because they are only needed when building MiniTables from MiniDescriptors.
3199// The interfaces in mini_table/ assume that MiniTables are immutable.
3200
3201#ifndef UPB_MINI_DESCRIPTOR_LINK_H_
3202#define UPB_MINI_DESCRIPTOR_LINK_H_
3203
3204
3205// Must be last.
3206
3207#ifdef __cplusplus
3208extern "C" {
3209#endif
3210
3211// Links a sub-message field to a MiniTable for that sub-message. If a
3212// sub-message field is not linked, it will be treated as an unknown field
3213// during parsing, and setting the field will not be allowed. It is possible
3214// to link the message field later, at which point it will no longer be treated
3215// as unknown. However there is no synchronization for this operation, which
3216// means parallel mutation requires external synchronization.
3217// Returns success/failure.
3218UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table,
3219 upb_MiniTableField* field,
3220 const upb_MiniTable* sub);
3221
3222// Links an enum field to a MiniTable for that enum.
3223// All enum fields must be linked prior to parsing.
3224// Returns success/failure.
3225UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table,
3226 upb_MiniTableField* field,
3227 const upb_MiniTableEnum* sub);
3228
3229// Returns a list of fields that require linking at runtime, to connect the
3230// MiniTable to its sub-messages and sub-enums. The list of fields will be
3231// written to the `subs` array, which must have been allocated by the caller
3232// and must be large enough to hold a list of all fields in the message.
3233//
3234// The order of the fields returned by this function is significant: it matches
3235// the order expected by upb_MiniTable_Link() below.
3236//
3237// The return value packs the sub-message count and sub-enum count into a single
3238// integer like so:
3239// return (msg_count << 16) | enum_count;
3240UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt,
3241 const upb_MiniTableField** subs);
3242
3243// Links a message to its sub-messages and sub-enums. The caller must pass
3244// arrays of sub-tables and sub-enums, in the same length and order as is
3245// returned by upb_MiniTable_GetSubList() above. However, individual elements
3246// of the sub_tables may be NULL if those sub-messages were tree shaken.
3247//
3248// Returns false if either array is too short, or if any of the tables fails
3249// to link.
3250UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt,
3251 const upb_MiniTable** sub_tables,
3252 size_t sub_table_count,
3253 const upb_MiniTableEnum** sub_enums,
3254 size_t sub_enum_count);
3255
3256#ifdef __cplusplus
3257} /* extern "C" */
3258#endif
3259
3260
3261#endif // UPB_MINI_DESCRIPTOR_LINK_H_
3262// IWYU pragma: end_exports
3263
3264// Must be last.
3265
3266typedef enum {
3267 kUpb_MiniTablePlatform_32Bit,
3268 kUpb_MiniTablePlatform_64Bit,
3269 kUpb_MiniTablePlatform_Native =
3270 UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit),
3271} upb_MiniTablePlatform;
3272
3273#ifdef __cplusplus
3274extern "C" {
3275#endif
3276
3277// Builds a mini table from the data encoded in the buffer [data, len]. If any
3278// errors occur, returns NULL and sets a status message. In the success case,
3279// the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum
3280// fields to link the table to the appropriate sub-tables.
3281upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len,
3282 upb_MiniTablePlatform platform,
3283 upb_Arena* arena, upb_Status* status);
3284
3285UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len,
3286 upb_Arena* arena,
3287 upb_Status* status) {
3288 return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena,
3289 status);
3290}
3291
3292// Initializes a MiniTableExtension buffer that has already been allocated.
3293// This is needed by upb_FileDef and upb_MessageDef, which allocate all of the
3294// extensions together in a single contiguous array.
3295const char* _upb_MiniTableExtension_Init(const char* data, size_t len,
3296 upb_MiniTableExtension* ext,
3297 const upb_MiniTable* extendee,
3298 upb_MiniTableSub sub,
3299 upb_MiniTablePlatform platform,
3300 upb_Status* status);
3301
3302UPB_API_INLINE const char* upb_MiniTableExtension_Init(
3303 const char* data, size_t len, upb_MiniTableExtension* ext,
3304 const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) {
3305 return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub,
3306 kUpb_MiniTablePlatform_Native, status);
3307}
3308
3309UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build(
3310 const char* data, size_t len, const upb_MiniTable* extendee,
3311 upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena,
3312 upb_Status* status);
3313
3314UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
3315 const char* data, size_t len, const upb_MiniTable* extendee,
3316 upb_Arena* arena, upb_Status* status) {
3317 upb_MiniTableSub sub;
3318 sub.submsg = NULL;
3319 return _upb_MiniTableExtension_Build(
3320 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3321}
3322
3323UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
3324 const char* data, size_t len, const upb_MiniTable* extendee,
3325 upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) {
3326 upb_MiniTableSub sub;
3327 sub.submsg = submsg;
3328 return _upb_MiniTableExtension_Build(
3329 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3330}
3331
3332UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum(
3333 const char* data, size_t len, const upb_MiniTable* extendee,
3334 upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) {
3335 upb_MiniTableSub sub;
3336 sub.subenum = subenum;
3337 return _upb_MiniTableExtension_Build(
3338 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3339}
3340
3341// Like upb_MiniTable_Build(), but the user provides a buffer of layout data so
3342// it can be reused from call to call, avoiding repeated realloc()/free().
3343//
3344// The caller owns `*buf` both before and after the call, and must free() it
3345// when it is no longer in use. The function will realloc() `*buf` as
3346// necessary, updating `*size` accordingly.
3347upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
3348 upb_MiniTablePlatform platform,
3349 upb_Arena* arena, void** buf,
3350 size_t* buf_size, upb_Status* status);
3351
3352#ifdef __cplusplus
3353} /* extern "C" */
3354#endif
3355
3356
3357#endif /* UPB_MINI_TABLE_DECODE_H_ */
3358
3359#ifndef UPB_MINI_TABLE_FILE_H_
3360#define UPB_MINI_TABLE_FILE_H_
3361
3362
3363#ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_
3364#define UPB_MINI_TABLE_INTERNAL_FILE_H_
3365
3366
3367// Must be last.
3368
3369struct upb_MiniTableFile {
Sandy Zhange3b09432023-08-07 09:30:02 -07003370 const struct upb_MiniTable** msgs;
3371 const struct upb_MiniTableEnum** enums;
3372 const struct upb_MiniTableExtension** exts;
Mike Kruskal9d435022023-07-11 12:45:07 -07003373 int msg_count;
3374 int enum_count;
3375 int ext_count;
3376};
3377
3378
3379#endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */
3380
3381typedef struct upb_MiniTableFile upb_MiniTableFile;
3382
3383#endif /* UPB_MINI_TABLE_FILE_H_ */
3384
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003385// upb_decode: parsing into a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003386
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003387#ifndef UPB_WIRE_DECODE_H_
3388#define UPB_WIRE_DECODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003389
Protobuf Team Bot743bf922023-09-14 01:12:11 +00003390#include <stddef.h>
3391#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003392
Adam Cozzette7d5592e2023-08-23 12:15:26 -07003393
Joshua Habermand3995ec2022-09-30 16:54:39 -07003394// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003395
3396#ifdef __cplusplus
3397extern "C" {
3398#endif
3399
3400enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07003401 /* If set, strings will alias the input buffer instead of copying into the
3402 * arena. */
3403 kUpb_DecodeOption_AliasString = 1,
3404
3405 /* If set, the parse will return failure if any message is missing any
3406 * required fields when the message data ends. The parse will still continue,
3407 * and the failure will only be reported at the end.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003408 *
Joshua Habermand3995ec2022-09-30 16:54:39 -07003409 * IMPORTANT CAVEATS:
3410 *
3411 * 1. This can throw a false positive failure if an incomplete message is seen
3412 * on the wire but is later completed when the sub-message occurs again.
3413 * For this reason, a second pass is required to verify a failure, to be
3414 * truly robust.
3415 *
3416 * 2. This can return a false success if you are decoding into a message that
3417 * already has some sub-message fields present. If the sub-message does
3418 * not occur in the binary payload, we will never visit it and discover the
3419 * incomplete sub-message. For this reason, this check is only useful for
3420 * implemting ParseFromString() semantics. For MergeFromString(), a
3421 * post-parse validation step will always be necessary. */
3422 kUpb_DecodeOption_CheckRequired = 2,
Jie Luo3560e232023-06-12 00:33:50 -07003423
3424 /* EXPERIMENTAL:
3425 *
3426 * If set, the parser will allow parsing of sub-message fields that were not
3427 * previously linked using upb_MiniTable_SetSubMessage(). The data will be
3428 * parsed into an internal "empty" message type that cannot be accessed
3429 * directly, but can be later promoted into the true message type if the
3430 * sub-message fields are linked at a later time.
3431 *
3432 * Users should set this option if they intend to perform dynamic tree shaking
3433 * and promoting using the interfaces in message/promote.h. If this option is
3434 * enabled, it is important that the resulting messages are only accessed by
3435 * code that is aware of promotion rules:
3436 *
3437 * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented
3438 * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether
3439 * the message uses the internal "empty" type.
3440 *
3441 * 2. Any code *reading* these message pointers must test whether the "empty"
3442 * tag bit is set, using the interfaces in mini_table/types.h. However
3443 * writing of message pointers should always use plain upb_Message*, since
3444 * users are not allowed to create "empty" messages.
3445 *
3446 * 3. It is always safe to test whether a field is present or test the array
3447 * length; these interfaces will reflect that empty messages are present,
3448 * even though their data cannot be accessed without promoting first.
3449 *
3450 * 4. If a message pointer is indeed tagged as empty, the message may not be
3451 * accessed directly, only promoted through the interfaces in
3452 * message/promote.h.
3453 *
3454 * 5. Tagged/empty messages may never be created by the user. They may only
3455 * be created by the parser or the message-copying logic in message/copy.h.
3456 */
3457 kUpb_DecodeOption_ExperimentalAllowUnlinked = 4,
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003458};
3459
Deanna Garciac7d979d2023-04-14 17:22:13 -07003460UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) {
3461 return (uint32_t)depth << 16;
3462}
3463
3464UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) {
3465 return options >> 16;
3466}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003467
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003468// Enforce an upper bound on recursion depth.
3469UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) {
Deanna Garciac7d979d2023-04-14 17:22:13 -07003470 uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003471 if (max_depth > limit) max_depth = limit;
Deanna Garciac7d979d2023-04-14 17:22:13 -07003472 return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003473}
3474
Joshua Habermand3995ec2022-09-30 16:54:39 -07003475typedef enum {
3476 kUpb_DecodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003477 kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
3478 kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed
3479 kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8
3480 kUpb_DecodeStatus_MaxDepthExceeded =
3481 4, // Exceeded upb_DecodeOptions_MaxDepth
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003482
Joshua Habermand3995ec2022-09-30 16:54:39 -07003483 // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise
3484 // succeeded.
3485 kUpb_DecodeStatus_MissingRequired = 5,
Jie Luo3560e232023-06-12 00:33:50 -07003486
3487 // Unlinked sub-message field was present, but
3488 // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list
3489 // of options.
3490 kUpb_DecodeStatus_UnlinkedSubMessage = 6,
Joshua Habermand3995ec2022-09-30 16:54:39 -07003491} upb_DecodeStatus;
3492
Eric Salo10505992022-12-12 12:16:36 -08003493UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size,
3494 upb_Message* msg, const upb_MiniTable* l,
3495 const upb_ExtensionRegistry* extreg,
3496 int options, upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003497
3498#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08003499} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003500#endif
3501
Joshua Habermandd69a482021-05-17 22:40:33 -07003502
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003503#endif /* UPB_WIRE_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07003504
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003505// These are the specialized field parser functions for the fast parser.
3506// Generated tables will refer to these by name.
3507//
3508// The function names are encoded with names like:
3509//
3510// // 123 4
3511// upb_pss_1bt(); // Parse singular string, 1 byte tag.
3512//
3513// In position 1:
3514// - 'p' for parse, most function use this
3515// - 'c' for copy, for when we are copying strings instead of aliasing
3516//
3517// In position 2 (cardinality):
3518// - 's' for singular, with or without hasbit
3519// - 'o' for oneof
3520// - 'r' for non-packed repeated
3521// - 'p' for packed repeated
3522//
3523// In position 3 (type):
3524// - 'b1' for bool
3525// - 'v4' for 4-byte varint
3526// - 'v8' for 8-byte varint
3527// - 'z4' for zig-zag-encoded 4-byte varint
3528// - 'z8' for zig-zag-encoded 8-byte varint
3529// - 'f4' for 4-byte fixed
3530// - 'f8' for 8-byte fixed
3531// - 'm' for sub-message
3532// - 's' for string (validate UTF-8)
3533// - 'b' for bytes
3534//
3535// In position 4 (tag length):
3536// - '1' for one-byte tags (field numbers 1-15)
3537// - '2' for two-byte tags (field numbers 16-2048)
3538
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003539#ifndef UPB_WIRE_DECODE_FAST_H_
3540#define UPB_WIRE_DECODE_FAST_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003541
3542
Joshua Habermand3995ec2022-09-30 16:54:39 -07003543// Must be last.
3544
3545#ifdef __cplusplus
3546extern "C" {
3547#endif
3548
Joshua Habermanf41049a2022-01-21 14:41:25 -08003549struct upb_Decoder;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003550
3551// The fallback, generic parsing function that can handle any field type.
3552// This just uses the regular (non-fast) parser to parse a single field.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003553const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d,
3554 const char* ptr, upb_Message* msg,
3555 intptr_t table, uint64_t hasbits,
3556 uint64_t data);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003557
Joshua Habermanf41049a2022-01-21 14:41:25 -08003558#define UPB_PARSE_PARAMS \
3559 struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003560 uint64_t hasbits, uint64_t data
3561
3562/* primitive fields ***********************************************************/
3563
3564#define F(card, type, valbytes, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003565 const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003566
3567#define TYPES(card, tagbytes) \
3568 F(card, b, 1, tagbytes) \
3569 F(card, v, 4, tagbytes) \
3570 F(card, v, 8, tagbytes) \
3571 F(card, z, 4, tagbytes) \
3572 F(card, z, 8, tagbytes) \
3573 F(card, f, 4, tagbytes) \
3574 F(card, f, 8, tagbytes)
3575
3576#define TAGBYTES(card) \
3577 TYPES(card, 1) \
3578 TYPES(card, 2)
3579
3580TAGBYTES(s)
3581TAGBYTES(o)
3582TAGBYTES(r)
3583TAGBYTES(p)
3584
3585#undef F
3586#undef TYPES
3587#undef TAGBYTES
3588
3589/* string fields **************************************************************/
3590
3591#define F(card, tagbytes, type) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003592 const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
3593 const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003594
3595#define UTF8(card, tagbytes) \
3596 F(card, tagbytes, s) \
3597 F(card, tagbytes, b)
3598
3599#define TAGBYTES(card) \
3600 UTF8(card, 1) \
3601 UTF8(card, 2)
3602
3603TAGBYTES(s)
3604TAGBYTES(o)
3605TAGBYTES(r)
3606
3607#undef F
3608#undef TAGBYTES
3609
3610/* sub-message fields *********************************************************/
3611
3612#define F(card, tagbytes, size_ceil, ceil_arg) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003613 const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003614
3615#define SIZES(card, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003616 F(card, tagbytes, 64, 64) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003617 F(card, tagbytes, 128, 128) \
3618 F(card, tagbytes, 192, 192) \
3619 F(card, tagbytes, 256, 256) \
3620 F(card, tagbytes, max, -1)
3621
3622#define TAGBYTES(card) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003623 SIZES(card, 1) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003624 SIZES(card, 2)
3625
3626TAGBYTES(s)
3627TAGBYTES(o)
3628TAGBYTES(r)
3629
3630#undef TAGBYTES
3631#undef SIZES
3632#undef F
3633
3634#undef UPB_PARSE_PARAMS
3635
Joshua Habermand3995ec2022-09-30 16:54:39 -07003636#ifdef __cplusplus
3637} /* extern "C" */
3638#endif
3639
3640
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003641#endif /* UPB_WIRE_DECODE_FAST_H_ */
Joshua Habermandd69a482021-05-17 22:40:33 -07003642
Eric Salo8809a112022-11-21 13:01:06 -08003643// upb_Encode: parsing from a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003644
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003645#ifndef UPB_WIRE_ENCODE_H_
3646#define UPB_WIRE_ENCODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003647
Protobuf Team Bot743bf922023-09-14 01:12:11 +00003648#include <stddef.h>
3649#include <stdint.h>
3650
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003651
Joshua Habermand3995ec2022-09-30 16:54:39 -07003652// Must be last.
3653
3654#ifdef __cplusplus
3655extern "C" {
3656#endif
3657
3658enum {
3659 /* If set, the results of serializing will be deterministic across all
3660 * instances of this binary. There are no guarantees across different
3661 * binary builds.
3662 *
3663 * If your proto contains maps, the encoder will need to malloc()/free()
3664 * memory during encode. */
3665 kUpb_EncodeOption_Deterministic = 1,
3666
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003667 // When set, unknown fields are not printed.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003668 kUpb_EncodeOption_SkipUnknown = 2,
3669
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003670 // When set, the encode will fail if any required fields are missing.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003671 kUpb_EncodeOption_CheckRequired = 4,
3672};
3673
Joshua Habermand3995ec2022-09-30 16:54:39 -07003674typedef enum {
3675 kUpb_EncodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003676 kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
3677 kUpb_EncodeStatus_MaxDepthExceeded = 2,
Joshua Habermand3995ec2022-09-30 16:54:39 -07003678
3679 // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
3680 kUpb_EncodeStatus_MissingRequired = 3,
3681} upb_EncodeStatus;
3682
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003683UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
3684 return (uint32_t)depth << 16;
3685}
3686
3687UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) {
3688 return options >> 16;
3689}
3690
3691// Enforce an upper bound on recursion depth.
3692UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) {
3693 uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options);
3694 if (max_depth > limit) max_depth = limit;
3695 return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff);
3696}
3697
Jason Lunn67dee292023-07-13 13:15:26 -07003698UPB_API upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l,
3699 int options, upb_Arena* arena, char** buf,
3700 size_t* size);
Joshua Habermand3995ec2022-09-30 16:54:39 -07003701
3702#ifdef __cplusplus
3703} /* extern "C" */
3704#endif
3705
3706
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003707#endif /* UPB_WIRE_ENCODE_H_ */
Mike Kruskal9d435022023-07-11 12:45:07 -07003708// IWYU pragma: end_exports
3709
3710#endif // UPB_GENERATED_CODE_SUPPORT_H_
3711/* This file was generated by upbc (the upb compiler) from the input
3712 * file:
3713 *
3714 * google/protobuf/descriptor.proto
3715 *
3716 * Do not edit -- your changes will be discarded when the file is
3717 * regenerated. */
3718
Protobuf Team Botd11eb712023-09-15 00:25:33 +00003719#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
3720#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
3721
3722
3723// Must be last.
3724
3725#ifdef __cplusplus
3726extern "C" {
3727#endif
3728
3729extern const upb_MiniTable google_protobuf_FileDescriptorSet_msg_init;
3730extern const upb_MiniTable google_protobuf_FileDescriptorProto_msg_init;
3731extern const upb_MiniTable google_protobuf_DescriptorProto_msg_init;
3732extern const upb_MiniTable google_protobuf_DescriptorProto_ExtensionRange_msg_init;
3733extern const upb_MiniTable google_protobuf_DescriptorProto_ReservedRange_msg_init;
3734extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_msg_init;
3735extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_Declaration_msg_init;
3736extern const upb_MiniTable google_protobuf_FieldDescriptorProto_msg_init;
3737extern const upb_MiniTable google_protobuf_OneofDescriptorProto_msg_init;
3738extern const upb_MiniTable google_protobuf_EnumDescriptorProto_msg_init;
3739extern const upb_MiniTable google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init;
3740extern const upb_MiniTable google_protobuf_EnumValueDescriptorProto_msg_init;
3741extern const upb_MiniTable google_protobuf_ServiceDescriptorProto_msg_init;
3742extern const upb_MiniTable google_protobuf_MethodDescriptorProto_msg_init;
3743extern const upb_MiniTable google_protobuf_FileOptions_msg_init;
3744extern const upb_MiniTable google_protobuf_MessageOptions_msg_init;
3745extern const upb_MiniTable google_protobuf_FieldOptions_msg_init;
3746extern const upb_MiniTable google_protobuf_FieldOptions_EditionDefault_msg_init;
3747extern const upb_MiniTable google_protobuf_OneofOptions_msg_init;
3748extern const upb_MiniTable google_protobuf_EnumOptions_msg_init;
3749extern const upb_MiniTable google_protobuf_EnumValueOptions_msg_init;
3750extern const upb_MiniTable google_protobuf_ServiceOptions_msg_init;
3751extern const upb_MiniTable google_protobuf_MethodOptions_msg_init;
3752extern const upb_MiniTable google_protobuf_UninterpretedOption_msg_init;
3753extern const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msg_init;
3754extern const upb_MiniTable google_protobuf_FeatureSet_msg_init;
3755extern const upb_MiniTable google_protobuf_FeatureSetDefaults_msg_init;
3756extern const upb_MiniTable google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init;
3757extern const upb_MiniTable google_protobuf_SourceCodeInfo_msg_init;
3758extern const upb_MiniTable google_protobuf_SourceCodeInfo_Location_msg_init;
3759extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_msg_init;
3760extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_Annotation_msg_init;
3761
3762extern const upb_MiniTableEnum google_protobuf_Edition_enum_init;
3763extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init;
3764extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init;
3765extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init;
3766extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init;
3767extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init;
3768extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init;
3769extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init;
3770extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init;
3771extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init;
3772extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init;
3773extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init;
3774extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init;
3775extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init;
3776extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init;
3777extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init;
3778extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout;
3779
3780#ifdef __cplusplus
3781} /* extern "C" */
3782#endif
3783
3784
3785#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */
3786
3787#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
3788#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
3789
3790#include <string.h>
3791
3792
3793// Must be last.
3794
3795#ifdef __cplusplus
3796extern "C" {
3797#endif
3798
3799// The maximum number of bytes a single protobuf field can take up in the
3800// wire format. We only want to do one bounds check per field, so the input
3801// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called,
3802// the decoder can read this many bytes without performing another bounds
3803// check. The stream will copy into a patch buffer as necessary to guarantee
3804// this invariant.
3805#define kUpb_EpsCopyInputStream_SlopBytes 16
3806
3807enum {
3808 kUpb_EpsCopyInputStream_NoAliasing = 0,
3809 kUpb_EpsCopyInputStream_OnPatch = 1,
3810 kUpb_EpsCopyInputStream_NoDelta = 2
3811};
3812
3813typedef struct {
3814 const char* end; // Can read up to SlopBytes bytes beyond this.
3815 const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0)
3816 uintptr_t aliasing;
3817 int limit; // Submessage limit relative to end
3818 bool error; // To distinguish between EOF and error.
3819 char patch[kUpb_EpsCopyInputStream_SlopBytes * 2];
3820} upb_EpsCopyInputStream;
3821
3822// Returns true if the stream is in the error state. A stream enters the error
3823// state when the user reads past a limit (caught in IsDone()) or the
3824// ZeroCopyInputStream returns an error.
3825UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) {
3826 return e->error;
3827}
3828
3829typedef const char* upb_EpsCopyInputStream_BufferFlipCallback(
3830 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start);
3831
3832typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc(
3833 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
3834
3835// Initializes a upb_EpsCopyInputStream using the contents of the buffer
3836// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least
3837// kUpb_EpsCopyInputStream_SlopBytes are available to read.
3838UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e,
3839 const char** ptr, size_t size,
3840 bool enable_aliasing) {
3841 if (size <= kUpb_EpsCopyInputStream_SlopBytes) {
3842 memset(&e->patch, 0, 32);
3843 if (size) memcpy(&e->patch, *ptr, size);
3844 e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch
3845 : kUpb_EpsCopyInputStream_NoAliasing;
3846 *ptr = e->patch;
3847 e->end = *ptr + size;
3848 e->limit = 0;
3849 } else {
3850 e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes;
3851 e->limit = kUpb_EpsCopyInputStream_SlopBytes;
3852 e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta
3853 : kUpb_EpsCopyInputStream_NoAliasing;
3854 }
3855 e->limit_ptr = e->end;
3856 e->error = false;
3857}
3858
3859typedef enum {
3860 // The current stream position is at a limit.
3861 kUpb_IsDoneStatus_Done,
3862
3863 // The current stream position is not at a limit.
3864 kUpb_IsDoneStatus_NotDone,
3865
3866 // The current stream position is not at a limit, and the stream needs to
3867 // be flipped to a new buffer before more data can be read.
3868 kUpb_IsDoneStatus_NeedFallback,
3869} upb_IsDoneStatus;
3870
3871// Returns the status of the current stream position. This is a low-level
3872// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible.
3873UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus(
3874 upb_EpsCopyInputStream* e, const char* ptr, int* overrun) {
3875 *overrun = ptr - e->end;
3876 if (UPB_LIKELY(ptr < e->limit_ptr)) {
3877 return kUpb_IsDoneStatus_NotDone;
3878 } else if (UPB_LIKELY(*overrun == e->limit)) {
3879 return kUpb_IsDoneStatus_Done;
3880 } else {
3881 return kUpb_IsDoneStatus_NeedFallback;
3882 }
3883}
3884
3885// Returns true if the stream has hit a limit, either the current delimited
3886// limit or the overall end-of-stream. As a side effect, this function may flip
3887// the pointer to a new buffer if there are less than
3888// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer.
3889//
3890// Postcondition: if the function returns false, there are at least
3891// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr.
3892UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback(
3893 upb_EpsCopyInputStream* e, const char** ptr,
3894 upb_EpsCopyInputStream_IsDoneFallbackFunc* func) {
3895 int overrun;
3896 switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) {
3897 case kUpb_IsDoneStatus_Done:
3898 return true;
3899 case kUpb_IsDoneStatus_NotDone:
3900 return false;
3901 case kUpb_IsDoneStatus_NeedFallback:
3902 *ptr = func(e, *ptr, overrun);
3903 return *ptr == NULL;
3904 }
3905 UPB_UNREACHABLE();
3906}
3907
3908const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback(
3909 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
3910
3911// A simpler version of IsDoneWithCallback() that does not support a buffer flip
3912// callback. Useful in cases where we do not need to insert custom logic at
3913// every buffer flip.
3914//
3915// If this returns true, the user must call upb_EpsCopyInputStream_IsError()
3916// to distinguish between EOF and error.
3917UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e,
3918 const char** ptr) {
3919 return upb_EpsCopyInputStream_IsDoneWithCallback(
3920 e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback);
3921}
3922
3923// Returns the total number of bytes that are safe to read from the current
3924// buffer without reading uninitialized or unallocated memory.
3925//
3926// Note that this check does not respect any semantic limits on the stream,
3927// either limits from PushLimit() or the overall stream end, so some of these
3928// bytes may have unpredictable, nonsense values in them. The guarantee is only
3929// that the bytes are valid to read from the perspective of the C language
3930// (ie. you can read without triggering UBSAN or ASAN).
3931UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable(
3932 upb_EpsCopyInputStream* e, const char* ptr) {
3933 return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes;
3934}
3935
3936// Returns true if the given delimited field size is valid (it does not extend
3937// beyond any previously-pushed limits). `ptr` should point to the beginning
3938// of the field data, after the delimited size.
3939//
3940// Note that this does *not* guarantee that all of the data for this field is in
3941// the current buffer.
3942UPB_INLINE bool upb_EpsCopyInputStream_CheckSize(
3943 const upb_EpsCopyInputStream* e, const char* ptr, int size) {
3944 UPB_ASSERT(size >= 0);
3945 return ptr - e->end + size <= e->limit;
3946}
3947
3948UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable(
3949 upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) {
3950 // This is one extra branch compared to the more normal:
3951 // return (size_t)(end - ptr) < size;
3952 // However it is one less computation if we are just about to use "ptr + len":
3953 // https://godbolt.org/z/35YGPz
3954 // In microbenchmarks this shows a small improvement.
3955 uintptr_t uptr = (uintptr_t)ptr;
3956 uintptr_t uend = (uintptr_t)e->limit_ptr;
3957 uintptr_t res = uptr + (size_t)size;
3958 if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes;
3959 // NOTE: this check depends on having a linear address space. This is not
3960 // technically guaranteed by uintptr_t.
3961 bool ret = res >= uptr && res <= uend;
3962 if (size < 0) UPB_ASSERT(!ret);
3963 return ret;
3964}
3965
3966// Returns true if the given delimited field size is valid (it does not extend
3967// beyond any previously-pushed limited) *and* all of the data for this field is
3968// available to be read in the current buffer.
3969//
3970// If the size is negative, this function will always return false. This
3971// property can be useful in some cases.
3972UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable(
3973 upb_EpsCopyInputStream* e, const char* ptr, int size) {
3974 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false);
3975}
3976
3977// Returns true if the given sub-message size is valid (it does not extend
3978// beyond any previously-pushed limited) *and* all of the data for this
3979// sub-message is available to be parsed in the current buffer.
3980//
3981// This implies that all fields from the sub-message can be parsed from the
3982// current buffer while maintaining the invariant that we always have at least
3983// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of
3984// any individual field start.
3985//
3986// If the size is negative, this function will always return false. This
3987// property can be useful in some cases.
3988UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(
3989 upb_EpsCopyInputStream* e, const char* ptr, int size) {
3990 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true);
3991}
3992
3993// Returns true if aliasing_enabled=true was passed to
3994// upb_EpsCopyInputStream_Init() when this stream was initialized.
3995UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled(
3996 upb_EpsCopyInputStream* e) {
3997 return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing;
3998}
3999
4000// Returns true if aliasing_enabled=true was passed to
4001// upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can
4002// alias into the region [ptr, size] in an input buffer.
4003UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable(
4004 upb_EpsCopyInputStream* e, const char* ptr, size_t size) {
4005 // When EpsCopyInputStream supports streaming, this will need to become a
4006 // runtime check.
4007 return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) &&
4008 e->aliasing >= kUpb_EpsCopyInputStream_NoDelta;
4009}
4010
4011// Returns a pointer into an input buffer that corresponds to the parsing
4012// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may
4013// be different if we are currently parsing out of the patch buffer.
4014//
4015// REQUIRES: Aliasing must be available for the given pointer. If the input is a
4016// flat buffer and aliasing is enabled, then aliasing will always be available.
4017UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr(
4018 upb_EpsCopyInputStream* e, const char* ptr) {
4019 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0));
4020 uintptr_t delta =
4021 e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing;
4022 return (const char*)((uintptr_t)ptr + delta);
4023}
4024
4025// Reads string data from the input, aliasing into the input buffer instead of
4026// copying. The parsing pointer is passed in `*ptr`, and will be updated if
4027// necessary to point to the actual input buffer. Returns the new parsing
4028// pointer, which will be advanced past the string data.
4029//
4030// REQUIRES: Aliasing must be available for this data region (test with
4031// upb_EpsCopyInputStream_AliasingAvailable().
4032UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased(
4033 upb_EpsCopyInputStream* e, const char** ptr, size_t size) {
4034 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size));
4035 const char* ret = *ptr + size;
4036 *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr);
4037 UPB_ASSUME(ret != NULL);
4038 return ret;
4039}
4040
4041// Skips `size` bytes of data from the input and returns a pointer past the end.
4042// Returns NULL on end of stream or error.
4043UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e,
4044 const char* ptr, int size) {
4045 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
4046 return ptr + size;
4047}
4048
4049// Copies `size` bytes of data from the input `ptr` into the buffer `to`, and
4050// returns a pointer past the end. Returns NULL on end of stream or error.
4051UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e,
4052 const char* ptr, void* to,
4053 int size) {
4054 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
4055 memcpy(to, ptr, size);
4056 return ptr + size;
4057}
4058
4059// Reads string data from the stream and advances the pointer accordingly.
4060// If aliasing was enabled when the stream was initialized, then the returned
4061// pointer will point into the input buffer if possible, otherwise new data
4062// will be allocated from arena and copied into. We may be forced to copy even
4063// if aliasing was enabled if the input data spans input buffers.
4064//
4065// Returns NULL if memory allocation failed, or we reached a premature EOF.
4066UPB_INLINE const char* upb_EpsCopyInputStream_ReadString(
4067 upb_EpsCopyInputStream* e, const char** ptr, size_t size,
4068 upb_Arena* arena) {
4069 if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) {
4070 return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size);
4071 } else {
4072 // We need to allocate and copy.
4073 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) {
4074 return NULL;
4075 }
4076 UPB_ASSERT(arena);
4077 char* data = (char*)upb_Arena_Malloc(arena, size);
4078 if (!data) return NULL;
4079 const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size);
4080 *ptr = data;
4081 return ret;
4082 }
4083}
4084
4085UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) {
4086 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4087}
4088
4089// Pushes a limit onto the stack of limits for the current stream. The limit
4090// will extend for `size` bytes beyond the position in `ptr`. Future calls to
4091// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position
4092// reaches this limit.
4093//
4094// Returns a delta that the caller must store and supply to PopLimit() below.
4095UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e,
4096 const char* ptr, int size) {
4097 int limit = size + (int)(ptr - e->end);
4098 int delta = e->limit - limit;
4099 _upb_EpsCopyInputStream_CheckLimit(e);
4100 UPB_ASSERT(limit <= e->limit);
4101 e->limit = limit;
4102 e->limit_ptr = e->end + UPB_MIN(0, limit);
4103 _upb_EpsCopyInputStream_CheckLimit(e);
4104 return delta;
4105}
4106
4107// Pops the last limit that was pushed on this stream. This may only be called
4108// once IsDone() returns true. The user must pass the delta that was returned
4109// from PushLimit().
4110UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e,
4111 const char* ptr,
4112 int saved_delta) {
4113 UPB_ASSERT(ptr - e->end == e->limit);
4114 _upb_EpsCopyInputStream_CheckLimit(e);
4115 e->limit += saved_delta;
4116 e->limit_ptr = e->end + UPB_MIN(0, e->limit);
4117 _upb_EpsCopyInputStream_CheckLimit(e);
4118}
4119
4120UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline(
4121 upb_EpsCopyInputStream* e, const char* ptr, int overrun,
4122 upb_EpsCopyInputStream_BufferFlipCallback* callback) {
4123 if (overrun < e->limit) {
4124 // Need to copy remaining data into patch buffer.
4125 UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes);
4126 const char* old_end = ptr;
4127 const char* new_start = &e->patch[0] + overrun;
4128 memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0,
4129 kUpb_EpsCopyInputStream_SlopBytes);
4130 memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes);
4131 ptr = new_start;
4132 e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes];
4133 e->limit -= kUpb_EpsCopyInputStream_SlopBytes;
4134 e->limit_ptr = e->end + e->limit;
4135 UPB_ASSERT(ptr < e->limit_ptr);
4136 if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) {
4137 e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start;
4138 }
4139 return callback(e, old_end, new_start);
4140 } else {
4141 UPB_ASSERT(overrun > e->limit);
4142 e->error = true;
4143 return callback(e, NULL, NULL);
4144 }
4145}
4146
4147typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc(
4148 upb_EpsCopyInputStream* e, const char* ptr, void* ctx);
4149
4150// Tries to perform a fast-path handling of the given delimited message data.
4151// If the sub-message beginning at `*ptr` and extending for `len` is short and
4152// fits within this buffer, calls `func` with `ctx` as a parameter, where the
4153// pushing and popping of limits is handled automatically and with lower cost
4154// than the normal PushLimit()/PopLimit() sequence.
4155static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
4156 upb_EpsCopyInputStream* e, const char** ptr, int len,
4157 upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
4158 if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) {
4159 return false;
4160 }
4161
4162 // Fast case: Sub-message is <128 bytes and fits in the current buffer.
4163 // This means we can preserve limit/limit_ptr verbatim.
4164 const char* saved_limit_ptr = e->limit_ptr;
4165 int saved_limit = e->limit;
4166 e->limit_ptr = *ptr + len;
4167 e->limit = e->limit_ptr - e->end;
4168 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4169 *ptr = func(e, *ptr, ctx);
4170 e->limit_ptr = saved_limit_ptr;
4171 e->limit = saved_limit;
4172 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4173 return true;
4174}
4175
4176#ifdef __cplusplus
4177} /* extern "C" */
4178#endif
4179
4180
4181#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4182
4183#ifndef UPB_HASH_INT_TABLE_H_
4184#define UPB_HASH_INT_TABLE_H_
4185
4186
4187// Must be last.
4188
4189typedef struct {
4190 upb_table t; // For entries that don't fit in the array part.
4191 const upb_tabval* array; // Array part of the table. See const note above.
4192 size_t array_size; // Array part size.
4193 size_t array_count; // Array part number of elements.
4194} upb_inttable;
4195
4196#ifdef __cplusplus
4197extern "C" {
4198#endif
4199
4200// Initialize a table. If memory allocation failed, false is returned and
4201// the table is uninitialized.
4202bool upb_inttable_init(upb_inttable* table, upb_Arena* a);
4203
4204// Returns the number of values in the table.
4205size_t upb_inttable_count(const upb_inttable* t);
4206
4207// Inserts the given key into the hashtable with the given value.
4208// The key must not already exist in the hash table.
4209// The value must not be UINTPTR_MAX.
4210//
4211// If a table resize was required but memory allocation failed, false is
4212// returned and the table is unchanged.
4213bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val,
4214 upb_Arena* a);
4215
4216// Looks up key in this table, returning "true" if the key was found.
4217// If v is non-NULL, copies the value for this key into *v.
4218bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v);
4219
4220// Removes an item from the table. Returns true if the remove was successful,
4221// and stores the removed item in *val if non-NULL.
4222bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val);
4223
4224// Updates an existing entry in an inttable.
4225// If the entry does not exist, returns false and does nothing.
4226// Unlike insert/remove, this does not invalidate iterators.
4227bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val);
4228
4229// Optimizes the table for the current set of entries, for both memory use and
4230// lookup time. Client should call this after all entries have been inserted;
4231// inserting more entries is legal, but will likely require a table resize.
4232void upb_inttable_compact(upb_inttable* t, upb_Arena* a);
4233
4234// Iteration over inttable:
4235//
4236// intptr_t iter = UPB_INTTABLE_BEGIN;
4237// uintptr_t key;
4238// upb_value val;
4239// while (upb_inttable_next(t, &key, &val, &iter)) {
4240// // ...
4241// }
4242
4243#define UPB_INTTABLE_BEGIN -1
4244
4245bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val,
4246 intptr_t* iter);
4247void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter);
4248
4249#ifdef __cplusplus
4250} /* extern "C" */
4251#endif
4252
4253
4254#endif /* UPB_HASH_INT_TABLE_H_ */
4255
4256#ifndef UPB_JSON_DECODE_H_
4257#define UPB_JSON_DECODE_H_
4258
4259
4260#ifndef UPB_REFLECTION_DEF_H_
4261#define UPB_REFLECTION_DEF_H_
4262
4263// IWYU pragma: begin_exports
4264
4265// IWYU pragma: private, include "upb/upb/reflection/def.h"
4266
4267#ifndef UPB_REFLECTION_DEF_POOL_H_
4268#define UPB_REFLECTION_DEF_POOL_H_
4269
4270
4271// IWYU pragma: private, include "upb/upb/reflection/def.h"
4272
4273// Declarations common to all public def types.
4274
4275#ifndef UPB_REFLECTION_COMMON_H_
4276#define UPB_REFLECTION_COMMON_H_
4277
4278// begin:google_only
4279// #ifndef UPB_BOOTSTRAP_STAGE0
4280// #include "net/proto2/proto/descriptor.upb.h"
4281// #else
4282// #include "google/protobuf/descriptor.upb.h"
4283// #endif
4284// end:google_only
4285
4286// begin:github_only
4287/* This file was generated by upbc (the upb compiler) from the input
4288 * file:
4289 *
4290 * google/protobuf/descriptor.proto
4291 *
4292 * Do not edit -- your changes will be discarded when the file is
4293 * regenerated. */
4294
Mike Kruskal9d435022023-07-11 12:45:07 -07004295#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
4296#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07004297
Protobuf Team Bot111d6552023-09-15 21:07:08 +00004298
4299
4300// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004301
4302#ifdef __cplusplus
4303extern "C" {
4304#endif
4305
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004306typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
4307typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
4308typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
4309typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
4310typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
4311typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
Mike Kruskal145900f2023-03-27 09:55:52 -07004312typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004313typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
4314typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
4315typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
4316typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
4317typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
4318typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
4319typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
4320typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
4321typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
4322typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004323typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004324typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
4325typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
4326typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
4327typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
4328typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
4329typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
4330typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004331typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet;
Mike Kruskalba964702023-08-22 17:37:48 -07004332typedef struct google_protobuf_FeatureSetDefaults google_protobuf_FeatureSetDefaults;
4333typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004334typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
4335typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
4336typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
4337typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004338
4339typedef enum {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004340 google_protobuf_EDITION_UNKNOWN = 0,
4341 google_protobuf_EDITION_1_TEST_ONLY = 1,
4342 google_protobuf_EDITION_2_TEST_ONLY = 2,
4343 google_protobuf_EDITION_2023 = 1000,
4344 google_protobuf_EDITION_99997_TEST_ONLY = 99997,
4345 google_protobuf_EDITION_99998_TEST_ONLY = 99998,
4346 google_protobuf_EDITION_99999_TEST_ONLY = 99999
4347} google_protobuf_Edition;
4348
4349typedef enum {
Protobuf Team Bot469f0272023-04-21 18:12:45 -07004350 google_protobuf_ExtensionRangeOptions_DECLARATION = 0,
4351 google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1
4352} google_protobuf_ExtensionRangeOptions_VerificationState;
4353
4354typedef enum {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004355 google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0,
4356 google_protobuf_FeatureSet_OPEN = 1,
4357 google_protobuf_FeatureSet_CLOSED = 2
4358} google_protobuf_FeatureSet_EnumType;
4359
4360typedef enum {
4361 google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0,
4362 google_protobuf_FeatureSet_EXPLICIT = 1,
4363 google_protobuf_FeatureSet_IMPLICIT = 2,
4364 google_protobuf_FeatureSet_LEGACY_REQUIRED = 3
4365} google_protobuf_FeatureSet_FieldPresence;
4366
4367typedef enum {
4368 google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0,
4369 google_protobuf_FeatureSet_ALLOW = 1,
4370 google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2
4371} google_protobuf_FeatureSet_JsonFormat;
4372
4373typedef enum {
4374 google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0,
4375 google_protobuf_FeatureSet_LENGTH_PREFIXED = 1,
4376 google_protobuf_FeatureSet_DELIMITED = 2
4377} google_protobuf_FeatureSet_MessageEncoding;
4378
4379typedef enum {
4380 google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0,
4381 google_protobuf_FeatureSet_PACKED = 1,
4382 google_protobuf_FeatureSet_EXPANDED = 2
4383} google_protobuf_FeatureSet_RepeatedFieldEncoding;
4384
4385typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004386 google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
4387 google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
4388 google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
4389} google_protobuf_FieldDescriptorProto_Label;
4390
4391typedef enum {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004392 google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
4393 google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
4394 google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
4395 google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
4396 google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
4397 google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
4398 google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
4399 google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
4400 google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
4401 google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
4402 google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
4403 google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
4404 google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
4405 google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
4406 google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
4407 google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
4408 google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
4409 google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
4410} google_protobuf_FieldDescriptorProto_Type;
4411
4412typedef enum {
4413 google_protobuf_FieldOptions_STRING = 0,
4414 google_protobuf_FieldOptions_CORD = 1,
4415 google_protobuf_FieldOptions_STRING_PIECE = 2
4416} google_protobuf_FieldOptions_CType;
4417
4418typedef enum {
4419 google_protobuf_FieldOptions_JS_NORMAL = 0,
4420 google_protobuf_FieldOptions_JS_STRING = 1,
4421 google_protobuf_FieldOptions_JS_NUMBER = 2
4422} google_protobuf_FieldOptions_JSType;
4423
4424typedef enum {
Adam Cozzette90ff32c2023-01-21 15:04:56 -08004425 google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0,
4426 google_protobuf_FieldOptions_RETENTION_RUNTIME = 1,
4427 google_protobuf_FieldOptions_RETENTION_SOURCE = 2
4428} google_protobuf_FieldOptions_OptionRetention;
4429
4430typedef enum {
4431 google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0,
4432 google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1,
4433 google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2,
4434 google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3,
4435 google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4,
4436 google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5,
4437 google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6,
4438 google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7,
4439 google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8,
4440 google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9
4441} google_protobuf_FieldOptions_OptionTargetType;
4442
4443typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004444 google_protobuf_FileOptions_SPEED = 1,
4445 google_protobuf_FileOptions_CODE_SIZE = 2,
4446 google_protobuf_FileOptions_LITE_RUNTIME = 3
4447} google_protobuf_FileOptions_OptimizeMode;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004448
4449typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004450 google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0,
4451 google_protobuf_GeneratedCodeInfo_Annotation_SET = 1,
4452 google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2
4453} google_protobuf_GeneratedCodeInfo_Annotation_Semantic;
4454
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004455typedef enum {
4456 google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
4457 google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
4458 google_protobuf_MethodOptions_IDEMPOTENT = 2
4459} google_protobuf_MethodOptions_IdempotencyLevel;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004460
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004461
Joshua Habermanf41049a2022-01-21 14:41:25 -08004462
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004463/* google.protobuf.FileDescriptorSet */
4464
Joshua Habermanf41049a2022-01-21 14:41:25 -08004465UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004466 return (google_protobuf_FileDescriptorSet*)_upb_Message_New(&google_protobuf_FileDescriptorSet_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004467}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004468UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) {
4469 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07004470 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004471 if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07004472 return NULL;
4473 }
4474 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004475}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004476UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size,
4477 const upb_ExtensionRegistry* extreg,
4478 int options, upb_Arena* arena) {
4479 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
4480 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004481 if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08004482 kUpb_DecodeStatus_Ok) {
4483 return NULL;
4484 }
4485 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004486}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004487UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004488 char* ptr;
4489 (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, 0, arena, &ptr, len);
4490 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004491}
4492UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options,
4493 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004494 char* ptr;
4495 (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, options, arena, &ptr, len);
4496 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004497}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004498UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004499 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004500 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004501}
Eric Salob7d54ac2022-12-29 11:59:42 -08004502UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004503 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004504 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4505 if (arr) {
4506 if (size) *size = arr->size;
4507 return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr);
4508 } else {
4509 if (size) *size = 0;
4510 return NULL;
4511 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004512}
Deanna Garciab26afb52023-04-25 13:37:18 -07004513UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorSet_file_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004514 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004515 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4516 if (size) {
4517 *size = arr ? arr->size : 0;
4518 }
4519 return arr;
4520}
4521UPB_INLINE upb_Array* _google_protobuf_FileDescriptorSet_file_mutable_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004522 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004523 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4524 (upb_Message*)msg, &field, arena);
4525 if (size) {
4526 *size = arr ? arr->size : 0;
4527 }
4528 return arr;
4529}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004530UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) {
4531 size_t size;
4532 google_protobuf_FileDescriptorSet_file(msg, &size);
4533 return size != 0;
4534}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004535
Eric Salob7d54ac2022-12-29 11:59:42 -08004536UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004537 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004538 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4539 if (arr) {
4540 if (size) *size = arr->size;
4541 return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr);
4542 } else {
4543 if (size) *size = 0;
4544 return NULL;
4545 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004546}
Eric Salob7d54ac2022-12-29 11:59:42 -08004547UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004548 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004549 return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004550}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004551UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004552 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004553 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4554 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4555 return NULL;
4556 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004557 struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)_upb_Message_New(&google_protobuf_FileDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08004558 if (!arr || !sub) return NULL;
4559 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004560 return sub;
4561}
4562
4563/* google.protobuf.FileDescriptorProto */
4564
Joshua Habermanf41049a2022-01-21 14:41:25 -08004565UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004566 return (google_protobuf_FileDescriptorProto*)_upb_Message_New(&google_protobuf_FileDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004567}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004568UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
4569 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07004570 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004571 if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07004572 return NULL;
4573 }
4574 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004575}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004576UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size,
4577 const upb_ExtensionRegistry* extreg,
4578 int options, upb_Arena* arena) {
4579 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
4580 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004581 if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08004582 kUpb_DecodeStatus_Ok) {
4583 return NULL;
4584 }
4585 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004586}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004587UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004588 char* ptr;
4589 (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, 0, arena, &ptr, len);
4590 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004591}
4592UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options,
4593 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004594 char* ptr;
4595 (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, options, arena, &ptr, len);
4596 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004597}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004598UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004599 const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004600 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004601}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004602UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004603 upb_StringView default_val = upb_StringView_FromString("");
4604 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004605 const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004606 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004607 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004608}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004609UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004610 const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004611 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004612}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004613UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004614 const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004615 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004616}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004617UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004618 upb_StringView default_val = upb_StringView_FromString("");
4619 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004620 const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004621 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004622 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004623}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004624UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004625 const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004626 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004627}
4628UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004629 const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004630 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004631}
Eric Salob7d54ac2022-12-29 11:59:42 -08004632UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004633 const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004634 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4635 if (arr) {
4636 if (size) *size = arr->size;
4637 return (upb_StringView const*)_upb_array_constptr(arr);
4638 } else {
4639 if (size) *size = 0;
4640 return NULL;
4641 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004642}
Deanna Garciab26afb52023-04-25 13:37:18 -07004643UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004644 const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004645 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4646 if (size) {
4647 *size = arr ? arr->size : 0;
4648 }
4649 return arr;
4650}
4651UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004652 const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004653 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4654 (upb_Message*)msg, &field, arena);
4655 if (size) {
4656 *size = arr ? arr->size : 0;
4657 }
4658 return arr;
4659}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004660UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) {
4661 size_t size;
4662 google_protobuf_FileDescriptorProto_dependency(msg, &size);
4663 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004664}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004665UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004666 const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004667 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004668}
Eric Salob7d54ac2022-12-29 11:59:42 -08004669UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004670 const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004671 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4672 if (arr) {
4673 if (size) *size = arr->size;
4674 return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr);
4675 } else {
4676 if (size) *size = 0;
4677 return NULL;
4678 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004679}
Deanna Garciab26afb52023-04-25 13:37:18 -07004680UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004681 const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004682 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4683 if (size) {
4684 *size = arr ? arr->size : 0;
4685 }
4686 return arr;
4687}
4688UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004689 const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004690 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4691 (upb_Message*)msg, &field, arena);
4692 if (size) {
4693 *size = arr ? arr->size : 0;
4694 }
4695 return arr;
4696}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004697UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) {
4698 size_t size;
4699 google_protobuf_FileDescriptorProto_message_type(msg, &size);
4700 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004701}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004702UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004703 const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004704 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004705}
Eric Salob7d54ac2022-12-29 11:59:42 -08004706UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004707 const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004708 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4709 if (arr) {
4710 if (size) *size = arr->size;
4711 return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr);
4712 } else {
4713 if (size) *size = 0;
4714 return NULL;
4715 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004716}
Deanna Garciab26afb52023-04-25 13:37:18 -07004717UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004718 const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004719 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4720 if (size) {
4721 *size = arr ? arr->size : 0;
4722 }
4723 return arr;
4724}
4725UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004726 const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004727 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4728 (upb_Message*)msg, &field, arena);
4729 if (size) {
4730 *size = arr ? arr->size : 0;
4731 }
4732 return arr;
4733}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004734UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) {
4735 size_t size;
4736 google_protobuf_FileDescriptorProto_enum_type(msg, &size);
4737 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004738}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004739UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004740 const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004741 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004742}
Eric Salob7d54ac2022-12-29 11:59:42 -08004743UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004744 const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004745 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4746 if (arr) {
4747 if (size) *size = arr->size;
4748 return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr);
4749 } else {
4750 if (size) *size = 0;
4751 return NULL;
4752 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004753}
Deanna Garciab26afb52023-04-25 13:37:18 -07004754UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004755 const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004756 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4757 if (size) {
4758 *size = arr ? arr->size : 0;
4759 }
4760 return arr;
4761}
4762UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004763 const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004764 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4765 (upb_Message*)msg, &field, arena);
4766 if (size) {
4767 *size = arr ? arr->size : 0;
4768 }
4769 return arr;
4770}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004771UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) {
4772 size_t size;
4773 google_protobuf_FileDescriptorProto_service(msg, &size);
4774 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004775}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004776UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004777 const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004778 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004779}
Eric Salob7d54ac2022-12-29 11:59:42 -08004780UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004781 const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004782 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4783 if (arr) {
4784 if (size) *size = arr->size;
4785 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
4786 } else {
4787 if (size) *size = 0;
4788 return NULL;
4789 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004790}
Deanna Garciab26afb52023-04-25 13:37:18 -07004791UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004792 const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004793 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4794 if (size) {
4795 *size = arr ? arr->size : 0;
4796 }
4797 return arr;
4798}
4799UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004800 const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004801 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4802 (upb_Message*)msg, &field, arena);
4803 if (size) {
4804 *size = arr ? arr->size : 0;
4805 }
4806 return arr;
4807}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004808UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) {
4809 size_t size;
4810 google_protobuf_FileDescriptorProto_extension(msg, &size);
4811 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004812}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004813UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004814 const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004815 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004816}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004817UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004818 const google_protobuf_FileOptions* default_val = NULL;
4819 const google_protobuf_FileOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004820 const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004821 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004822 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004823}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004824UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004825 const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004826 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004827}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004828UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004829 const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004830 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004831}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004832UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004833 const google_protobuf_SourceCodeInfo* default_val = NULL;
4834 const google_protobuf_SourceCodeInfo* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004835 const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004836 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004837 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004838}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004839UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004840 const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004841 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004842}
4843UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004844 const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004845 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08004846}
Eric Salob7d54ac2022-12-29 11:59:42 -08004847UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004848 const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004849 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4850 if (arr) {
4851 if (size) *size = arr->size;
4852 return (int32_t const*)_upb_array_constptr(arr);
4853 } else {
4854 if (size) *size = 0;
4855 return NULL;
4856 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004857}
Deanna Garciab26afb52023-04-25 13:37:18 -07004858UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004859 const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004860 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4861 if (size) {
4862 *size = arr ? arr->size : 0;
4863 }
4864 return arr;
4865}
4866UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004867 const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004868 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4869 (upb_Message*)msg, &field, arena);
4870 if (size) {
4871 *size = arr ? arr->size : 0;
4872 }
4873 return arr;
4874}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004875UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) {
4876 size_t size;
4877 google_protobuf_FileDescriptorProto_public_dependency(msg, &size);
4878 return size != 0;
4879}
4880UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004881 const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004882 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004883}
Eric Salob7d54ac2022-12-29 11:59:42 -08004884UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004885 const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004886 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4887 if (arr) {
4888 if (size) *size = arr->size;
4889 return (int32_t const*)_upb_array_constptr(arr);
4890 } else {
4891 if (size) *size = 0;
4892 return NULL;
4893 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004894}
Deanna Garciab26afb52023-04-25 13:37:18 -07004895UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004896 const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004897 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4898 if (size) {
4899 *size = arr ? arr->size : 0;
4900 }
4901 return arr;
4902}
4903UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004904 const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004905 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4906 (upb_Message*)msg, &field, arena);
4907 if (size) {
4908 *size = arr ? arr->size : 0;
4909 }
4910 return arr;
4911}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004912UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) {
4913 size_t size;
4914 google_protobuf_FileDescriptorProto_weak_dependency(msg, &size);
4915 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004916}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004917UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004918 const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004919 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004920}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004921UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004922 upb_StringView default_val = upb_StringView_FromString("");
4923 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004924 const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004925 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004926 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004927}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004928UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004929 const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004930 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004931}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004932UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004933 const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004934 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004935}
4936UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004937 upb_StringView default_val = upb_StringView_FromString("");
4938 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004939 const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004940 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004941 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004942}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004943UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004944 const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
4945 return _upb_Message_HasNonExtensionField(msg, &field);
4946}
4947UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition_enum(google_protobuf_FileDescriptorProto* msg) {
4948 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
4949 _upb_Message_ClearNonExtensionField(msg, &field);
4950}
4951UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition_enum(const google_protobuf_FileDescriptorProto* msg) {
4952 int32_t default_val = 0;
4953 int32_t ret;
4954 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
4955 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
4956 return ret;
4957}
4958UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition_enum(const google_protobuf_FileDescriptorProto* msg) {
4959 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004960 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004961}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004962
Joshua Habermanf41049a2022-01-21 14:41:25 -08004963UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004964 const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004965 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004966}
4967UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004968 const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004969 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004970}
4971UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004972 upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004973 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4974 if (arr) {
4975 if (size) *size = arr->size;
4976 return (upb_StringView*)_upb_array_ptr(arr);
4977 } else {
4978 if (size) *size = 0;
4979 return NULL;
4980 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004981}
Eric Salob7d54ac2022-12-29 11:59:42 -08004982UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004983 upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004984 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004985}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004986UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004987 upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004988 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4989 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4990 return false;
4991 }
4992 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
4993 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004994}
Eric Salob7d54ac2022-12-29 11:59:42 -08004995UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004996 upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004997 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4998 if (arr) {
4999 if (size) *size = arr->size;
5000 return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr);
5001 } else {
5002 if (size) *size = 0;
5003 return NULL;
5004 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005005}
Eric Salob7d54ac2022-12-29 11:59:42 -08005006UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005007 upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005008 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005009}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005010UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005011 upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005012 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5013 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5014 return NULL;
5015 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005016 struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005017 if (!arr || !sub) return NULL;
5018 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005019 return sub;
5020}
Eric Salob7d54ac2022-12-29 11:59:42 -08005021UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005022 upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005023 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5024 if (arr) {
5025 if (size) *size = arr->size;
5026 return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr);
5027 } else {
5028 if (size) *size = 0;
5029 return NULL;
5030 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005031}
Eric Salob7d54ac2022-12-29 11:59:42 -08005032UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005033 upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005034 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005035}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005036UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005037 upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005038 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5039 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5040 return NULL;
5041 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005042 struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005043 if (!arr || !sub) return NULL;
5044 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005045 return sub;
5046}
Eric Salob7d54ac2022-12-29 11:59:42 -08005047UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005048 upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005049 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5050 if (arr) {
5051 if (size) *size = arr->size;
5052 return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr);
5053 } else {
5054 if (size) *size = 0;
5055 return NULL;
5056 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005057}
Eric Salob7d54ac2022-12-29 11:59:42 -08005058UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005059 upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005060 return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005061}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005062UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005063 upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005064 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5065 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5066 return NULL;
5067 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005068 struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google_protobuf_ServiceDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005069 if (!arr || !sub) return NULL;
5070 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005071 return sub;
5072}
Eric Salob7d54ac2022-12-29 11:59:42 -08005073UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005074 upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005075 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5076 if (arr) {
5077 if (size) *size = arr->size;
5078 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5079 } else {
5080 if (size) *size = 0;
5081 return NULL;
5082 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005083}
Eric Salob7d54ac2022-12-29 11:59:42 -08005084UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005085 upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005086 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005087}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005088UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005089 upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005090 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5091 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5092 return NULL;
5093 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005094 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005095 if (!arr || !sub) return NULL;
5096 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005097 return sub;
5098}
5099UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005100 const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005101 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005102}
5103UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005104 struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
5105 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005106 sub = (struct google_protobuf_FileOptions*)_upb_Message_New(&google_protobuf_FileOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005107 if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005108 }
5109 return sub;
5110}
5111UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005112 const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005113 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005114}
5115UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005116 struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
5117 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005118 sub = (struct google_protobuf_SourceCodeInfo*)_upb_Message_New(&google_protobuf_SourceCodeInfo_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005119 if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005120 }
5121 return sub;
5122}
Eric Salob7d54ac2022-12-29 11:59:42 -08005123UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005124 upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005125 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5126 if (arr) {
5127 if (size) *size = arr->size;
5128 return (int32_t*)_upb_array_ptr(arr);
5129 } else {
5130 if (size) *size = 0;
5131 return NULL;
5132 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005133}
Eric Salob7d54ac2022-12-29 11:59:42 -08005134UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005135 upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005136 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005137}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005138UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005139 upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005140 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5141 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5142 return false;
5143 }
5144 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5145 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005146}
Eric Salob7d54ac2022-12-29 11:59:42 -08005147UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005148 upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005149 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5150 if (arr) {
5151 if (size) *size = arr->size;
5152 return (int32_t*)_upb_array_ptr(arr);
5153 } else {
5154 if (size) *size = 0;
5155 return NULL;
5156 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005157}
Eric Salob7d54ac2022-12-29 11:59:42 -08005158UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005159 upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005160 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005161}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005162UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005163 upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005164 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5165 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5166 return false;
5167 }
5168 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5169 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005170}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005171UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00005172 const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005173 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005174}
5175UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00005176 const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
5177 _upb_Message_SetNonExtensionField(msg, &field, &value);
5178}
5179UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition_enum(google_protobuf_FileDescriptorProto *msg, int32_t value) {
5180 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005181 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005182}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005183
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005184/* google.protobuf.DescriptorProto */
5185
Joshua Habermanf41049a2022-01-21 14:41:25 -08005186UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005187 return (google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005188}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005189UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5190 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005191 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005192 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005193 return NULL;
5194 }
5195 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005196}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005197UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size,
5198 const upb_ExtensionRegistry* extreg,
5199 int options, upb_Arena* arena) {
5200 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
5201 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005202 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005203 kUpb_DecodeStatus_Ok) {
5204 return NULL;
5205 }
5206 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005207}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005208UPB_INLINE char* google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005209 char* ptr;
5210 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, 0, arena, &ptr, len);
5211 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005212}
5213UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options,
5214 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005215 char* ptr;
5216 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, options, arena, &ptr, len);
5217 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005218}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005219UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005220 const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005221 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005222}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005223UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005224 upb_StringView default_val = upb_StringView_FromString("");
5225 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005226 const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005227 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005228 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005229}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005230UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005231 const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005232 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005233}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005234UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005235 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005236 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005237}
Eric Salob7d54ac2022-12-29 11:59:42 -08005238UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005239 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005240 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5241 if (arr) {
5242 if (size) *size = arr->size;
5243 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
5244 } else {
5245 if (size) *size = 0;
5246 return NULL;
5247 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005248}
Deanna Garciab26afb52023-04-25 13:37:18 -07005249UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_field_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005250 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005251 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5252 if (size) {
5253 *size = arr ? arr->size : 0;
5254 }
5255 return arr;
5256}
5257UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_field_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005258 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005259 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5260 (upb_Message*)msg, &field, arena);
5261 if (size) {
5262 *size = arr ? arr->size : 0;
5263 }
5264 return arr;
5265}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005266UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) {
5267 size_t size;
5268 google_protobuf_DescriptorProto_field(msg, &size);
5269 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005270}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005271UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005272 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005273 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005274}
Eric Salob7d54ac2022-12-29 11:59:42 -08005275UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005276 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005277 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5278 if (arr) {
5279 if (size) *size = arr->size;
5280 return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr);
5281 } else {
5282 if (size) *size = 0;
5283 return NULL;
5284 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005285}
Deanna Garciab26afb52023-04-25 13:37:18 -07005286UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_nested_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005287 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005288 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5289 if (size) {
5290 *size = arr ? arr->size : 0;
5291 }
5292 return arr;
5293}
5294UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_nested_type_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005295 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005296 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5297 (upb_Message*)msg, &field, arena);
5298 if (size) {
5299 *size = arr ? arr->size : 0;
5300 }
5301 return arr;
5302}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005303UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) {
5304 size_t size;
5305 google_protobuf_DescriptorProto_nested_type(msg, &size);
5306 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005307}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005308UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005309 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005310 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005311}
Eric Salob7d54ac2022-12-29 11:59:42 -08005312UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005313 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005314 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5315 if (arr) {
5316 if (size) *size = arr->size;
5317 return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr);
5318 } else {
5319 if (size) *size = 0;
5320 return NULL;
5321 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005322}
Deanna Garciab26afb52023-04-25 13:37:18 -07005323UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_enum_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005324 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005325 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5326 if (size) {
5327 *size = arr ? arr->size : 0;
5328 }
5329 return arr;
5330}
5331UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_enum_type_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005332 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005333 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5334 (upb_Message*)msg, &field, arena);
5335 if (size) {
5336 *size = arr ? arr->size : 0;
5337 }
5338 return arr;
5339}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005340UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) {
5341 size_t size;
5342 google_protobuf_DescriptorProto_enum_type(msg, &size);
5343 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005344}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005345UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005346 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005347 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005348}
Eric Salob7d54ac2022-12-29 11:59:42 -08005349UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005350 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005351 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5352 if (arr) {
5353 if (size) *size = arr->size;
5354 return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr);
5355 } else {
5356 if (size) *size = 0;
5357 return NULL;
5358 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005359}
Deanna Garciab26afb52023-04-25 13:37:18 -07005360UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005361 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005362 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5363 if (size) {
5364 *size = arr ? arr->size : 0;
5365 }
5366 return arr;
5367}
5368UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_range_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005369 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005370 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5371 (upb_Message*)msg, &field, arena);
5372 if (size) {
5373 *size = arr ? arr->size : 0;
5374 }
5375 return arr;
5376}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005377UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) {
5378 size_t size;
5379 google_protobuf_DescriptorProto_extension_range(msg, &size);
5380 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005381}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005382UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005383 const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005384 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005385}
Eric Salob7d54ac2022-12-29 11:59:42 -08005386UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005387 const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005388 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5389 if (arr) {
5390 if (size) *size = arr->size;
5391 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
5392 } else {
5393 if (size) *size = 0;
5394 return NULL;
5395 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005396}
Deanna Garciab26afb52023-04-25 13:37:18 -07005397UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005398 const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005399 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5400 if (size) {
5401 *size = arr ? arr->size : 0;
5402 }
5403 return arr;
5404}
5405UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005406 const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005407 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5408 (upb_Message*)msg, &field, arena);
5409 if (size) {
5410 *size = arr ? arr->size : 0;
5411 }
5412 return arr;
5413}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005414UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) {
5415 size_t size;
5416 google_protobuf_DescriptorProto_extension(msg, &size);
5417 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005418}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005419UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005420 const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005421 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005422}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005423UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005424 const google_protobuf_MessageOptions* default_val = NULL;
5425 const google_protobuf_MessageOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07005426 const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005427 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005428 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005429}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005430UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005431 const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005432 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005433}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005434UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005435 const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005436 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005437}
Eric Salob7d54ac2022-12-29 11:59:42 -08005438UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005439 const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005440 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5441 if (arr) {
5442 if (size) *size = arr->size;
5443 return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr);
5444 } else {
5445 if (size) *size = 0;
5446 return NULL;
5447 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005448}
Deanna Garciab26afb52023-04-25 13:37:18 -07005449UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_oneof_decl_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005450 const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005451 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5452 if (size) {
5453 *size = arr ? arr->size : 0;
5454 }
5455 return arr;
5456}
5457UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_oneof_decl_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005458 const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005459 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5460 (upb_Message*)msg, &field, arena);
5461 if (size) {
5462 *size = arr ? arr->size : 0;
5463 }
5464 return arr;
5465}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005466UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) {
5467 size_t size;
5468 google_protobuf_DescriptorProto_oneof_decl(msg, &size);
5469 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005470}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005471UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005472 const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005473 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005474}
Eric Salob7d54ac2022-12-29 11:59:42 -08005475UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005476 const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005477 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5478 if (arr) {
5479 if (size) *size = arr->size;
5480 return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr);
5481 } else {
5482 if (size) *size = 0;
5483 return NULL;
5484 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005485}
Deanna Garciab26afb52023-04-25 13:37:18 -07005486UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005487 const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005488 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5489 if (size) {
5490 *size = arr ? arr->size : 0;
5491 }
5492 return arr;
5493}
5494UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_range_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005495 const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005496 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5497 (upb_Message*)msg, &field, arena);
5498 if (size) {
5499 *size = arr ? arr->size : 0;
5500 }
5501 return arr;
5502}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005503UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) {
5504 size_t size;
5505 google_protobuf_DescriptorProto_reserved_range(msg, &size);
5506 return size != 0;
5507}
5508UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005509 const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005510 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005511}
Eric Salob7d54ac2022-12-29 11:59:42 -08005512UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005513 const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005514 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5515 if (arr) {
5516 if (size) *size = arr->size;
5517 return (upb_StringView const*)_upb_array_constptr(arr);
5518 } else {
5519 if (size) *size = 0;
5520 return NULL;
5521 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005522}
Deanna Garciab26afb52023-04-25 13:37:18 -07005523UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_name_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005524 const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005525 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5526 if (size) {
5527 *size = arr ? arr->size : 0;
5528 }
5529 return arr;
5530}
5531UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_name_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005532 const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005533 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5534 (upb_Message*)msg, &field, arena);
5535 if (size) {
5536 *size = arr ? arr->size : 0;
5537 }
5538 return arr;
5539}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005540UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) {
5541 size_t size;
5542 google_protobuf_DescriptorProto_reserved_name(msg, &size);
5543 return size != 0;
5544}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005545
Joshua Habermanf41049a2022-01-21 14:41:25 -08005546UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005547 const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005548 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005549}
5550UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005551 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005552 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5553 if (arr) {
5554 if (size) *size = arr->size;
5555 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5556 } else {
5557 if (size) *size = 0;
5558 return NULL;
5559 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005560}
Eric Salob7d54ac2022-12-29 11:59:42 -08005561UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005562 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005563 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005564}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005565UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005566 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005567 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5568 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5569 return NULL;
5570 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005571 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005572 if (!arr || !sub) return NULL;
5573 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005574 return sub;
5575}
Eric Salob7d54ac2022-12-29 11:59:42 -08005576UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005577 upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005578 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5579 if (arr) {
5580 if (size) *size = arr->size;
5581 return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr);
5582 } else {
5583 if (size) *size = 0;
5584 return NULL;
5585 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005586}
Eric Salob7d54ac2022-12-29 11:59:42 -08005587UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005588 upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005589 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005590}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005591UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005592 upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005593 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5594 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5595 return NULL;
5596 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005597 struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005598 if (!arr || !sub) return NULL;
5599 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005600 return sub;
5601}
Eric Salob7d54ac2022-12-29 11:59:42 -08005602UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005603 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005604 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5605 if (arr) {
5606 if (size) *size = arr->size;
5607 return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr);
5608 } else {
5609 if (size) *size = 0;
5610 return NULL;
5611 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005612}
Eric Salob7d54ac2022-12-29 11:59:42 -08005613UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005614 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005615 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005616}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005617UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005618 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005619 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5620 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5621 return NULL;
5622 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005623 struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005624 if (!arr || !sub) return NULL;
5625 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005626 return sub;
5627}
Eric Salob7d54ac2022-12-29 11:59:42 -08005628UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005629 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005630 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5631 if (arr) {
5632 if (size) *size = arr->size;
5633 return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr);
5634 } else {
5635 if (size) *size = 0;
5636 return NULL;
5637 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005638}
Eric Salob7d54ac2022-12-29 11:59:42 -08005639UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005640 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005641 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005642}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005643UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005644 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005645 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5646 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5647 return NULL;
5648 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005649 struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ExtensionRange_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005650 if (!arr || !sub) return NULL;
5651 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005652 return sub;
5653}
Eric Salob7d54ac2022-12-29 11:59:42 -08005654UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005655 upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005656 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5657 if (arr) {
5658 if (size) *size = arr->size;
5659 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5660 } else {
5661 if (size) *size = 0;
5662 return NULL;
5663 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005664}
Eric Salob7d54ac2022-12-29 11:59:42 -08005665UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005666 upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005667 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005668}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005669UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005670 upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005671 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5672 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5673 return NULL;
5674 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005675 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005676 if (!arr || !sub) return NULL;
5677 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005678 return sub;
5679}
5680UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005681 const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005682 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005683}
5684UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005685 struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
5686 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005687 sub = (struct google_protobuf_MessageOptions*)_upb_Message_New(&google_protobuf_MessageOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005688 if (sub) google_protobuf_DescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005689 }
5690 return sub;
5691}
Eric Salob7d54ac2022-12-29 11:59:42 -08005692UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005693 upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005694 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5695 if (arr) {
5696 if (size) *size = arr->size;
5697 return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr);
5698 } else {
5699 if (size) *size = 0;
5700 return NULL;
5701 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005702}
Eric Salob7d54ac2022-12-29 11:59:42 -08005703UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005704 upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005705 return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005706}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005707UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005708 upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005709 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5710 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5711 return NULL;
5712 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005713 struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google_protobuf_OneofDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005714 if (!arr || !sub) return NULL;
5715 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005716 return sub;
5717}
Eric Salob7d54ac2022-12-29 11:59:42 -08005718UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005719 upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005720 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5721 if (arr) {
5722 if (size) *size = arr->size;
5723 return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr);
5724 } else {
5725 if (size) *size = 0;
5726 return NULL;
5727 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005728}
Eric Salob7d54ac2022-12-29 11:59:42 -08005729UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005730 upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005731 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005732}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005733UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005734 upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005735 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5736 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5737 return NULL;
5738 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005739 struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ReservedRange_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005740 if (!arr || !sub) return NULL;
5741 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005742 return sub;
5743}
Eric Salob7d54ac2022-12-29 11:59:42 -08005744UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005745 upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005746 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5747 if (arr) {
5748 if (size) *size = arr->size;
5749 return (upb_StringView*)_upb_array_ptr(arr);
5750 } else {
5751 if (size) *size = 0;
5752 return NULL;
5753 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005754}
Eric Salob7d54ac2022-12-29 11:59:42 -08005755UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005756 upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005757 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005758}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005759UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005760 upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005761 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5762 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5763 return false;
5764 }
5765 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5766 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005767}
5768
5769/* google.protobuf.DescriptorProto.ExtensionRange */
5770
Joshua Habermanf41049a2022-01-21 14:41:25 -08005771UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005772 return (google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ExtensionRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005773}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005774UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) {
5775 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005776 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005777 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005778 return NULL;
5779 }
5780 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005781}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005782UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size,
5783 const upb_ExtensionRegistry* extreg,
5784 int options, upb_Arena* arena) {
5785 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
5786 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005787 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005788 kUpb_DecodeStatus_Ok) {
5789 return NULL;
5790 }
5791 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005792}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005793UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005794 char* ptr;
5795 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, 0, arena, &ptr, len);
5796 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005797}
5798UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options,
5799 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005800 char* ptr;
5801 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, options, arena, &ptr, len);
5802 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005803}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005804UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005805 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005806 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005807}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005808UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005809 int32_t default_val = (int32_t)0;
5810 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005811 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005812 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005813 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005814}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005815UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005816 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005817 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005818}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005819UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005820 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005821 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005822}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005823UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005824 int32_t default_val = (int32_t)0;
5825 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005826 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005827 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005828 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005829}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005830UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005831 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005832 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005833}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005834UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005835 const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005836 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005837}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005838UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005839 const google_protobuf_ExtensionRangeOptions* default_val = NULL;
5840 const google_protobuf_ExtensionRangeOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07005841 const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005842 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005843 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005844}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005845UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005846 const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005847 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005848}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005849
5850UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005851 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005852 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005853}
5854UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005855 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005856 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005857}
5858UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005859 const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005860 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005861}
5862UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005863 struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
5864 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005865 sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005866 if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005867 }
5868 return sub;
5869}
5870
5871/* google.protobuf.DescriptorProto.ReservedRange */
5872
Joshua Habermanf41049a2022-01-21 14:41:25 -08005873UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005874 return (google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005875}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005876UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
5877 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005878 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005879 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005880 return NULL;
5881 }
5882 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005883}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005884UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size,
5885 const upb_ExtensionRegistry* extreg,
5886 int options, upb_Arena* arena) {
5887 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
5888 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005889 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005890 kUpb_DecodeStatus_Ok) {
5891 return NULL;
5892 }
5893 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005894}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005895UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005896 char* ptr;
5897 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, 0, arena, &ptr, len);
5898 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005899}
5900UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options,
5901 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005902 char* ptr;
5903 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, options, arena, &ptr, len);
5904 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005905}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005906UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005907 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005908 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005909}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005910UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005911 int32_t default_val = (int32_t)0;
5912 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005913 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005914 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005915 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005916}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005917UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005918 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005919 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005920}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005921UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005922 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005923 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005924}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005925UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005926 int32_t default_val = (int32_t)0;
5927 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005928 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005929 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005930 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005931}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005932UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005933 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005934 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005935}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005936
5937UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005938 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005939 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005940}
5941UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005942 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005943 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005944}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005945
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005946/* google.protobuf.ExtensionRangeOptions */
5947
Joshua Habermanf41049a2022-01-21 14:41:25 -08005948UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005949 return (google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005950}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005951UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
5952 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005953 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005954 if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005955 return NULL;
5956 }
5957 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005958}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005959UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size,
5960 const upb_ExtensionRegistry* extreg,
5961 int options, upb_Arena* arena) {
5962 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
5963 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005964 if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005965 kUpb_DecodeStatus_Ok) {
5966 return NULL;
5967 }
5968 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005969}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005970UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005971 char* ptr;
5972 (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, 0, arena, &ptr, len);
5973 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005974}
5975UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options,
5976 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005977 char* ptr;
5978 (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, options, arena, &ptr, len);
5979 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005980}
Mike Kruskal145900f2023-03-27 09:55:52 -07005981UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005982 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005983 _upb_Message_ClearNonExtensionField(msg, &field);
5984}
5985UPB_INLINE const google_protobuf_ExtensionRangeOptions_Declaration* const* google_protobuf_ExtensionRangeOptions_declaration(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005986 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005987 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5988 if (arr) {
5989 if (size) *size = arr->size;
5990 return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr);
5991 } else {
5992 if (size) *size = 0;
5993 return NULL;
5994 }
5995}
Deanna Garciab26afb52023-04-25 13:37:18 -07005996UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005997 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005998 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5999 if (size) {
6000 *size = arr ? arr->size : 0;
6001 }
6002 return arr;
6003}
6004UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_mutable_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006005 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006006 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6007 (upb_Message*)msg, &field, arena);
6008 if (size) {
6009 *size = arr ? arr->size : 0;
6010 }
6011 return arr;
6012}
Mike Kruskal145900f2023-03-27 09:55:52 -07006013UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) {
6014 size_t size;
6015 google_protobuf_ExtensionRangeOptions_declaration(msg, &size);
6016 return size != 0;
6017}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006018UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006019 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006020 _upb_Message_ClearNonExtensionField(msg, &field);
6021}
6022UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) {
6023 int32_t default_val = 1;
6024 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006025 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006026 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6027 return ret;
6028}
6029UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006030 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
6031 return _upb_Message_HasNonExtensionField(msg, &field);
6032}
6033UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) {
6034 const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6035 _upb_Message_ClearNonExtensionField(msg, &field);
6036}
6037UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) {
6038 const google_protobuf_FeatureSet* default_val = NULL;
6039 const google_protobuf_FeatureSet* ret;
6040 const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6041 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6042 return ret;
6043}
6044UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) {
6045 const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006046 return _upb_Message_HasNonExtensionField(msg, &field);
6047}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006048UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006049 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006050 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006051}
Eric Salob7d54ac2022-12-29 11:59:42 -08006052UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006053 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006054 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6055 if (arr) {
6056 if (size) *size = arr->size;
6057 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
6058 } else {
6059 if (size) *size = 0;
6060 return NULL;
6061 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006062}
Deanna Garciab26afb52023-04-25 13:37:18 -07006063UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006064 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006065 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6066 if (size) {
6067 *size = arr ? arr->size : 0;
6068 }
6069 return arr;
6070}
6071UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006072 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006073 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6074 (upb_Message*)msg, &field, arena);
6075 if (size) {
6076 *size = arr ? arr->size : 0;
6077 }
6078 return arr;
6079}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006080UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) {
6081 size_t size;
6082 google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size);
6083 return size != 0;
6084}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006085
Mike Kruskal145900f2023-03-27 09:55:52 -07006086UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_mutable_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006087 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006088 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6089 if (arr) {
6090 if (size) *size = arr->size;
6091 return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr);
6092 } else {
6093 if (size) *size = 0;
6094 return NULL;
6095 }
6096}
6097UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_resize_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006098 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006099 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006100}
6101UPB_INLINE struct google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_add_declaration(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006102 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006103 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6104 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6105 return NULL;
6106 }
6107 struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena);
6108 if (!arr || !sub) return NULL;
6109 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
6110 return sub;
6111}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006112UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006113 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006114 _upb_Message_SetNonExtensionField(msg, &field, &value);
6115}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006116UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) {
6117 const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
6118 _upb_Message_SetNonExtensionField(msg, &field, &value);
6119}
6120UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
6121 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg);
6122 if (sub == NULL) {
6123 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
6124 if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub);
6125 }
6126 return sub;
6127}
Eric Salob7d54ac2022-12-29 11:59:42 -08006128UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006129 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006130 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6131 if (arr) {
6132 if (size) *size = arr->size;
6133 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
6134 } else {
6135 if (size) *size = 0;
6136 return NULL;
6137 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006138}
Eric Salob7d54ac2022-12-29 11:59:42 -08006139UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006140 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006141 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006142}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006143UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006144 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006145 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6146 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6147 return NULL;
6148 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07006149 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08006150 if (!arr || !sub) return NULL;
6151 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006152 return sub;
6153}
6154
Mike Kruskal145900f2023-03-27 09:55:52 -07006155/* google.protobuf.ExtensionRangeOptions.Declaration */
6156
6157UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) {
6158 return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena);
6159}
6160UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) {
6161 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6162 if (!ret) return NULL;
6163 if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
6164 return NULL;
6165 }
6166 return ret;
6167}
6168UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size,
6169 const upb_ExtensionRegistry* extreg,
6170 int options, upb_Arena* arena) {
6171 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6172 if (!ret) return NULL;
6173 if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, extreg, options, arena) !=
6174 kUpb_DecodeStatus_Ok) {
6175 return NULL;
6176 }
6177 return ret;
6178}
6179UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) {
6180 char* ptr;
6181 (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, 0, arena, &ptr, len);
6182 return ptr;
6183}
6184UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options,
6185 upb_Arena* arena, size_t* len) {
6186 char* ptr;
6187 (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, options, arena, &ptr, len);
6188 return ptr;
6189}
6190UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006191 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006192 _upb_Message_ClearNonExtensionField(msg, &field);
6193}
6194UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6195 int32_t default_val = (int32_t)0;
6196 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006197 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006198 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6199 return ret;
6200}
6201UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006202 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006203 return _upb_Message_HasNonExtensionField(msg, &field);
6204}
6205UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006206 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006207 _upb_Message_ClearNonExtensionField(msg, &field);
6208}
6209UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6210 upb_StringView default_val = upb_StringView_FromString("");
6211 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006212 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006213 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6214 return ret;
6215}
6216UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006217 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006218 return _upb_Message_HasNonExtensionField(msg, &field);
6219}
6220UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006221 const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006222 _upb_Message_ClearNonExtensionField(msg, &field);
6223}
6224UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6225 upb_StringView default_val = upb_StringView_FromString("");
6226 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006227 const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006228 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6229 return ret;
6230}
6231UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006232 const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006233 return _upb_Message_HasNonExtensionField(msg, &field);
6234}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006235UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006236 const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006237 _upb_Message_ClearNonExtensionField(msg, &field);
6238}
6239UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6240 bool default_val = false;
6241 bool ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07006242 const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006243 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6244 return ret;
6245}
6246UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006247 const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006248 return _upb_Message_HasNonExtensionField(msg, &field);
6249}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006250UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006251 const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006252 _upb_Message_ClearNonExtensionField(msg, &field);
6253}
6254UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6255 bool default_val = false;
6256 bool ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07006257 const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006258 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6259 return ret;
6260}
6261UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006262 const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006263 return _upb_Message_HasNonExtensionField(msg, &field);
6264}
Mike Kruskal145900f2023-03-27 09:55:52 -07006265
6266UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006267 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006268 _upb_Message_SetNonExtensionField(msg, &field, &value);
6269}
6270UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006271 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006272 _upb_Message_SetNonExtensionField(msg, &field, &value);
6273}
6274UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006275 const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07006276 _upb_Message_SetNonExtensionField(msg, &field, &value);
6277}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006278UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006279 const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006280 _upb_Message_SetNonExtensionField(msg, &field, &value);
6281}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006282UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006283 const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006284 _upb_Message_SetNonExtensionField(msg, &field, &value);
6285}
Mike Kruskal145900f2023-03-27 09:55:52 -07006286
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006287/* google.protobuf.FieldDescriptorProto */
6288
Joshua Habermanf41049a2022-01-21 14:41:25 -08006289UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006290 return (google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006291}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006292UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6293 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006294 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006295 if (upb_Decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006296 return NULL;
6297 }
6298 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006299}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006300UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size,
6301 const upb_ExtensionRegistry* extreg,
6302 int options, upb_Arena* arena) {
6303 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
6304 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006305 if (upb_Decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006306 kUpb_DecodeStatus_Ok) {
6307 return NULL;
6308 }
6309 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006310}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006311UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006312 char* ptr;
6313 (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, 0, arena, &ptr, len);
6314 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006315}
6316UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options,
6317 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006318 char* ptr;
6319 (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, options, arena, &ptr, len);
6320 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006321}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006322UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006323 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006324 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006325}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006326UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006327 upb_StringView default_val = upb_StringView_FromString("");
6328 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006329 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006330 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006331 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006332}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006333UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006334 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006335 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006336}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006337UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006338 const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006339 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006340}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006341UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006342 upb_StringView default_val = upb_StringView_FromString("");
6343 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006344 const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006345 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006346 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006347}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006348UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006349 const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006350 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006351}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006352UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006353 const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006354 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006355}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006356UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006357 int32_t default_val = (int32_t)0;
6358 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006359 const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006360 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006361 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006362}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006363UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006364 const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006365 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006366}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006367UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006368 const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006369 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006370}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006371UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006372 int32_t default_val = 1;
6373 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006374 const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006375 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006376 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006377}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006378UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006379 const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006380 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006381}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006382UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006383 const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006384 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006385}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006386UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006387 int32_t default_val = 1;
6388 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006389 const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006390 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006391 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006392}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006393UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006394 const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006395 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006396}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006397UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006398 const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006399 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006400}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006401UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006402 upb_StringView default_val = upb_StringView_FromString("");
6403 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006404 const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006405 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006406 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006407}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006408UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006409 const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006410 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006411}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006412UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006413 const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006414 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006415}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006416UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006417 upb_StringView default_val = upb_StringView_FromString("");
6418 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006419 const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006420 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006421 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006422}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006423UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006424 const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006425 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006426}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006427UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006428 const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006429 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006430}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006431UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006432 const google_protobuf_FieldOptions* default_val = NULL;
6433 const google_protobuf_FieldOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006434 const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006435 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006436 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006437}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006438UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006439 const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006440 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006441}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006442UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006443 const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006444 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006445}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006446UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006447 int32_t default_val = (int32_t)0;
6448 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006449 const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006450 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006451 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006452}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006453UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006454 const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006455 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006456}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006457UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006458 const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006459 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006460}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006461UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006462 upb_StringView default_val = upb_StringView_FromString("");
6463 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006464 const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006465 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006466 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006467}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006468UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006469 const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006470 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006471}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006472UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006473 const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006474 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006475}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006476UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006477 bool default_val = false;
6478 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07006479 const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006480 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006481 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006482}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006483UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006484 const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006485 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006486}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006487
6488UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006489 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006490 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006491}
6492UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006493 const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006494 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006495}
6496UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006497 const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006498 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006499}
6500UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006501 const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006502 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006503}
6504UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006505 const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006506 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006507}
6508UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006509 const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006510 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006511}
6512UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006513 const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006514 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006515}
6516UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006517 const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006518 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006519}
6520UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006521 struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
6522 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006523 sub = (struct google_protobuf_FieldOptions*)_upb_Message_New(&google_protobuf_FieldOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006524 if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006525 }
6526 return sub;
6527}
6528UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006529 const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006530 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006531}
6532UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006533 const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006534 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006535}
6536UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07006537 const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006538 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006539}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006540
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006541/* google.protobuf.OneofDescriptorProto */
6542
Joshua Habermanf41049a2022-01-21 14:41:25 -08006543UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006544 return (google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google_protobuf_OneofDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006545}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006546UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6547 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006548 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006549 if (upb_Decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006550 return NULL;
6551 }
6552 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006553}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006554UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size,
6555 const upb_ExtensionRegistry* extreg,
6556 int options, upb_Arena* arena) {
6557 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
6558 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006559 if (upb_Decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006560 kUpb_DecodeStatus_Ok) {
6561 return NULL;
6562 }
6563 return ret;
6564}
6565UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006566 char* ptr;
6567 (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, 0, arena, &ptr, len);
6568 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006569}
6570UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options,
6571 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006572 char* ptr;
6573 (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, options, arena, &ptr, len);
6574 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006575}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006576UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006577 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006578 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006579}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006580UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006581 upb_StringView default_val = upb_StringView_FromString("");
6582 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006583 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006584 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006585 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006586}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006587UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006588 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006589 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006590}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006591UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006592 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006593 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006594}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006595UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006596 const google_protobuf_OneofOptions* default_val = NULL;
6597 const google_protobuf_OneofOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006598 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006599 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006600 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006601}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006602UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006603 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006604 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006605}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006606
Joshua Habermanf41049a2022-01-21 14:41:25 -08006607UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006608 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006609 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006610}
6611UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006612 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006613 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006614}
6615UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006616 struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
6617 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006618 sub = (struct google_protobuf_OneofOptions*)_upb_Message_New(&google_protobuf_OneofOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006619 if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006620 }
6621 return sub;
6622}
6623
6624/* google.protobuf.EnumDescriptorProto */
6625
Joshua Habermanf41049a2022-01-21 14:41:25 -08006626UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006627 return (google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006628}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006629UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6630 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006631 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006632 if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006633 return NULL;
6634 }
6635 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006636}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006637UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size,
6638 const upb_ExtensionRegistry* extreg,
6639 int options, upb_Arena* arena) {
6640 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
6641 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006642 if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006643 kUpb_DecodeStatus_Ok) {
6644 return NULL;
6645 }
6646 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006647}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006648UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006649 char* ptr;
6650 (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, 0, arena, &ptr, len);
6651 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006652}
6653UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options,
6654 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006655 char* ptr;
6656 (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, options, arena, &ptr, len);
6657 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006658}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006659UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006660 const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006661 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006662}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006663UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006664 upb_StringView default_val = upb_StringView_FromString("");
6665 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006666 const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006667 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006668 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006669}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006670UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006671 const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006672 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006673}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006674UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006675 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006676 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006677}
Eric Salob7d54ac2022-12-29 11:59:42 -08006678UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006679 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006680 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6681 if (arr) {
6682 if (size) *size = arr->size;
6683 return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr);
6684 } else {
6685 if (size) *size = 0;
6686 return NULL;
6687 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006688}
Deanna Garciab26afb52023-04-25 13:37:18 -07006689UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_value_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006690 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006691 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6692 if (size) {
6693 *size = arr ? arr->size : 0;
6694 }
6695 return arr;
6696}
6697UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_value_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006698 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006699 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6700 (upb_Message*)msg, &field, arena);
6701 if (size) {
6702 *size = arr ? arr->size : 0;
6703 }
6704 return arr;
6705}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006706UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) {
6707 size_t size;
6708 google_protobuf_EnumDescriptorProto_value(msg, &size);
6709 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006710}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006711UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006712 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006713 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006714}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006715UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006716 const google_protobuf_EnumOptions* default_val = NULL;
6717 const google_protobuf_EnumOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006718 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006719 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006720 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006721}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006722UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006723 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006724 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006725}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006726UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006727 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006728 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006729}
Eric Salob7d54ac2022-12-29 11:59:42 -08006730UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006731 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006732 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6733 if (arr) {
6734 if (size) *size = arr->size;
6735 return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr);
6736 } else {
6737 if (size) *size = 0;
6738 return NULL;
6739 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006740}
Deanna Garciab26afb52023-04-25 13:37:18 -07006741UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006742 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006743 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6744 if (size) {
6745 *size = arr ? arr->size : 0;
6746 }
6747 return arr;
6748}
6749UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006750 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006751 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6752 (upb_Message*)msg, &field, arena);
6753 if (size) {
6754 *size = arr ? arr->size : 0;
6755 }
6756 return arr;
6757}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006758UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) {
6759 size_t size;
6760 google_protobuf_EnumDescriptorProto_reserved_range(msg, &size);
6761 return size != 0;
6762}
6763UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006764 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006765 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006766}
Eric Salob7d54ac2022-12-29 11:59:42 -08006767UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006768 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006769 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6770 if (arr) {
6771 if (size) *size = arr->size;
6772 return (upb_StringView const*)_upb_array_constptr(arr);
6773 } else {
6774 if (size) *size = 0;
6775 return NULL;
6776 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006777}
Deanna Garciab26afb52023-04-25 13:37:18 -07006778UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006779 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006780 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6781 if (size) {
6782 *size = arr ? arr->size : 0;
6783 }
6784 return arr;
6785}
6786UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006787 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006788 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6789 (upb_Message*)msg, &field, arena);
6790 if (size) {
6791 *size = arr ? arr->size : 0;
6792 }
6793 return arr;
6794}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006795UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) {
6796 size_t size;
6797 google_protobuf_EnumDescriptorProto_reserved_name(msg, &size);
6798 return size != 0;
6799}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006800
Joshua Habermanf41049a2022-01-21 14:41:25 -08006801UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006802 const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006803 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006804}
6805UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006806 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006807 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6808 if (arr) {
6809 if (size) *size = arr->size;
6810 return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr);
6811 } else {
6812 if (size) *size = 0;
6813 return NULL;
6814 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006815}
Eric Salob7d54ac2022-12-29 11:59:42 -08006816UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006817 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006818 return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006819}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006820UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006821 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006822 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6823 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6824 return NULL;
6825 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07006826 struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google_protobuf_EnumValueDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08006827 if (!arr || !sub) return NULL;
6828 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006829 return sub;
6830}
6831UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006832 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006833 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006834}
6835UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006836 struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
6837 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006838 sub = (struct google_protobuf_EnumOptions*)_upb_Message_New(&google_protobuf_EnumOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006839 if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006840 }
6841 return sub;
6842}
Eric Salob7d54ac2022-12-29 11:59:42 -08006843UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006844 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006845 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6846 if (arr) {
6847 if (size) *size = arr->size;
6848 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr);
6849 } else {
6850 if (size) *size = 0;
6851 return NULL;
6852 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006853}
Eric Salob7d54ac2022-12-29 11:59:42 -08006854UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006855 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006856 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006857}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006858UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006859 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006860 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6861 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6862 return NULL;
6863 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07006864 struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08006865 if (!arr || !sub) return NULL;
6866 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006867 return sub;
6868}
Eric Salob7d54ac2022-12-29 11:59:42 -08006869UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006870 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006871 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6872 if (arr) {
6873 if (size) *size = arr->size;
6874 return (upb_StringView*)_upb_array_ptr(arr);
6875 } else {
6876 if (size) *size = 0;
6877 return NULL;
6878 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006879}
Eric Salob7d54ac2022-12-29 11:59:42 -08006880UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006881 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006882 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006883}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006884UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006885 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006886 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6887 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6888 return false;
6889 }
6890 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
6891 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006892}
6893
6894/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
6895
Joshua Habermanf41049a2022-01-21 14:41:25 -08006896UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006897 return (google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006898}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006899UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6900 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006901 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006902 if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006903 return NULL;
6904 }
6905 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006906}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006907UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size,
6908 const upb_ExtensionRegistry* extreg,
6909 int options, upb_Arena* arena) {
6910 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
6911 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006912 if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006913 kUpb_DecodeStatus_Ok) {
6914 return NULL;
6915 }
6916 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006917}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006918UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006919 char* ptr;
6920 (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, 0, arena, &ptr, len);
6921 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006922}
6923UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options,
6924 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006925 char* ptr;
6926 (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, options, arena, &ptr, len);
6927 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006928}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006929UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006930 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006931 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006932}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006933UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006934 int32_t default_val = (int32_t)0;
6935 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006936 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006937 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006938 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006939}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006940UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006941 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006942 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006943}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006944UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006945 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006946 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006947}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006948UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006949 int32_t default_val = (int32_t)0;
6950 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006951 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006952 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006953 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006954}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006955UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006956 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006957 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006958}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006959
6960UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006961 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006962 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006963}
6964UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006965 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006966 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006967}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006968
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006969/* google.protobuf.EnumValueDescriptorProto */
6970
Joshua Habermanf41049a2022-01-21 14:41:25 -08006971UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006972 return (google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google_protobuf_EnumValueDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006973}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006974UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6975 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006976 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006977 if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006978 return NULL;
6979 }
6980 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006981}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006982UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size,
6983 const upb_ExtensionRegistry* extreg,
6984 int options, upb_Arena* arena) {
6985 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
6986 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006987 if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006988 kUpb_DecodeStatus_Ok) {
6989 return NULL;
6990 }
6991 return ret;
6992}
6993UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006994 char* ptr;
6995 (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len);
6996 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006997}
6998UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options,
6999 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007000 char* ptr;
7001 (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, options, arena, &ptr, len);
7002 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007003}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007004UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007005 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007006 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007007}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007008UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007009 upb_StringView default_val = upb_StringView_FromString("");
7010 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007011 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007012 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007013 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007014}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007015UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007016 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007017 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007018}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007019UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007020 const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007021 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007022}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007023UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007024 int32_t default_val = (int32_t)0;
7025 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07007026 const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007027 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007028 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007029}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007030UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007031 const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007032 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007033}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007034UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007035 const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007036 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007037}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007038UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007039 const google_protobuf_EnumValueOptions* default_val = NULL;
7040 const google_protobuf_EnumValueOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07007041 const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007042 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007043 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007044}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007045UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007046 const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007047 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007048}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007049
Joshua Habermanf41049a2022-01-21 14:41:25 -08007050UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007051 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007052 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007053}
7054UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07007055 const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007056 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007057}
7058UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07007059 const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007060 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007061}
7062UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007063 struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
7064 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007065 sub = (struct google_protobuf_EnumValueOptions*)_upb_Message_New(&google_protobuf_EnumValueOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007066 if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007067 }
7068 return sub;
7069}
7070
7071/* google.protobuf.ServiceDescriptorProto */
7072
Joshua Habermanf41049a2022-01-21 14:41:25 -08007073UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007074 return (google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google_protobuf_ServiceDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007075}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007076UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7077 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007078 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007079 if (upb_Decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007080 return NULL;
7081 }
7082 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007083}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007084UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size,
7085 const upb_ExtensionRegistry* extreg,
7086 int options, upb_Arena* arena) {
7087 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
7088 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007089 if (upb_Decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007090 kUpb_DecodeStatus_Ok) {
7091 return NULL;
7092 }
7093 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007094}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007095UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007096 char* ptr;
7097 (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, 0, arena, &ptr, len);
7098 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007099}
7100UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options,
7101 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007102 char* ptr;
7103 (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, options, arena, &ptr, len);
7104 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007105}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007106UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007107 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007108 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007109}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007110UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007111 upb_StringView default_val = upb_StringView_FromString("");
7112 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007113 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007114 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007115 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007116}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007117UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007118 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007119 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007120}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007121UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007122 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007123 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007124}
Eric Salob7d54ac2022-12-29 11:59:42 -08007125UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07007126 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007127 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7128 if (arr) {
7129 if (size) *size = arr->size;
7130 return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr);
7131 } else {
7132 if (size) *size = 0;
7133 return NULL;
7134 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007135}
Deanna Garciab26afb52023-04-25 13:37:18 -07007136UPB_INLINE const upb_Array* _google_protobuf_ServiceDescriptorProto_method_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07007137 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007138 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7139 if (size) {
7140 *size = arr ? arr->size : 0;
7141 }
7142 return arr;
7143}
7144UPB_INLINE upb_Array* _google_protobuf_ServiceDescriptorProto_method_mutable_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07007145 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007146 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7147 (upb_Message*)msg, &field, arena);
7148 if (size) {
7149 *size = arr ? arr->size : 0;
7150 }
7151 return arr;
7152}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007153UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) {
7154 size_t size;
7155 google_protobuf_ServiceDescriptorProto_method(msg, &size);
7156 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007157}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007158UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007159 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007160 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007161}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007162UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007163 const google_protobuf_ServiceOptions* default_val = NULL;
7164 const google_protobuf_ServiceOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07007165 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007166 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007167 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007168}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007169UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007170 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007171 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007172}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007173
Joshua Habermanf41049a2022-01-21 14:41:25 -08007174UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007175 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007176 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007177}
7178UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07007179 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007180 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7181 if (arr) {
7182 if (size) *size = arr->size;
7183 return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr);
7184 } else {
7185 if (size) *size = 0;
7186 return NULL;
7187 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007188}
Eric Salob7d54ac2022-12-29 11:59:42 -08007189UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07007190 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07007191 return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007192}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007193UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07007194 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007195 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7196 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7197 return NULL;
7198 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07007199 struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google_protobuf_MethodDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08007200 if (!arr || !sub) return NULL;
7201 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007202 return sub;
7203}
7204UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07007205 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007206 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007207}
7208UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007209 struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
7210 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007211 sub = (struct google_protobuf_ServiceOptions*)_upb_Message_New(&google_protobuf_ServiceOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007212 if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007213 }
7214 return sub;
7215}
7216
7217/* google.protobuf.MethodDescriptorProto */
7218
Joshua Habermanf41049a2022-01-21 14:41:25 -08007219UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007220 return (google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google_protobuf_MethodDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007221}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007222UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7223 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007224 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007225 if (upb_Decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007226 return NULL;
7227 }
7228 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007229}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007230UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size,
7231 const upb_ExtensionRegistry* extreg,
7232 int options, upb_Arena* arena) {
7233 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
7234 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007235 if (upb_Decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007236 kUpb_DecodeStatus_Ok) {
7237 return NULL;
7238 }
7239 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007240}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007241UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007242 char* ptr;
7243 (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, 0, arena, &ptr, len);
7244 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007245}
7246UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options,
7247 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007248 char* ptr;
7249 (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, options, arena, &ptr, len);
7250 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007251}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007252UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007253 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007254 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007255}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007256UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007257 upb_StringView default_val = upb_StringView_FromString("");
7258 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007259 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007260 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007261 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007262}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007263UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007264 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007265 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007266}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007267UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007268 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007269 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007270}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007271UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007272 upb_StringView default_val = upb_StringView_FromString("");
7273 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007274 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007275 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007276 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007277}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007278UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007279 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007280 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007281}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007282UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007283 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007284 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007285}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007286UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007287 upb_StringView default_val = upb_StringView_FromString("");
7288 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007289 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007290 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007291 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007292}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007293UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007294 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007295 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007296}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007297UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007298 const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007299 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007300}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007301UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007302 const google_protobuf_MethodOptions* default_val = NULL;
7303 const google_protobuf_MethodOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07007304 const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007305 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007306 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007307}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007308UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007309 const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007310 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007311}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007312UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007313 const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007314 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007315}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007316UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007317 bool default_val = false;
7318 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007319 const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007320 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007321 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007322}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007323UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007324 const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007325 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007326}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007327UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007328 const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007329 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007330}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007331UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007332 bool default_val = false;
7333 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007334 const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007335 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007336 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007337}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007338UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007339 const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007340 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007341}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007342
Joshua Habermanf41049a2022-01-21 14:41:25 -08007343UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007344 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007345 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007346}
7347UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007348 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007349 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007350}
7351UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007352 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007353 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007354}
7355UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07007356 const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007357 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007358}
7359UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007360 struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
7361 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007362 sub = (struct google_protobuf_MethodOptions*)_upb_Message_New(&google_protobuf_MethodOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007363 if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007364 }
7365 return sub;
7366}
7367UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007368 const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007369 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007370}
7371UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007372 const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007373 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007374}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007375
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007376/* google.protobuf.FileOptions */
7377
Joshua Habermanf41049a2022-01-21 14:41:25 -08007378UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007379 return (google_protobuf_FileOptions*)_upb_Message_New(&google_protobuf_FileOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007380}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007381UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7382 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007383 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007384 if (upb_Decode(buf, size, ret, &google_protobuf_FileOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007385 return NULL;
7386 }
7387 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007388}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007389UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size,
7390 const upb_ExtensionRegistry* extreg,
7391 int options, upb_Arena* arena) {
7392 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
7393 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007394 if (upb_Decode(buf, size, ret, &google_protobuf_FileOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007395 kUpb_DecodeStatus_Ok) {
7396 return NULL;
7397 }
7398 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007399}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007400UPB_INLINE char* google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007401 char* ptr;
7402 (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, 0, arena, &ptr, len);
7403 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007404}
7405UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options,
7406 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007407 char* ptr;
7408 (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, options, arena, &ptr, len);
7409 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007410}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007411UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007412 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007413 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007414}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007415UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007416 upb_StringView default_val = upb_StringView_FromString("");
7417 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007418 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007419 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007420 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007421}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007422UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007423 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007424 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007425}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007426UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007427 const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007428 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007429}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007430UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007431 upb_StringView default_val = upb_StringView_FromString("");
7432 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007433 const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007434 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007435 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007436}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007437UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007438 const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007439 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007440}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007441UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007442 const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007443 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007444}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007445UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007446 int32_t default_val = 1;
7447 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007448 const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007449 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007450 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007451}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007452UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007453 const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007454 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007455}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007456UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007457 const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007458 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007459}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007460UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007461 bool default_val = false;
7462 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007463 const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007464 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007465 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007466}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007467UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007468 const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007469 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007470}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007471UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007472 const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007473 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007474}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007475UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007476 upb_StringView default_val = upb_StringView_FromString("");
7477 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007478 const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007479 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007480 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007481}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007482UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007483 const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007484 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007485}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007486UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007487 const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007488 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007489}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007490UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007491 bool default_val = false;
7492 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007493 const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007494 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007495 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007496}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007497UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007498 const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007499 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007500}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007501UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007502 const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007503 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007504}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007505UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007506 bool default_val = false;
7507 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007508 const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007509 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007510 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007511}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007512UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007513 const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007514 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007515}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007516UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007517 const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007518 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007519}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007520UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007521 bool default_val = false;
7522 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007523 const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007524 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007525 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007526}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007527UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007528 const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007529 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007530}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007531UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007532 const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007533 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007534}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007535UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007536 bool default_val = false;
7537 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007538 const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007539 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007540 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007541}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007542UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007543 const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007544 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007545}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007546UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007547 const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007548 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007549}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007550UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007551 bool default_val = false;
7552 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007553 const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007554 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007555 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007556}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007557UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007558 const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007559 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007560}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007561UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007562 const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007563 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007564}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007565UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007566 bool default_val = false;
7567 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007568 const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007569 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007570 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007571}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007572UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007573 const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007574 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007575}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007576UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007577 const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007578 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007579}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007580UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007581 bool default_val = true;
7582 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007583 const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007584 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007585 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007586}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007587UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007588 const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007589 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007590}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007591UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007592 const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007593 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007594}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007595UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007596 upb_StringView default_val = upb_StringView_FromString("");
7597 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007598 const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007599 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007600 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007601}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007602UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007603 const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007604 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007605}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007606UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007607 const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007608 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007609}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007610UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007611 upb_StringView default_val = upb_StringView_FromString("");
7612 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007613 const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007614 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007615 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007616}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007617UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007618 const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007619 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007620}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007621UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007622 const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007623 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007624}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007625UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007626 upb_StringView default_val = upb_StringView_FromString("");
7627 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007628 const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007629 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007630 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007631}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007632UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007633 const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007634 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007635}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007636UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007637 const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007638 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007639}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007640UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007641 upb_StringView default_val = upb_StringView_FromString("");
7642 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007643 const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007644 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007645 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007646}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007647UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007648 const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007649 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007650}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007651UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007652 const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007653 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007654}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007655UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007656 upb_StringView default_val = upb_StringView_FromString("");
7657 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007658 const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007659 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007660 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007661}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007662UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007663 const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007664 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007665}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007666UPB_INLINE void google_protobuf_FileOptions_clear_php_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007667 const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007668 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007669}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007670UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007671 bool default_val = false;
7672 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007673 const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007674 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007675 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007676}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007677UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007678 const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007679 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007680}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007681UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007682 const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007683 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007684}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007685UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007686 upb_StringView default_val = upb_StringView_FromString("");
7687 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007688 const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007689 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007690 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007691}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007692UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007693 const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007694 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007695}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007696UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007697 const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007698 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007699}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007700UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007701 upb_StringView default_val = upb_StringView_FromString("");
7702 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007703 const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007704 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007705 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007706}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007707UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007708 const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7709 return _upb_Message_HasNonExtensionField(msg, &field);
7710}
7711UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) {
7712 const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7713 _upb_Message_ClearNonExtensionField(msg, &field);
7714}
7715UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) {
7716 const google_protobuf_FeatureSet* default_val = NULL;
7717 const google_protobuf_FeatureSet* ret;
7718 const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7719 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7720 return ret;
7721}
7722UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) {
7723 const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007724 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007725}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007726UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007727 const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007728 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007729}
Eric Salob7d54ac2022-12-29 11:59:42 -08007730UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007731 const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007732 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7733 if (arr) {
7734 if (size) *size = arr->size;
7735 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
7736 } else {
7737 if (size) *size = 0;
7738 return NULL;
7739 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007740}
Deanna Garciab26afb52023-04-25 13:37:18 -07007741UPB_INLINE const upb_Array* _google_protobuf_FileOptions_uninterpreted_option_upb_array(const google_protobuf_FileOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007742 const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007743 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7744 if (size) {
7745 *size = arr ? arr->size : 0;
7746 }
7747 return arr;
7748}
7749UPB_INLINE upb_Array* _google_protobuf_FileOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FileOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007750 const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007751 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7752 (upb_Message*)msg, &field, arena);
7753 if (size) {
7754 *size = arr ? arr->size : 0;
7755 }
7756 return arr;
7757}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007758UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) {
7759 size_t size;
7760 google_protobuf_FileOptions_uninterpreted_option(msg, &size);
7761 return size != 0;
7762}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007763
Joshua Habermanf41049a2022-01-21 14:41:25 -08007764UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007765 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007766 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007767}
7768UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007769 const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007770 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007771}
7772UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007773 const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007774 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007775}
7776UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007777 const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007778 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007779}
7780UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007781 const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007782 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007783}
7784UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007785 const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007786 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007787}
7788UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007789 const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007790 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007791}
7792UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007793 const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007794 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007795}
7796UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007797 const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007798 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007799}
7800UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007801 const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007802 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007803}
7804UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007805 const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007806 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007807}
7808UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007809 const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007810 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007811}
7812UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007813 const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007814 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007815}
7816UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007817 const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007818 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007819}
7820UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007821 const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007822 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007823}
7824UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007825 const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007826 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007827}
7828UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007829 const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007830 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007831}
7832UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007833 const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007834 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007835}
7836UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007837 const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007838 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007839}
7840UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007841 const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007842 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007843}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007844UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) {
7845 const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7846 _upb_Message_SetNonExtensionField(msg, &field, &value);
7847}
7848UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) {
7849 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg);
7850 if (sub == NULL) {
7851 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
7852 if (sub) google_protobuf_FileOptions_set_features(msg, sub);
7853 }
7854 return sub;
7855}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007856UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007857 upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007858 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7859 if (arr) {
7860 if (size) *size = arr->size;
7861 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
7862 } else {
7863 if (size) *size = 0;
7864 return NULL;
7865 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007866}
Eric Salob7d54ac2022-12-29 11:59:42 -08007867UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007868 upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07007869 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007870}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007871UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007872 upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007873 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7874 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7875 return NULL;
7876 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07007877 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08007878 if (!arr || !sub) return NULL;
7879 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007880 return sub;
7881}
7882
7883/* google.protobuf.MessageOptions */
7884
Joshua Habermanf41049a2022-01-21 14:41:25 -08007885UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007886 return (google_protobuf_MessageOptions*)_upb_Message_New(&google_protobuf_MessageOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007887}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007888UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7889 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007890 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007891 if (upb_Decode(buf, size, ret, &google_protobuf_MessageOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007892 return NULL;
7893 }
7894 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007895}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007896UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size,
7897 const upb_ExtensionRegistry* extreg,
7898 int options, upb_Arena* arena) {
7899 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
7900 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007901 if (upb_Decode(buf, size, ret, &google_protobuf_MessageOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007902 kUpb_DecodeStatus_Ok) {
7903 return NULL;
7904 }
7905 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007906}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007907UPB_INLINE char* google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007908 char* ptr;
7909 (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, 0, arena, &ptr, len);
7910 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007911}
7912UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options,
7913 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007914 char* ptr;
7915 (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, options, arena, &ptr, len);
7916 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007917}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007918UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007919 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007920 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007921}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007922UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007923 bool default_val = false;
7924 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007925 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007926 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007927 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007928}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007929UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007930 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007931 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007932}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007933UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007934 const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007935 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007936}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007937UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007938 bool default_val = false;
7939 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007940 const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007941 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007942 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007943}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007944UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007945 const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007946 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007947}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007948UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007949 const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007950 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007951}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007952UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007953 bool default_val = false;
7954 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007955 const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007956 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007957 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007958}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007959UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007960 const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007961 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007962}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007963UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007964 const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007965 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007966}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007967UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007968 bool default_val = false;
7969 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007970 const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007971 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007972 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007973}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007974UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007975 const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007976 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007977}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007978UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007979 const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007980 _upb_Message_ClearNonExtensionField(msg, &field);
7981}
7982UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
7983 bool default_val = false;
7984 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007985 const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007986 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7987 return ret;
7988}
7989UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007990 const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007991 return _upb_Message_HasNonExtensionField(msg, &field);
7992}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007993UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) {
7994 const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7995 _upb_Message_ClearNonExtensionField(msg, &field);
7996}
7997UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) {
7998 const google_protobuf_FeatureSet* default_val = NULL;
7999 const google_protobuf_FeatureSet* ret;
8000 const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8001 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8002 return ret;
8003}
8004UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) {
8005 const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8006 return _upb_Message_HasNonExtensionField(msg, &field);
8007}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008008UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008009 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008010 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008011}
Eric Salob7d54ac2022-12-29 11:59:42 -08008012UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008013 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008014 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8015 if (arr) {
8016 if (size) *size = arr->size;
8017 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8018 } else {
8019 if (size) *size = 0;
8020 return NULL;
8021 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008022}
Deanna Garciab26afb52023-04-25 13:37:18 -07008023UPB_INLINE const upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_upb_array(const google_protobuf_MessageOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008024 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008025 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8026 if (size) {
8027 *size = arr ? arr->size : 0;
8028 }
8029 return arr;
8030}
8031UPB_INLINE upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_MessageOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008032 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008033 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8034 (upb_Message*)msg, &field, arena);
8035 if (size) {
8036 *size = arr ? arr->size : 0;
8037 }
8038 return arr;
8039}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008040UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) {
8041 size_t size;
8042 google_protobuf_MessageOptions_uninterpreted_option(msg, &size);
8043 return size != 0;
8044}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008045
8046UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008047 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008048 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008049}
8050UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008051 const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008052 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008053}
8054UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008055 const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008056 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008057}
8058UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008059 const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008060 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008061}
8062UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008063 const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008064 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008065}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008066UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) {
8067 const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8068 _upb_Message_SetNonExtensionField(msg, &field, &value);
8069}
8070UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
8071 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg);
8072 if (sub == NULL) {
8073 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8074 if (sub) google_protobuf_MessageOptions_set_features(msg, sub);
8075 }
8076 return sub;
8077}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008078UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008079 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008080 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8081 if (arr) {
8082 if (size) *size = arr->size;
8083 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8084 } else {
8085 if (size) *size = 0;
8086 return NULL;
8087 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008088}
Eric Salob7d54ac2022-12-29 11:59:42 -08008089UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008090 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008091 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008092}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008093UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008094 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008095 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8096 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8097 return NULL;
8098 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008099 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008100 if (!arr || !sub) return NULL;
8101 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008102 return sub;
8103}
8104
8105/* google.protobuf.FieldOptions */
8106
Joshua Habermanf41049a2022-01-21 14:41:25 -08008107UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008108 return (google_protobuf_FieldOptions*)_upb_Message_New(&google_protobuf_FieldOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008109}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008110UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8111 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008112 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008113 if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008114 return NULL;
8115 }
8116 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008117}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008118UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size,
8119 const upb_ExtensionRegistry* extreg,
8120 int options, upb_Arena* arena) {
8121 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
8122 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008123 if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008124 kUpb_DecodeStatus_Ok) {
8125 return NULL;
8126 }
8127 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008128}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008129UPB_INLINE char* google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008130 char* ptr;
8131 (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, 0, arena, &ptr, len);
8132 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008133}
8134UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options,
8135 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008136 char* ptr;
8137 (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, options, arena, &ptr, len);
8138 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008139}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008140UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008141 const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008142 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008143}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008144UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008145 int32_t default_val = 0;
8146 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008147 const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008148 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008149 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008150}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008151UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008152 const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008153 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008154}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008155UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008156 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008157 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008158}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008159UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008160 bool default_val = false;
8161 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008162 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008163 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008164 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008165}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008166UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008167 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008168 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008169}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008170UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008171 const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008172 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008173}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008174UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008175 bool default_val = false;
8176 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008177 const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008178 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008179 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008180}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008181UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008182 const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008183 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008184}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008185UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008186 const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008187 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008188}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008189UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008190 bool default_val = false;
8191 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008192 const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008193 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008194 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008195}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008196UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008197 const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008198 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008199}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008200UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008201 const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008202 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008203}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008204UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008205 int32_t default_val = 0;
8206 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008207 const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008208 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008209 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008210}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008211UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008212 const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008213 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008214}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008215UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008216 const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008217 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008218}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008219UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008220 bool default_val = false;
8221 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008222 const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008223 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008224 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008225}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008226UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008227 const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008228 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008229}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008230UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008231 const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008232 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008233}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008234UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008235 bool default_val = false;
8236 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008237 const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008238 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008239 return ret;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008240}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008241UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008242 const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008243 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008244}
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008245UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008246 const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008247 _upb_Message_ClearNonExtensionField(msg, &field);
8248}
8249UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) {
8250 bool default_val = false;
8251 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008252 const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008253 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8254 return ret;
8255}
8256UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008257 const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008258 return _upb_Message_HasNonExtensionField(msg, &field);
8259}
Adam Cozzette5a568372023-01-24 20:35:59 -08008260UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008261 const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08008262 _upb_Message_ClearNonExtensionField(msg, &field);
8263}
8264UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) {
8265 int32_t default_val = 0;
8266 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008267 const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08008268 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8269 return ret;
8270}
8271UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008272 const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08008273 return _upb_Message_HasNonExtensionField(msg, &field);
8274}
Mike Kruskal0c121392023-03-18 00:05:41 -07008275UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008276 const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08008277 _upb_Message_ClearNonExtensionField(msg, &field);
8278}
Mike Kruskal0c121392023-03-18 00:05:41 -07008279UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008280 const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal0c121392023-03-18 00:05:41 -07008281 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8282 if (arr) {
8283 if (size) *size = arr->size;
8284 return (int32_t const*)_upb_array_constptr(arr);
8285 } else {
8286 if (size) *size = 0;
8287 return NULL;
8288 }
Adam Cozzette5a568372023-01-24 20:35:59 -08008289}
Deanna Garciab26afb52023-04-25 13:37:18 -07008290UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008291 const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008292 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8293 if (size) {
8294 *size = arr ? arr->size : 0;
8295 }
8296 return arr;
8297}
8298UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008299 const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008300 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8301 (upb_Message*)msg, &field, arena);
8302 if (size) {
8303 *size = arr ? arr->size : 0;
8304 }
8305 return arr;
8306}
Mike Kruskal0c121392023-03-18 00:05:41 -07008307UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) {
8308 size_t size;
8309 google_protobuf_FieldOptions_targets(msg, &size);
8310 return size != 0;
Adam Cozzette5a568372023-01-24 20:35:59 -08008311}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008312UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008313 const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008314 _upb_Message_ClearNonExtensionField(msg, &field);
8315}
8316UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008317 const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008318 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8319 if (arr) {
8320 if (size) *size = arr->size;
8321 return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr);
8322 } else {
8323 if (size) *size = 0;
8324 return NULL;
8325 }
8326}
8327UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008328 const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008329 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8330 if (size) {
8331 *size = arr ? arr->size : 0;
8332 }
8333 return arr;
8334}
8335UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008336 const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008337 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8338 (upb_Message*)msg, &field, arena);
8339 if (size) {
8340 *size = arr ? arr->size : 0;
8341 }
8342 return arr;
8343}
8344UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) {
8345 size_t size;
8346 google_protobuf_FieldOptions_edition_defaults(msg, &size);
8347 return size != 0;
8348}
8349UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008350 const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008351 _upb_Message_ClearNonExtensionField(msg, &field);
8352}
8353UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) {
8354 const google_protobuf_FeatureSet* default_val = NULL;
8355 const google_protobuf_FeatureSet* ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07008356 const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008357 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8358 return ret;
8359}
8360UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008361 const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008362 return _upb_Message_HasNonExtensionField(msg, &field);
8363}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008364UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008365 const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008366 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008367}
Eric Salob7d54ac2022-12-29 11:59:42 -08008368UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008369 const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008370 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8371 if (arr) {
8372 if (size) *size = arr->size;
8373 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8374 } else {
8375 if (size) *size = 0;
8376 return NULL;
8377 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008378}
Deanna Garciab26afb52023-04-25 13:37:18 -07008379UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008380 const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008381 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8382 if (size) {
8383 *size = arr ? arr->size : 0;
8384 }
8385 return arr;
8386}
8387UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008388 const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008389 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8390 (upb_Message*)msg, &field, arena);
8391 if (size) {
8392 *size = arr ? arr->size : 0;
8393 }
8394 return arr;
8395}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008396UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) {
8397 size_t size;
8398 google_protobuf_FieldOptions_uninterpreted_option(msg, &size);
8399 return size != 0;
8400}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008401
8402UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008403 const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008404 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008405}
8406UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008407 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008408 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008409}
8410UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008411 const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008412 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008413}
8414UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008415 const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008416 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008417}
8418UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008419 const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008420 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008421}
8422UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008423 const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008424 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008425}
8426UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008427 const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008428 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008429}
8430UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008431 const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008432 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008433}
Adam Cozzette5a568372023-01-24 20:35:59 -08008434UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008435 const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08008436 _upb_Message_SetNonExtensionField(msg, &field, &value);
8437}
Mike Kruskal0c121392023-03-18 00:05:41 -07008438UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008439 upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal0c121392023-03-18 00:05:41 -07008440 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8441 if (arr) {
8442 if (size) *size = arr->size;
8443 return (int32_t*)_upb_array_ptr(arr);
8444 } else {
8445 if (size) *size = 0;
8446 return NULL;
8447 }
8448}
8449UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008450 upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008451 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Mike Kruskal0c121392023-03-18 00:05:41 -07008452}
8453UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008454 upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal0c121392023-03-18 00:05:41 -07008455 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8456 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8457 return false;
8458 }
8459 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
8460 return true;
Adam Cozzette5a568372023-01-24 20:35:59 -08008461}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008462UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008463 upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008464 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8465 if (arr) {
8466 if (size) *size = arr->size;
8467 return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr);
8468 } else {
8469 if (size) *size = 0;
8470 return NULL;
8471 }
8472}
8473UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008474 upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008475 return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
8476}
8477UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008478 upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008479 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8480 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8481 return NULL;
8482 }
8483 struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena);
8484 if (!arr || !sub) return NULL;
8485 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
8486 return sub;
8487}
8488UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008489 const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008490 _upb_Message_SetNonExtensionField(msg, &field, &value);
8491}
8492UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
8493 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg);
8494 if (sub == NULL) {
8495 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8496 if (sub) google_protobuf_FieldOptions_set_features(msg, sub);
8497 }
8498 return sub;
8499}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008500UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008501 upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008502 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8503 if (arr) {
8504 if (size) *size = arr->size;
8505 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8506 } else {
8507 if (size) *size = 0;
8508 return NULL;
8509 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008510}
Eric Salob7d54ac2022-12-29 11:59:42 -08008511UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008512 upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008513 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008514}
8515UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008516 upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008517 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8518 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8519 return NULL;
8520 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008521 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008522 if (!arr || !sub) return NULL;
8523 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008524 return sub;
8525}
8526
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008527/* google.protobuf.FieldOptions.EditionDefault */
8528
8529UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) {
8530 return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena);
8531}
8532UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
8533 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
8534 if (!ret) return NULL;
8535 if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
8536 return NULL;
8537 }
8538 return ret;
8539}
8540UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size,
8541 const upb_ExtensionRegistry* extreg,
8542 int options, upb_Arena* arena) {
8543 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
8544 if (!ret) return NULL;
8545 if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, extreg, options, arena) !=
8546 kUpb_DecodeStatus_Ok) {
8547 return NULL;
8548 }
8549 return ret;
8550}
8551UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) {
8552 char* ptr;
8553 (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, 0, arena, &ptr, len);
8554 return ptr;
8555}
8556UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options,
8557 upb_Arena* arena, size_t* len) {
8558 char* ptr;
8559 (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, options, arena, &ptr, len);
8560 return ptr;
8561}
8562UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008563 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008564 _upb_Message_ClearNonExtensionField(msg, &field);
8565}
8566UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
8567 upb_StringView default_val = upb_StringView_FromString("");
8568 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008569 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008570 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8571 return ret;
8572}
8573UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008574 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008575 return _upb_Message_HasNonExtensionField(msg, &field);
8576}
8577UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008578 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008579 _upb_Message_ClearNonExtensionField(msg, &field);
8580}
8581UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
8582 upb_StringView default_val = upb_StringView_FromString("");
8583 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008584 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008585 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8586 return ret;
8587}
8588UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008589 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8590 return _upb_Message_HasNonExtensionField(msg, &field);
8591}
8592UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition_enum(google_protobuf_FieldOptions_EditionDefault* msg) {
8593 const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8594 _upb_Message_ClearNonExtensionField(msg, &field);
8595}
8596UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition_enum(const google_protobuf_FieldOptions_EditionDefault* msg) {
8597 int32_t default_val = 0;
8598 int32_t ret;
8599 const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8600 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8601 return ret;
8602}
8603UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition_enum(const google_protobuf_FieldOptions_EditionDefault* msg) {
8604 const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008605 return _upb_Message_HasNonExtensionField(msg, &field);
8606}
8607
8608UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008609 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008610 _upb_Message_SetNonExtensionField(msg, &field, &value);
8611}
8612UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008613 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8614 _upb_Message_SetNonExtensionField(msg, &field, &value);
8615}
8616UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition_enum(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) {
8617 const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008618 _upb_Message_SetNonExtensionField(msg, &field, &value);
8619}
8620
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008621/* google.protobuf.OneofOptions */
8622
Joshua Habermanf41049a2022-01-21 14:41:25 -08008623UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008624 return (google_protobuf_OneofOptions*)_upb_Message_New(&google_protobuf_OneofOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008625}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008626UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8627 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008628 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008629 if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008630 return NULL;
8631 }
8632 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008633}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008634UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size,
8635 const upb_ExtensionRegistry* extreg,
8636 int options, upb_Arena* arena) {
8637 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
8638 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008639 if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008640 kUpb_DecodeStatus_Ok) {
8641 return NULL;
8642 }
8643 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008644}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008645UPB_INLINE char* google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008646 char* ptr;
8647 (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, 0, arena, &ptr, len);
8648 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008649}
8650UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options,
8651 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008652 char* ptr;
8653 (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, options, arena, &ptr, len);
8654 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008655}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008656UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) {
8657 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8658 _upb_Message_ClearNonExtensionField(msg, &field);
8659}
8660UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) {
8661 const google_protobuf_FeatureSet* default_val = NULL;
8662 const google_protobuf_FeatureSet* ret;
8663 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8664 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8665 return ret;
8666}
8667UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) {
8668 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8669 return _upb_Message_HasNonExtensionField(msg, &field);
8670}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008671UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008672 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008673 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008674}
Eric Salob7d54ac2022-12-29 11:59:42 -08008675UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008676 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008677 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8678 if (arr) {
8679 if (size) *size = arr->size;
8680 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8681 } else {
8682 if (size) *size = 0;
8683 return NULL;
8684 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008685}
Deanna Garciab26afb52023-04-25 13:37:18 -07008686UPB_INLINE const upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_upb_array(const google_protobuf_OneofOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008687 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008688 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8689 if (size) {
8690 *size = arr ? arr->size : 0;
8691 }
8692 return arr;
8693}
8694UPB_INLINE upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_OneofOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008695 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008696 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8697 (upb_Message*)msg, &field, arena);
8698 if (size) {
8699 *size = arr ? arr->size : 0;
8700 }
8701 return arr;
8702}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008703UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) {
8704 size_t size;
8705 google_protobuf_OneofOptions_uninterpreted_option(msg, &size);
8706 return size != 0;
8707}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008708
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008709UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) {
8710 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8711 _upb_Message_SetNonExtensionField(msg, &field, &value);
8712}
8713UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
8714 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg);
8715 if (sub == NULL) {
8716 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8717 if (sub) google_protobuf_OneofOptions_set_features(msg, sub);
8718 }
8719 return sub;
8720}
Eric Salob7d54ac2022-12-29 11:59:42 -08008721UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008722 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008723 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8724 if (arr) {
8725 if (size) *size = arr->size;
8726 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8727 } else {
8728 if (size) *size = 0;
8729 return NULL;
8730 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008731}
Eric Salob7d54ac2022-12-29 11:59:42 -08008732UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008733 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008734 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008735}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008736UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008737 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008738 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8739 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8740 return NULL;
8741 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008742 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008743 if (!arr || !sub) return NULL;
8744 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008745 return sub;
8746}
8747
8748/* google.protobuf.EnumOptions */
8749
Joshua Habermanf41049a2022-01-21 14:41:25 -08008750UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008751 return (google_protobuf_EnumOptions*)_upb_Message_New(&google_protobuf_EnumOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008752}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008753UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8754 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008755 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008756 if (upb_Decode(buf, size, ret, &google_protobuf_EnumOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008757 return NULL;
8758 }
8759 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008760}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008761UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size,
8762 const upb_ExtensionRegistry* extreg,
8763 int options, upb_Arena* arena) {
8764 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
8765 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008766 if (upb_Decode(buf, size, ret, &google_protobuf_EnumOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008767 kUpb_DecodeStatus_Ok) {
8768 return NULL;
8769 }
8770 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008771}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008772UPB_INLINE char* google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008773 char* ptr;
8774 (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, 0, arena, &ptr, len);
8775 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008776}
8777UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options,
8778 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008779 char* ptr;
8780 (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, options, arena, &ptr, len);
8781 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008782}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008783UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008784 const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008785 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008786}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008787UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008788 bool default_val = false;
8789 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008790 const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008791 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008792 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008793}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008794UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008795 const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008796 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008797}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008798UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008799 const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008800 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008801}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008802UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008803 bool default_val = false;
8804 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008805 const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008806 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008807 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008808}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008809UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008810 const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008811 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008812}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008813UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008814 const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008815 _upb_Message_ClearNonExtensionField(msg, &field);
8816}
8817UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
8818 bool default_val = false;
8819 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008820 const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008821 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8822 return ret;
8823}
8824UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008825 const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008826 return _upb_Message_HasNonExtensionField(msg, &field);
8827}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008828UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) {
8829 const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8830 _upb_Message_ClearNonExtensionField(msg, &field);
8831}
8832UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) {
8833 const google_protobuf_FeatureSet* default_val = NULL;
8834 const google_protobuf_FeatureSet* ret;
8835 const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8836 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8837 return ret;
8838}
8839UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) {
8840 const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8841 return _upb_Message_HasNonExtensionField(msg, &field);
8842}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008843UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008844 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008845 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008846}
Eric Salob7d54ac2022-12-29 11:59:42 -08008847UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008848 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008849 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8850 if (arr) {
8851 if (size) *size = arr->size;
8852 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8853 } else {
8854 if (size) *size = 0;
8855 return NULL;
8856 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008857}
Deanna Garciab26afb52023-04-25 13:37:18 -07008858UPB_INLINE const upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_upb_array(const google_protobuf_EnumOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008859 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008860 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8861 if (size) {
8862 *size = arr ? arr->size : 0;
8863 }
8864 return arr;
8865}
8866UPB_INLINE upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_EnumOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008867 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008868 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8869 (upb_Message*)msg, &field, arena);
8870 if (size) {
8871 *size = arr ? arr->size : 0;
8872 }
8873 return arr;
8874}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008875UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) {
8876 size_t size;
8877 google_protobuf_EnumOptions_uninterpreted_option(msg, &size);
8878 return size != 0;
8879}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008880
8881UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008882 const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008883 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008884}
8885UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008886 const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008887 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008888}
8889UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008890 const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008891 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008892}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008893UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) {
8894 const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8895 _upb_Message_SetNonExtensionField(msg, &field, &value);
8896}
8897UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
8898 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg);
8899 if (sub == NULL) {
8900 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8901 if (sub) google_protobuf_EnumOptions_set_features(msg, sub);
8902 }
8903 return sub;
8904}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008905UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008906 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008907 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8908 if (arr) {
8909 if (size) *size = arr->size;
8910 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8911 } else {
8912 if (size) *size = 0;
8913 return NULL;
8914 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008915}
Eric Salob7d54ac2022-12-29 11:59:42 -08008916UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008917 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008918 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008919}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008920UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008921 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008922 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8923 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8924 return NULL;
8925 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008926 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008927 if (!arr || !sub) return NULL;
8928 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008929 return sub;
8930}
8931
8932/* google.protobuf.EnumValueOptions */
8933
Joshua Habermanf41049a2022-01-21 14:41:25 -08008934UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008935 return (google_protobuf_EnumValueOptions*)_upb_Message_New(&google_protobuf_EnumValueOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008936}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008937UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8938 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008939 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008940 if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008941 return NULL;
8942 }
8943 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008944}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008945UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size,
8946 const upb_ExtensionRegistry* extreg,
8947 int options, upb_Arena* arena) {
8948 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
8949 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008950 if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008951 kUpb_DecodeStatus_Ok) {
8952 return NULL;
8953 }
8954 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008955}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008956UPB_INLINE char* google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008957 char* ptr;
8958 (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, 0, arena, &ptr, len);
8959 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008960}
8961UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options,
8962 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008963 char* ptr;
8964 (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, options, arena, &ptr, len);
8965 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008966}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008967UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008968 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008969 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008970}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008971UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008972 bool default_val = false;
8973 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008974 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008975 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008976 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008977}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008978UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008979 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008980 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008981}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008982UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) {
8983 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8984 _upb_Message_ClearNonExtensionField(msg, &field);
8985}
8986UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) {
8987 const google_protobuf_FeatureSet* default_val = NULL;
8988 const google_protobuf_FeatureSet* ret;
8989 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8990 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8991 return ret;
8992}
8993UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) {
8994 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8995 return _upb_Message_HasNonExtensionField(msg, &field);
8996}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008997UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008998 const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008999 _upb_Message_ClearNonExtensionField(msg, &field);
9000}
9001UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) {
9002 bool default_val = false;
9003 bool ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009004 const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009005 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9006 return ret;
9007}
9008UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009009 const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009010 return _upb_Message_HasNonExtensionField(msg, &field);
9011}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009012UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009013 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009014 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009015}
Eric Salob7d54ac2022-12-29 11:59:42 -08009016UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009017 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009018 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9019 if (arr) {
9020 if (size) *size = arr->size;
9021 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
9022 } else {
9023 if (size) *size = 0;
9024 return NULL;
9025 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009026}
Deanna Garciab26afb52023-04-25 13:37:18 -07009027UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009028 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009029 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9030 if (size) {
9031 *size = arr ? arr->size : 0;
9032 }
9033 return arr;
9034}
9035UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009036 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009037 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9038 (upb_Message*)msg, &field, arena);
9039 if (size) {
9040 *size = arr ? arr->size : 0;
9041 }
9042 return arr;
9043}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009044UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) {
9045 size_t size;
9046 google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size);
9047 return size != 0;
9048}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009049
9050UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009051 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009052 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009053}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009054UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) {
9055 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9056 _upb_Message_SetNonExtensionField(msg, &field, &value);
9057}
9058UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
9059 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg);
9060 if (sub == NULL) {
9061 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
9062 if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub);
9063 }
9064 return sub;
9065}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009066UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009067 const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009068 _upb_Message_SetNonExtensionField(msg, &field, &value);
9069}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009070UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009071 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009072 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9073 if (arr) {
9074 if (size) *size = arr->size;
9075 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
9076 } else {
9077 if (size) *size = 0;
9078 return NULL;
9079 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009080}
Eric Salob7d54ac2022-12-29 11:59:42 -08009081UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009082 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009083 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009084}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009085UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009086 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009087 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9088 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9089 return NULL;
9090 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07009091 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08009092 if (!arr || !sub) return NULL;
9093 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009094 return sub;
9095}
9096
9097/* google.protobuf.ServiceOptions */
9098
Joshua Habermanf41049a2022-01-21 14:41:25 -08009099UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009100 return (google_protobuf_ServiceOptions*)_upb_Message_New(&google_protobuf_ServiceOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009101}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009102UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9103 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009104 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009105 if (upb_Decode(buf, size, ret, &google_protobuf_ServiceOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009106 return NULL;
9107 }
9108 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009109}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009110UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size,
9111 const upb_ExtensionRegistry* extreg,
9112 int options, upb_Arena* arena) {
9113 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
9114 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009115 if (upb_Decode(buf, size, ret, &google_protobuf_ServiceOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009116 kUpb_DecodeStatus_Ok) {
9117 return NULL;
9118 }
9119 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009120}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009121UPB_INLINE char* google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009122 char* ptr;
9123 (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, 0, arena, &ptr, len);
9124 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009125}
9126UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options,
9127 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009128 char* ptr;
9129 (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, options, arena, &ptr, len);
9130 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009131}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009132UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009133 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009134 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009135}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009136UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009137 bool default_val = false;
9138 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009139 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009140 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009141 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009142}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009143UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009144 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009145 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009146}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009147UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) {
9148 const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9149 _upb_Message_ClearNonExtensionField(msg, &field);
9150}
9151UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) {
9152 const google_protobuf_FeatureSet* default_val = NULL;
9153 const google_protobuf_FeatureSet* ret;
9154 const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9155 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9156 return ret;
9157}
9158UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) {
9159 const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9160 return _upb_Message_HasNonExtensionField(msg, &field);
9161}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009162UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009163 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009164 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009165}
Eric Salob7d54ac2022-12-29 11:59:42 -08009166UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009167 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009168 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9169 if (arr) {
9170 if (size) *size = arr->size;
9171 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
9172 } else {
9173 if (size) *size = 0;
9174 return NULL;
9175 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009176}
Deanna Garciab26afb52023-04-25 13:37:18 -07009177UPB_INLINE const upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009178 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009179 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9180 if (size) {
9181 *size = arr ? arr->size : 0;
9182 }
9183 return arr;
9184}
9185UPB_INLINE upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009186 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009187 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9188 (upb_Message*)msg, &field, arena);
9189 if (size) {
9190 *size = arr ? arr->size : 0;
9191 }
9192 return arr;
9193}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009194UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) {
9195 size_t size;
9196 google_protobuf_ServiceOptions_uninterpreted_option(msg, &size);
9197 return size != 0;
9198}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009199
9200UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009201 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009202 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009203}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009204UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) {
9205 const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9206 _upb_Message_SetNonExtensionField(msg, &field, &value);
9207}
9208UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
9209 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg);
9210 if (sub == NULL) {
9211 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
9212 if (sub) google_protobuf_ServiceOptions_set_features(msg, sub);
9213 }
9214 return sub;
9215}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009216UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009217 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009218 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9219 if (arr) {
9220 if (size) *size = arr->size;
9221 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
9222 } else {
9223 if (size) *size = 0;
9224 return NULL;
9225 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009226}
Eric Salob7d54ac2022-12-29 11:59:42 -08009227UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009228 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009229 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009230}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009231UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009232 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009233 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9234 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9235 return NULL;
9236 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07009237 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08009238 if (!arr || !sub) return NULL;
9239 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009240 return sub;
9241}
9242
9243/* google.protobuf.MethodOptions */
9244
Joshua Habermanf41049a2022-01-21 14:41:25 -08009245UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009246 return (google_protobuf_MethodOptions*)_upb_Message_New(&google_protobuf_MethodOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009247}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009248UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9249 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009250 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009251 if (upb_Decode(buf, size, ret, &google_protobuf_MethodOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009252 return NULL;
9253 }
9254 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009255}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009256UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size,
9257 const upb_ExtensionRegistry* extreg,
9258 int options, upb_Arena* arena) {
9259 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
9260 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009261 if (upb_Decode(buf, size, ret, &google_protobuf_MethodOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009262 kUpb_DecodeStatus_Ok) {
9263 return NULL;
9264 }
9265 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009266}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009267UPB_INLINE char* google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009268 char* ptr;
9269 (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, 0, arena, &ptr, len);
9270 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009271}
9272UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options,
9273 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009274 char* ptr;
9275 (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, options, arena, &ptr, len);
9276 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009277}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009278UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009279 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009280 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009281}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009282UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009283 bool default_val = false;
9284 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009285 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009286 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009287 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009288}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009289UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009290 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009291 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009292}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009293UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009294 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009295 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009296}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009297UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009298 int32_t default_val = 0;
9299 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009300 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009301 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009302 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009303}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009304UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009305 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9306 return _upb_Message_HasNonExtensionField(msg, &field);
9307}
9308UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) {
9309 const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9310 _upb_Message_ClearNonExtensionField(msg, &field);
9311}
9312UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) {
9313 const google_protobuf_FeatureSet* default_val = NULL;
9314 const google_protobuf_FeatureSet* ret;
9315 const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9316 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9317 return ret;
9318}
9319UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) {
9320 const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009321 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009322}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009323UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009324 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009325 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009326}
Eric Salob7d54ac2022-12-29 11:59:42 -08009327UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009328 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009329 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9330 if (arr) {
9331 if (size) *size = arr->size;
9332 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
9333 } else {
9334 if (size) *size = 0;
9335 return NULL;
9336 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009337}
Deanna Garciab26afb52023-04-25 13:37:18 -07009338UPB_INLINE const upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_upb_array(const google_protobuf_MethodOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009339 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009340 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9341 if (size) {
9342 *size = arr ? arr->size : 0;
9343 }
9344 return arr;
9345}
9346UPB_INLINE upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_MethodOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009347 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009348 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9349 (upb_Message*)msg, &field, arena);
9350 if (size) {
9351 *size = arr ? arr->size : 0;
9352 }
9353 return arr;
9354}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009355UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) {
9356 size_t size;
9357 google_protobuf_MethodOptions_uninterpreted_option(msg, &size);
9358 return size != 0;
9359}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009360
9361UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009362 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009363 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009364}
9365UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009366 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009367 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009368}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009369UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) {
9370 const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9371 _upb_Message_SetNonExtensionField(msg, &field, &value);
9372}
9373UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
9374 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg);
9375 if (sub == NULL) {
9376 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
9377 if (sub) google_protobuf_MethodOptions_set_features(msg, sub);
9378 }
9379 return sub;
9380}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009381UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009382 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009383 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9384 if (arr) {
9385 if (size) *size = arr->size;
9386 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
9387 } else {
9388 if (size) *size = 0;
9389 return NULL;
9390 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009391}
Eric Salob7d54ac2022-12-29 11:59:42 -08009392UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009393 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009394 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009395}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009396UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009397 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009398 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9399 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9400 return NULL;
9401 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07009402 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08009403 if (!arr || !sub) return NULL;
9404 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009405 return sub;
9406}
9407
9408/* google.protobuf.UninterpretedOption */
9409
Joshua Habermanf41049a2022-01-21 14:41:25 -08009410UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009411 return (google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009412}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009413UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) {
9414 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009415 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009416 if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009417 return NULL;
9418 }
9419 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009420}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009421UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size,
9422 const upb_ExtensionRegistry* extreg,
9423 int options, upb_Arena* arena) {
9424 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
9425 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009426 if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009427 kUpb_DecodeStatus_Ok) {
9428 return NULL;
9429 }
9430 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009431}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009432UPB_INLINE char* google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009433 char* ptr;
9434 (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, 0, arena, &ptr, len);
9435 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009436}
9437UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options,
9438 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009439 char* ptr;
9440 (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, options, arena, &ptr, len);
9441 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009442}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009443UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009444 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009445 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009446}
Eric Salob7d54ac2022-12-29 11:59:42 -08009447UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009448 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009449 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9450 if (arr) {
9451 if (size) *size = arr->size;
9452 return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr);
9453 } else {
9454 if (size) *size = 0;
9455 return NULL;
9456 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009457}
Deanna Garciab26afb52023-04-25 13:37:18 -07009458UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009459 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009460 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9461 if (size) {
9462 *size = arr ? arr->size : 0;
9463 }
9464 return arr;
9465}
9466UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009467 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009468 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9469 (upb_Message*)msg, &field, arena);
9470 if (size) {
9471 *size = arr ? arr->size : 0;
9472 }
9473 return arr;
9474}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009475UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) {
9476 size_t size;
9477 google_protobuf_UninterpretedOption_name(msg, &size);
9478 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009479}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009480UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009481 const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009482 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009483}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009484UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009485 upb_StringView default_val = upb_StringView_FromString("");
9486 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009487 const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009488 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009489 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009490}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009491UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009492 const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009493 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009494}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009495UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009496 const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009497 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009498}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009499UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009500 uint64_t default_val = (uint64_t)0ull;
9501 uint64_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07009502 const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009503 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009504 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009505}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009506UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009507 const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009508 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009509}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009510UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009511 const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009512 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009513}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009514UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009515 int64_t default_val = (int64_t)0ll;
9516 int64_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07009517 const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009518 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009519 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009520}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009521UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009522 const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009523 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009524}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009525UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009526 const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009527 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009528}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009529UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009530 double default_val = 0;
9531 double ret;
Jie Luo3560e232023-06-12 00:33:50 -07009532 const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009533 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009534 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009535}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009536UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009537 const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009538 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009539}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009540UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009541 const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009542 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009543}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009544UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009545 upb_StringView default_val = upb_StringView_FromString("");
9546 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009547 const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009548 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009549 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009550}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009551UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009552 const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009553 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009554}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009555UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009556 const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009557 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009558}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009559UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009560 upb_StringView default_val = upb_StringView_FromString("");
9561 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009562 const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009563 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009564 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009565}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009566UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009567 const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009568 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009569}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009570
Eric Salob7d54ac2022-12-29 11:59:42 -08009571UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009572 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009573 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9574 if (arr) {
9575 if (size) *size = arr->size;
9576 return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr);
9577 } else {
9578 if (size) *size = 0;
9579 return NULL;
9580 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009581}
Eric Salob7d54ac2022-12-29 11:59:42 -08009582UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009583 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009584 return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009585}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009586UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009587 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009588 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9589 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9590 return NULL;
9591 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07009592 struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google_protobuf_UninterpretedOption_NamePart_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08009593 if (!arr || !sub) return NULL;
9594 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009595 return sub;
9596}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009597UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009598 const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009599 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009600}
9601UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07009602 const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009603 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009604}
9605UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07009606 const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009607 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009608}
9609UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
Jie Luo3560e232023-06-12 00:33:50 -07009610 const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009611 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009612}
9613UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009614 const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009615 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009616}
9617UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009618 const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009619 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009620}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009621
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009622/* google.protobuf.UninterpretedOption.NamePart */
9623
Joshua Habermanf41049a2022-01-21 14:41:25 -08009624UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009625 return (google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google_protobuf_UninterpretedOption_NamePart_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009626}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009627UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) {
9628 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009629 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009630 if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009631 return NULL;
9632 }
9633 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009634}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009635UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size,
9636 const upb_ExtensionRegistry* extreg,
9637 int options, upb_Arena* arena) {
9638 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
9639 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009640 if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009641 kUpb_DecodeStatus_Ok) {
9642 return NULL;
9643 }
9644 return ret;
9645}
9646UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009647 char* ptr;
9648 (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, 0, arena, &ptr, len);
9649 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009650}
9651UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options,
9652 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009653 char* ptr;
9654 (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, options, arena, &ptr, len);
9655 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009656}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009657UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009658 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009659 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009660}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009661UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009662 upb_StringView default_val = upb_StringView_FromString("");
9663 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009664 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009665 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009666 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009667}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009668UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009669 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009670 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009671}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009672UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009673 const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009674 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009675}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009676UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009677 bool default_val = false;
9678 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009679 const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009680 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009681 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009682}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009683UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009684 const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009685 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009686}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009687
Joshua Habermanf41049a2022-01-21 14:41:25 -08009688UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009689 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009690 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009691}
9692UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009693 const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009694 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009695}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009696
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009697/* google.protobuf.FeatureSet */
9698
9699UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) {
9700 return (google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
9701}
9702UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) {
9703 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
9704 if (!ret) return NULL;
9705 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
9706 return NULL;
9707 }
9708 return ret;
9709}
9710UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size,
9711 const upb_ExtensionRegistry* extreg,
9712 int options, upb_Arena* arena) {
9713 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
9714 if (!ret) return NULL;
9715 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, extreg, options, arena) !=
9716 kUpb_DecodeStatus_Ok) {
9717 return NULL;
9718 }
9719 return ret;
9720}
9721UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) {
9722 char* ptr;
9723 (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, 0, arena, &ptr, len);
9724 return ptr;
9725}
9726UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options,
9727 upb_Arena* arena, size_t* len) {
9728 char* ptr;
9729 (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, options, arena, &ptr, len);
9730 return ptr;
9731}
9732UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009733 const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009734 _upb_Message_ClearNonExtensionField(msg, &field);
9735}
9736UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) {
9737 int32_t default_val = 0;
9738 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009739 const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009740 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9741 return ret;
9742}
9743UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009744 const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009745 return _upb_Message_HasNonExtensionField(msg, &field);
9746}
9747UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009748 const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009749 _upb_Message_ClearNonExtensionField(msg, &field);
9750}
9751UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) {
9752 int32_t default_val = 0;
9753 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009754 const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009755 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9756 return ret;
9757}
9758UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009759 const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009760 return _upb_Message_HasNonExtensionField(msg, &field);
9761}
9762UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009763 const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009764 _upb_Message_ClearNonExtensionField(msg, &field);
9765}
9766UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
9767 int32_t default_val = 0;
9768 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009769 const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009770 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9771 return ret;
9772}
9773UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009774 const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009775 return _upb_Message_HasNonExtensionField(msg, &field);
9776}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009777UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009778 const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009779 _upb_Message_ClearNonExtensionField(msg, &field);
9780}
9781UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) {
9782 int32_t default_val = 0;
9783 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009784 const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009785 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9786 return ret;
9787}
9788UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009789 const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009790 return _upb_Message_HasNonExtensionField(msg, &field);
9791}
9792UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009793 const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009794 _upb_Message_ClearNonExtensionField(msg, &field);
9795}
9796UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) {
9797 int32_t default_val = 0;
9798 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009799 const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009800 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9801 return ret;
9802}
9803UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009804 const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009805 return _upb_Message_HasNonExtensionField(msg, &field);
9806}
9807
9808UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009809 const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009810 _upb_Message_SetNonExtensionField(msg, &field, &value);
9811}
9812UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009813 const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009814 _upb_Message_SetNonExtensionField(msg, &field, &value);
9815}
9816UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009817 const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009818 _upb_Message_SetNonExtensionField(msg, &field, &value);
9819}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009820UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009821 const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009822 _upb_Message_SetNonExtensionField(msg, &field, &value);
9823}
9824UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009825 const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009826 _upb_Message_SetNonExtensionField(msg, &field, &value);
9827}
9828
Mike Kruskalba964702023-08-22 17:37:48 -07009829/* google.protobuf.FeatureSetDefaults */
9830
9831UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) {
9832 return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_msg_init, arena);
9833}
9834UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) {
9835 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
9836 if (!ret) return NULL;
9837 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
9838 return NULL;
9839 }
9840 return ret;
9841}
9842UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size,
9843 const upb_ExtensionRegistry* extreg,
9844 int options, upb_Arena* arena) {
9845 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
9846 if (!ret) return NULL;
9847 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_msg_init, extreg, options, arena) !=
9848 kUpb_DecodeStatus_Ok) {
9849 return NULL;
9850 }
9851 return ret;
9852}
9853UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) {
9854 char* ptr;
9855 (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_msg_init, 0, arena, &ptr, len);
9856 return ptr;
9857}
9858UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options,
9859 upb_Arena* arena, size_t* len) {
9860 char* ptr;
9861 (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_msg_init, options, arena, &ptr, len);
9862 return ptr;
9863}
9864UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_defaults(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009865 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009866 _upb_Message_ClearNonExtensionField(msg, &field);
9867}
9868UPB_INLINE const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const* google_protobuf_FeatureSetDefaults_defaults(const google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009869 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009870 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9871 if (arr) {
9872 if (size) *size = arr->size;
9873 return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)_upb_array_constptr(arr);
9874 } else {
9875 if (size) *size = 0;
9876 return NULL;
9877 }
9878}
9879UPB_INLINE const upb_Array* _google_protobuf_FeatureSetDefaults_defaults_upb_array(const google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009880 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009881 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9882 if (size) {
9883 *size = arr ? arr->size : 0;
9884 }
9885 return arr;
9886}
9887UPB_INLINE upb_Array* _google_protobuf_FeatureSetDefaults_defaults_mutable_upb_array(const google_protobuf_FeatureSetDefaults* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009888 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009889 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9890 (upb_Message*)msg, &field, arena);
9891 if (size) {
9892 *size = arr ? arr->size : 0;
9893 }
9894 return arr;
9895}
9896UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_defaults(const google_protobuf_FeatureSetDefaults* msg) {
9897 size_t size;
9898 google_protobuf_FeatureSetDefaults_defaults(msg, &size);
9899 return size != 0;
9900}
9901UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009902 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009903 _upb_Message_ClearNonExtensionField(msg, &field);
9904}
9905UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
9906 upb_StringView default_val = upb_StringView_FromString("");
9907 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009908 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009909 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9910 return ret;
9911}
9912UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009913 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009914 return _upb_Message_HasNonExtensionField(msg, &field);
9915}
9916UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009917 const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009918 _upb_Message_ClearNonExtensionField(msg, &field);
9919}
9920UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
9921 upb_StringView default_val = upb_StringView_FromString("");
9922 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009923 const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009924 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9925 return ret;
9926}
9927UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009928 const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9929 return _upb_Message_HasNonExtensionField(msg, &field);
9930}
9931UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition_enum(google_protobuf_FeatureSetDefaults* msg) {
9932 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9933 _upb_Message_ClearNonExtensionField(msg, &field);
9934}
9935UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) {
9936 int32_t default_val = 0;
9937 int32_t ret;
9938 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9939 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9940 return ret;
9941}
9942UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) {
9943 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9944 return _upb_Message_HasNonExtensionField(msg, &field);
9945}
9946UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition_enum(google_protobuf_FeatureSetDefaults* msg) {
9947 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9948 _upb_Message_ClearNonExtensionField(msg, &field);
9949}
9950UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) {
9951 int32_t default_val = 0;
9952 int32_t ret;
9953 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9954 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9955 return ret;
9956}
9957UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) {
9958 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009959 return _upb_Message_HasNonExtensionField(msg, &field);
9960}
9961
9962UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_mutable_defaults(google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009963 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009964 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9965 if (arr) {
9966 if (size) *size = arr->size;
9967 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)_upb_array_ptr(arr);
9968 } else {
9969 if (size) *size = 0;
9970 return NULL;
9971 }
9972}
9973UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_resize_defaults(google_protobuf_FeatureSetDefaults* msg, size_t size, upb_Arena* arena) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009974 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009975 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
9976}
9977UPB_INLINE struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_add_defaults(google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009978 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009979 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9980 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9981 return NULL;
9982 }
9983 struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* sub = (struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, arena);
9984 if (!arr || !sub) return NULL;
9985 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
9986 return sub;
9987}
9988UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009989 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009990 _upb_Message_SetNonExtensionField(msg, &field, &value);
9991}
9992UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009993 const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9994 _upb_Message_SetNonExtensionField(msg, &field, &value);
9995}
9996UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition_enum(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
9997 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9998 _upb_Message_SetNonExtensionField(msg, &field, &value);
9999}
10000UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition_enum(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
10001 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -070010002 _upb_Message_SetNonExtensionField(msg, &field, &value);
10003}
10004
10005/* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */
10006
10007UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) {
10008 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, arena);
10009}
10010UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
10011 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
10012 if (!ret) return NULL;
10013 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
10014 return NULL;
10015 }
10016 return ret;
10017}
10018UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size,
10019 const upb_ExtensionRegistry* extreg,
10020 int options, upb_Arena* arena) {
10021 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
10022 if (!ret) return NULL;
10023 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, extreg, options, arena) !=
10024 kUpb_DecodeStatus_Ok) {
10025 return NULL;
10026 }
10027 return ret;
10028}
10029UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) {
10030 char* ptr;
10031 (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len);
10032 return ptr;
10033}
10034UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options,
10035 upb_Arena* arena, size_t* len) {
10036 char* ptr;
10037 (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, options, arena, &ptr, len);
10038 return ptr;
10039}
10040UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010041 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -070010042 _upb_Message_ClearNonExtensionField(msg, &field);
10043}
10044UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10045 upb_StringView default_val = upb_StringView_FromString("");
10046 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010047 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -070010048 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
10049 return ret;
10050}
10051UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010052 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -070010053 return _upb_Message_HasNonExtensionField(msg, &field);
10054}
10055UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10056 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10057 _upb_Message_ClearNonExtensionField(msg, &field);
10058}
10059UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10060 const google_protobuf_FeatureSet* default_val = NULL;
10061 const google_protobuf_FeatureSet* ret;
10062 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10063 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
10064 return ret;
10065}
10066UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10067 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10068 return _upb_Message_HasNonExtensionField(msg, &field);
10069}
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010070UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition_enum(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10071 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10072 _upb_Message_ClearNonExtensionField(msg, &field);
10073}
10074UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition_enum(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10075 int32_t default_val = 0;
10076 int32_t ret;
10077 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10078 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
10079 return ret;
10080}
10081UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition_enum(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10082 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10083 return _upb_Message_HasNonExtensionField(msg, &field);
10084}
Mike Kruskalba964702023-08-22 17:37:48 -070010085
10086UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010087 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -070010088 _upb_Message_SetNonExtensionField(msg, &field, &value);
10089}
10090UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
10091 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10092 _upb_Message_SetNonExtensionField(msg, &field, &value);
10093}
10094UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10095 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg);
10096 if (sub == NULL) {
10097 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
10098 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub);
10099 }
10100 return sub;
10101}
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010102UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition_enum(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
10103 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10104 _upb_Message_SetNonExtensionField(msg, &field, &value);
10105}
Mike Kruskalba964702023-08-22 17:37:48 -070010106
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010107/* google.protobuf.SourceCodeInfo */
10108
Joshua Habermanf41049a2022-01-21 14:41:25 -080010109UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010110 return (google_protobuf_SourceCodeInfo*)_upb_Message_New(&google_protobuf_SourceCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010111}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010112UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
10113 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010114 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010115 if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010116 return NULL;
10117 }
10118 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010119}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010120UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size,
10121 const upb_ExtensionRegistry* extreg,
10122 int options, upb_Arena* arena) {
10123 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
10124 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010125 if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010126 kUpb_DecodeStatus_Ok) {
10127 return NULL;
10128 }
10129 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010130}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010131UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010132 char* ptr;
10133 (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, 0, arena, &ptr, len);
10134 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010135}
10136UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options,
10137 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010138 char* ptr;
10139 (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, options, arena, &ptr, len);
10140 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010141}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010142UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010143 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010144 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010145}
Eric Salob7d54ac2022-12-29 11:59:42 -080010146UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010147 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010148 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10149 if (arr) {
10150 if (size) *size = arr->size;
10151 return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr);
10152 } else {
10153 if (size) *size = 0;
10154 return NULL;
10155 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010156}
Deanna Garciab26afb52023-04-25 13:37:18 -070010157UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_location_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010158 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010159 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10160 if (size) {
10161 *size = arr ? arr->size : 0;
10162 }
10163 return arr;
10164}
10165UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_location_mutable_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010166 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010167 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10168 (upb_Message*)msg, &field, arena);
10169 if (size) {
10170 *size = arr ? arr->size : 0;
10171 }
10172 return arr;
10173}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010174UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) {
10175 size_t size;
10176 google_protobuf_SourceCodeInfo_location(msg, &size);
10177 return size != 0;
10178}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010179
Eric Salob7d54ac2022-12-29 11:59:42 -080010180UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010181 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010182 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10183 if (arr) {
10184 if (size) *size = arr->size;
10185 return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr);
10186 } else {
10187 if (size) *size = 0;
10188 return NULL;
10189 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010190}
Eric Salob7d54ac2022-12-29 11:59:42 -080010191UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010192 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -070010193 return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010194}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010195UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010196 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010197 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10198 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10199 return NULL;
10200 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070010201 struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google_protobuf_SourceCodeInfo_Location_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -080010202 if (!arr || !sub) return NULL;
10203 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010204 return sub;
10205}
10206
10207/* google.protobuf.SourceCodeInfo.Location */
10208
Joshua Habermanf41049a2022-01-21 14:41:25 -080010209UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010210 return (google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google_protobuf_SourceCodeInfo_Location_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010211}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010212UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) {
10213 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010214 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010215 if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010216 return NULL;
10217 }
10218 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010219}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010220UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size,
10221 const upb_ExtensionRegistry* extreg,
10222 int options, upb_Arena* arena) {
10223 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
10224 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010225 if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010226 kUpb_DecodeStatus_Ok) {
10227 return NULL;
10228 }
10229 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010230}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010231UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010232 char* ptr;
10233 (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, 0, arena, &ptr, len);
10234 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010235}
10236UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options,
10237 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010238 char* ptr;
10239 (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, options, arena, &ptr, len);
10240 return ptr;
10241}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010242UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010243 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010244 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010245}
Eric Salob7d54ac2022-12-29 11:59:42 -080010246UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010247 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010248 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10249 if (arr) {
10250 if (size) *size = arr->size;
10251 return (int32_t const*)_upb_array_constptr(arr);
10252 } else {
10253 if (size) *size = 0;
10254 return NULL;
10255 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070010256}
Deanna Garciab26afb52023-04-25 13:37:18 -070010257UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010258 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010259 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10260 if (size) {
10261 *size = arr ? arr->size : 0;
10262 }
10263 return arr;
10264}
10265UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010266 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010267 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10268 (upb_Message*)msg, &field, arena);
10269 if (size) {
10270 *size = arr ? arr->size : 0;
10271 }
10272 return arr;
10273}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010274UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) {
10275 size_t size;
10276 google_protobuf_SourceCodeInfo_Location_path(msg, &size);
10277 return size != 0;
10278}
10279UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010280 const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010281 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010282}
Eric Salob7d54ac2022-12-29 11:59:42 -080010283UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010284 const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010285 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10286 if (arr) {
10287 if (size) *size = arr->size;
10288 return (int32_t const*)_upb_array_constptr(arr);
10289 } else {
10290 if (size) *size = 0;
10291 return NULL;
10292 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010293}
Deanna Garciab26afb52023-04-25 13:37:18 -070010294UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010295 const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010296 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10297 if (size) {
10298 *size = arr ? arr->size : 0;
10299 }
10300 return arr;
10301}
10302UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010303 const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010304 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10305 (upb_Message*)msg, &field, arena);
10306 if (size) {
10307 *size = arr ? arr->size : 0;
10308 }
10309 return arr;
10310}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010311UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) {
10312 size_t size;
10313 google_protobuf_SourceCodeInfo_Location_span(msg, &size);
10314 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010315}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010316UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010317 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010318 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010319}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010320UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010321 upb_StringView default_val = upb_StringView_FromString("");
10322 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010323 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010324 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010325 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010326}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010327UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010328 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010329 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010330}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010331UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010332 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010333 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010334}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010335UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010336 upb_StringView default_val = upb_StringView_FromString("");
10337 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010338 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010339 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010340 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010341}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010342UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010343 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010344 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010345}
10346UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010347 const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010348 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010349}
Eric Salob7d54ac2022-12-29 11:59:42 -080010350UPB_INLINE upb_StringView const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010351 const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010352 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10353 if (arr) {
10354 if (size) *size = arr->size;
10355 return (upb_StringView const*)_upb_array_constptr(arr);
10356 } else {
10357 if (size) *size = 0;
10358 return NULL;
10359 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010360}
Deanna Garciab26afb52023-04-25 13:37:18 -070010361UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010362 const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010363 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10364 if (size) {
10365 *size = arr ? arr->size : 0;
10366 }
10367 return arr;
10368}
10369UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010370 const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010371 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10372 (upb_Message*)msg, &field, arena);
10373 if (size) {
10374 *size = arr ? arr->size : 0;
10375 }
10376 return arr;
10377}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010378UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
10379 size_t size;
10380 google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size);
10381 return size != 0;
10382}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010383
Eric Salob7d54ac2022-12-29 11:59:42 -080010384UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010385 upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010386 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10387 if (arr) {
10388 if (size) *size = arr->size;
10389 return (int32_t*)_upb_array_ptr(arr);
10390 } else {
10391 if (size) *size = 0;
10392 return NULL;
10393 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010394}
Eric Salob7d54ac2022-12-29 11:59:42 -080010395UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010396 upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -070010397 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010398}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010399UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010400 upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010401 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10402 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10403 return false;
10404 }
10405 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10406 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010407}
Eric Salob7d54ac2022-12-29 11:59:42 -080010408UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010409 upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010410 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10411 if (arr) {
10412 if (size) *size = arr->size;
10413 return (int32_t*)_upb_array_ptr(arr);
10414 } else {
10415 if (size) *size = 0;
10416 return NULL;
10417 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010418}
Eric Salob7d54ac2022-12-29 11:59:42 -080010419UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010420 upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -070010421 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010422}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010423UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010424 upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010425 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10426 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10427 return false;
10428 }
10429 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10430 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010431}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010432UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010433 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010434 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010435}
10436UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010437 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010438 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010439}
10440UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010441 upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010442 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10443 if (arr) {
10444 if (size) *size = arr->size;
10445 return (upb_StringView*)_upb_array_ptr(arr);
10446 } else {
10447 if (size) *size = 0;
10448 return NULL;
10449 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010450}
Eric Salob7d54ac2022-12-29 11:59:42 -080010451UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010452 upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -070010453 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010454}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010455UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010456 upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010457 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10458 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10459 return false;
10460 }
10461 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10462 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010463}
10464
10465/* google.protobuf.GeneratedCodeInfo */
10466
Joshua Habermanf41049a2022-01-21 14:41:25 -080010467UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010468 return (google_protobuf_GeneratedCodeInfo*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010469}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010470UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
10471 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010472 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010473 if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010474 return NULL;
10475 }
10476 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010477}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010478UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size,
10479 const upb_ExtensionRegistry* extreg,
10480 int options, upb_Arena* arena) {
10481 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
10482 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010483 if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010484 kUpb_DecodeStatus_Ok) {
10485 return NULL;
10486 }
10487 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010488}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010489UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010490 char* ptr;
10491 (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, 0, arena, &ptr, len);
10492 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010493}
10494UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options,
10495 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010496 char* ptr;
10497 (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, options, arena, &ptr, len);
10498 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010499}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010500UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010501 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010502 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010503}
Eric Salob7d54ac2022-12-29 11:59:42 -080010504UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010505 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010506 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10507 if (arr) {
10508 if (size) *size = arr->size;
10509 return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr);
10510 } else {
10511 if (size) *size = 0;
10512 return NULL;
10513 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010514}
Deanna Garciab26afb52023-04-25 13:37:18 -070010515UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010516 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010517 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10518 if (size) {
10519 *size = arr ? arr->size : 0;
10520 }
10521 return arr;
10522}
10523UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_mutable_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010524 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010525 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10526 (upb_Message*)msg, &field, arena);
10527 if (size) {
10528 *size = arr ? arr->size : 0;
10529 }
10530 return arr;
10531}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010532UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) {
10533 size_t size;
10534 google_protobuf_GeneratedCodeInfo_annotation(msg, &size);
10535 return size != 0;
10536}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010537
Eric Salob7d54ac2022-12-29 11:59:42 -080010538UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010539 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010540 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10541 if (arr) {
10542 if (size) *size = arr->size;
10543 return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr);
10544 } else {
10545 if (size) *size = 0;
10546 return NULL;
10547 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010548}
Eric Salob7d54ac2022-12-29 11:59:42 -080010549UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010550 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -070010551 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010552}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010553UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010554 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010555 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10556 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10557 return NULL;
10558 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070010559 struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_Annotation_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -080010560 if (!arr || !sub) return NULL;
10561 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010562 return sub;
10563}
10564
10565/* google.protobuf.GeneratedCodeInfo.Annotation */
10566
Joshua Habermanf41049a2022-01-21 14:41:25 -080010567UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010568 return (google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_Annotation_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010569}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010570UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) {
10571 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010572 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010573 if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010574 return NULL;
10575 }
10576 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010577}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010578UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size,
10579 const upb_ExtensionRegistry* extreg,
10580 int options, upb_Arena* arena) {
10581 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
10582 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010583 if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010584 kUpb_DecodeStatus_Ok) {
10585 return NULL;
10586 }
10587 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010588}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010589UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010590 char* ptr;
10591 (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, 0, arena, &ptr, len);
10592 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010593}
10594UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options,
10595 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010596 char* ptr;
10597 (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, options, arena, &ptr, len);
10598 return ptr;
10599}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010600UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010601 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010602 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010603}
Eric Salob7d54ac2022-12-29 11:59:42 -080010604UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010605 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010606 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10607 if (arr) {
10608 if (size) *size = arr->size;
10609 return (int32_t const*)_upb_array_constptr(arr);
10610 } else {
10611 if (size) *size = 0;
10612 return NULL;
10613 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010614}
Deanna Garciab26afb52023-04-25 13:37:18 -070010615UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010616 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010617 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10618 if (size) {
10619 *size = arr ? arr->size : 0;
10620 }
10621 return arr;
10622}
10623UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010624 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010625 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10626 (upb_Message*)msg, &field, arena);
10627 if (size) {
10628 *size = arr ? arr->size : 0;
10629 }
10630 return arr;
10631}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010632UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
10633 size_t size;
10634 google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size);
10635 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010636}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010637UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010638 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010639 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010640}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010641UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010642 upb_StringView default_val = upb_StringView_FromString("");
10643 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010644 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010645 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010646 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010647}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010648UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010649 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010650 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010651}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010652UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010653 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010654 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010655}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010656UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010657 int32_t default_val = (int32_t)0;
10658 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010659 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010660 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010661 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010662}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010663UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010664 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010665 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010666}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010667UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010668 const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010669 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010670}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010671UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010672 int32_t default_val = (int32_t)0;
10673 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010674 const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010675 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010676 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010677}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010678UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010679 const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010680 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010681}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010682UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010683 const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010684 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010685}
10686UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010687 int32_t default_val = 0;
10688 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010689 const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010690 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010691 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010692}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010693UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010694 const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010695 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010696}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010697
Eric Salob7d54ac2022-12-29 11:59:42 -080010698UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010699 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010700 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10701 if (arr) {
10702 if (size) *size = arr->size;
10703 return (int32_t*)_upb_array_ptr(arr);
10704 } else {
10705 if (size) *size = 0;
10706 return NULL;
10707 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010708}
Eric Salob7d54ac2022-12-29 11:59:42 -080010709UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010710 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -070010711 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010712}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010713UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010714 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010715 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10716 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10717 return false;
10718 }
10719 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10720 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010721}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010722UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010723 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010724 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010725}
10726UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010727 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010728 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010729}
10730UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010731 const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010732 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010733}
10734UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010735 const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010736 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010737}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010738
Joshua Habermanf41049a2022-01-21 14:41:25 -080010739/* Max size 32 is google.protobuf.FileOptions */
10740/* Max size 64 is google.protobuf.FileOptions */
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010741#define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200)
Joshua Habermanf41049a2022-01-21 14:41:25 -080010742
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010743#ifdef __cplusplus
10744} /* extern "C" */
10745#endif
10746
10747
10748#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
Mike Kruskal232ecf42023-01-14 00:09:40 -080010749// end:github_only
Eric Salo8809a112022-11-21 13:01:06 -080010750
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000010751typedef enum {
10752 kUpb_Syntax_Proto2 = 2,
10753 kUpb_Syntax_Proto3 = 3,
10754 kUpb_Syntax_Editions = 99
10755} upb_Syntax;
Eric Salo8809a112022-11-21 13:01:06 -080010756
10757// Forward declarations for circular references.
10758typedef struct upb_DefPool upb_DefPool;
10759typedef struct upb_EnumDef upb_EnumDef;
10760typedef struct upb_EnumReservedRange upb_EnumReservedRange;
10761typedef struct upb_EnumValueDef upb_EnumValueDef;
10762typedef struct upb_ExtensionRange upb_ExtensionRange;
10763typedef struct upb_FieldDef upb_FieldDef;
10764typedef struct upb_FileDef upb_FileDef;
10765typedef struct upb_MessageDef upb_MessageDef;
10766typedef struct upb_MessageReservedRange upb_MessageReservedRange;
10767typedef struct upb_MethodDef upb_MethodDef;
10768typedef struct upb_OneofDef upb_OneofDef;
10769typedef struct upb_ServiceDef upb_ServiceDef;
10770
10771// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
10772
10773typedef struct upb_DefBuilder upb_DefBuilder;
10774
10775#endif /* UPB_REFLECTION_COMMON_H_ */
10776
10777#ifndef UPB_REFLECTION_DEF_TYPE_H_
10778#define UPB_REFLECTION_DEF_TYPE_H_
10779
10780
10781// Must be last.
10782
10783// Inside a symtab we store tagged pointers to specific def types.
10784typedef enum {
10785 UPB_DEFTYPE_MASK = 7,
10786
10787 // Only inside symtab table.
10788 UPB_DEFTYPE_EXT = 0,
10789 UPB_DEFTYPE_MSG = 1,
10790 UPB_DEFTYPE_ENUM = 2,
10791 UPB_DEFTYPE_ENUMVAL = 3,
10792 UPB_DEFTYPE_SERVICE = 4,
10793
10794 // Only inside message table.
10795 UPB_DEFTYPE_FIELD = 0,
10796 UPB_DEFTYPE_ONEOF = 1,
10797 UPB_DEFTYPE_FIELD_JSONNAME = 2,
10798} upb_deftype_t;
10799
10800#ifdef __cplusplus
10801extern "C" {
10802#endif
10803
10804// Our 3-bit pointer tagging requires all pointers to be multiples of 8.
10805// The arena will always yield 8-byte-aligned addresses, however we put
10806// the defs into arrays. For each element in the array to be 8-byte-aligned,
10807// the sizes of each def type must also be a multiple of 8.
10808//
10809// If any of these asserts fail, we need to add or remove padding on 32-bit
10810// machines (64-bit machines will have 8-byte alignment already due to
10811// pointers, which all of these structs have).
10812UPB_INLINE void _upb_DefType_CheckPadding(size_t size) {
10813 UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0);
10814}
10815
10816upb_deftype_t _upb_DefType_Type(upb_value v);
10817
10818upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type);
10819
10820const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type);
10821
10822#ifdef __cplusplus
10823} /* extern "C" */
10824#endif
10825
10826
10827#endif /* UPB_REFLECTION_DEF_TYPE_H_ */
10828
10829// Must be last.
10830
10831#ifdef __cplusplus
10832extern "C" {
10833#endif
10834
Jason Lunn67dee292023-07-13 13:15:26 -070010835UPB_API void upb_DefPool_Free(upb_DefPool* s);
Eric Salo8809a112022-11-21 13:01:06 -080010836
Jason Lunn67dee292023-07-13 13:15:26 -070010837UPB_API upb_DefPool* upb_DefPool_New(void);
Eric Salo8809a112022-11-21 13:01:06 -080010838
Jason Lunn67dee292023-07-13 13:15:26 -070010839UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName(
10840 const upb_DefPool* s, const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080010841
10842const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize(
10843 const upb_DefPool* s, const char* sym, size_t len);
10844
Jason Lunn67dee292023-07-13 13:15:26 -070010845UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s,
10846 const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080010847
10848const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s,
10849 const char* sym);
10850
10851const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s,
10852 const char* name);
10853
10854const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s,
10855 const char* name,
10856 size_t len);
10857
10858const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable(
10859 const upb_DefPool* s, const upb_MiniTableExtension* ext);
10860
10861const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s,
10862 const char* sym);
10863
10864const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize(
10865 const upb_DefPool* s, const char* name, size_t size);
10866
10867const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
10868 const upb_MessageDef* m,
10869 int32_t fieldnum);
10870
10871const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s,
10872 const char* name);
10873
10874const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
10875 const upb_DefPool* s, const char* name, size_t size);
10876
10877const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s,
10878 const char* name);
10879
Jason Lunn67dee292023-07-13 13:15:26 -070010880UPB_API const upb_FileDef* upb_DefPool_AddFile(
10881 upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto,
10882 upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080010883
10884const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry(
10885 const upb_DefPool* s);
10886
10887const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s,
10888 const upb_MessageDef* m,
10889 size_t* count);
10890
10891#ifdef __cplusplus
10892} /* extern "C" */
10893#endif
10894
10895
10896#endif /* UPB_REFLECTION_DEF_POOL_H_ */
10897
Protobuf Team Botfea76452023-09-12 20:32:11 +000010898// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010899
10900#ifndef UPB_REFLECTION_ENUM_DEF_H_
10901#define UPB_REFLECTION_ENUM_DEF_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -070010902
10903
10904// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010905
10906#ifdef __cplusplus
10907extern "C" {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010908#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010909
Eric Salo8809a112022-11-21 13:01:06 -080010910bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num);
10911const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e);
10912int32_t upb_EnumDef_Default(const upb_EnumDef* e);
Jason Lunn67dee292023-07-13 13:15:26 -070010913UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010914const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
10915 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070010916UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080010917 const upb_EnumDef* e, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070010918UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
10919 const upb_EnumDef* e, int32_t num);
10920UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010921bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
10922bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
10923
10924// Creates a mini descriptor string for an enum, returns true on success.
10925bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
10926 upb_StringView* out);
10927
10928const char* upb_EnumDef_Name(const upb_EnumDef* e);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010929const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010930
10931upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i);
10932int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e);
10933
10934const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e,
10935 int i);
10936int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e);
10937
Jason Lunn67dee292023-07-13 13:15:26 -070010938UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i);
10939UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010940
10941#ifdef __cplusplus
10942} /* extern "C" */
10943#endif
10944
10945
10946#endif /* UPB_REFLECTION_ENUM_DEF_H_ */
10947
Protobuf Team Botfea76452023-09-12 20:32:11 +000010948// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010949
10950#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_
10951#define UPB_REFLECTION_ENUM_VALUE_DEF_H_
10952
10953
10954// Must be last.
10955
10956#ifdef __cplusplus
10957extern "C" {
10958#endif
10959
10960const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v);
10961const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v);
10962bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v);
10963uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v);
Jason Lunn67dee292023-07-13 13:15:26 -070010964UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v);
10965UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010966const UPB_DESC(EnumValueOptions) *
10967 upb_EnumValueDef_Options(const upb_EnumValueDef* v);
Eric Salo8809a112022-11-21 13:01:06 -080010968
10969#ifdef __cplusplus
10970} /* extern "C" */
10971#endif
10972
10973
10974#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */
10975
Protobuf Team Botfea76452023-09-12 20:32:11 +000010976// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010977
10978#ifndef UPB_REFLECTION_EXTENSION_RANGE_H_
10979#define UPB_REFLECTION_EXTENSION_RANGE_H_
10980
10981
10982// Must be last.
10983
10984#ifdef __cplusplus
10985extern "C" {
10986#endif
10987
10988int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r);
10989int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r);
10990
10991bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010992const UPB_DESC(ExtensionRangeOptions) *
10993 upb_ExtensionRange_Options(const upb_ExtensionRange* r);
Eric Salo8809a112022-11-21 13:01:06 -080010994
10995#ifdef __cplusplus
10996} /* extern "C" */
10997#endif
10998
10999
11000#endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */
11001
Protobuf Team Botfea76452023-09-12 20:32:11 +000011002// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011003
11004#ifndef UPB_REFLECTION_FIELD_DEF_H_
11005#define UPB_REFLECTION_FIELD_DEF_H_
11006
11007
11008// Must be last.
11009
11010// Maximum field number allowed for FieldDefs.
11011// This is an inherent limit of the protobuf wire format.
11012#define kUpb_MaxFieldNumber ((1 << 29) - 1)
11013
11014#ifdef __cplusplus
11015extern "C" {
11016#endif
11017
11018const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011019UPB_API const upb_MessageDef* upb_FieldDef_ContainingType(
11020 const upb_FieldDef* f);
11021UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f);
11022UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f);
11023UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011024const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011025UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011026const char* upb_FieldDef_FullName(const upb_FieldDef* f);
11027bool upb_FieldDef_HasDefault(const upb_FieldDef* f);
11028bool upb_FieldDef_HasJsonName(const upb_FieldDef* f);
11029bool upb_FieldDef_HasOptions(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011030UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011031bool upb_FieldDef_HasSubDef(const upb_FieldDef* f);
11032uint32_t upb_FieldDef_Index(const upb_FieldDef* f);
11033bool upb_FieldDef_IsExtension(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011034UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011035bool upb_FieldDef_IsOptional(const upb_FieldDef* f);
11036bool upb_FieldDef_IsPacked(const upb_FieldDef* f);
11037bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011038UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011039bool upb_FieldDef_IsRequired(const upb_FieldDef* f);
11040bool upb_FieldDef_IsString(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011041UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
11042UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
11043UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
11044UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011045
11046// Creates a mini descriptor string for a field, returns true on success.
11047bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a,
11048 upb_StringView* out);
11049
11050const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011051UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f);
11052UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011053const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011054UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof(
11055 const upb_FieldDef* f);
11056UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011057
11058#ifdef __cplusplus
11059} /* extern "C" */
11060#endif
11061
11062
11063#endif /* UPB_REFLECTION_FIELD_DEF_H_ */
11064
Protobuf Team Botfea76452023-09-12 20:32:11 +000011065// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011066
11067#ifndef UPB_REFLECTION_FILE_DEF_H_
11068#define UPB_REFLECTION_FILE_DEF_H_
11069
11070
11071// Must be last.
11072
11073#ifdef __cplusplus
11074extern "C" {
11075#endif
11076
11077const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i);
11078int upb_FileDef_DependencyCount(const upb_FileDef* f);
11079bool upb_FileDef_HasOptions(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011080UPB_API const char* upb_FileDef_Name(const upb_FileDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011081const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011082const char* upb_FileDef_Package(const upb_FileDef* f);
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000011083UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011084UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011085
11086const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i);
11087int upb_FileDef_PublicDependencyCount(const upb_FileDef* f);
11088
11089const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i);
11090int upb_FileDef_ServiceCount(const upb_FileDef* f);
11091
Jason Lunn67dee292023-07-13 13:15:26 -070011092UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011093
11094const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i);
11095int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f);
11096
11097const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i);
11098int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f);
11099
11100const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i);
11101int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f);
11102
11103const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i);
11104int upb_FileDef_WeakDependencyCount(const upb_FileDef* f);
11105
11106#ifdef __cplusplus
11107} /* extern "C" */
11108#endif
11109
11110
11111#endif /* UPB_REFLECTION_FILE_DEF_H_ */
11112
Protobuf Team Botfea76452023-09-12 20:32:11 +000011113// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011114
11115#ifndef UPB_REFLECTION_MESSAGE_DEF_H_
11116#define UPB_REFLECTION_MESSAGE_DEF_H_
11117
11118
11119// Must be last.
11120
11121// Well-known field tag numbers for map-entry messages.
11122#define kUpb_MapEntry_KeyFieldNumber 1
11123#define kUpb_MapEntry_ValueFieldNumber 2
11124
11125// Well-known field tag numbers for Any messages.
11126#define kUpb_Any_TypeFieldNumber 1
11127#define kUpb_Any_ValueFieldNumber 2
11128
11129// Well-known field tag numbers for duration messages.
11130#define kUpb_Duration_SecondsFieldNumber 1
11131#define kUpb_Duration_NanosFieldNumber 2
11132
11133// Well-known field tag numbers for timestamp messages.
11134#define kUpb_Timestamp_SecondsFieldNumber 1
11135#define kUpb_Timestamp_NanosFieldNumber 2
11136
11137// All the different kind of well known type messages. For simplicity of check,
11138// number wrappers and string wrappers are grouped together. Make sure the
11139// order and number of these groups are not changed.
11140typedef enum {
11141 kUpb_WellKnown_Unspecified,
11142 kUpb_WellKnown_Any,
11143 kUpb_WellKnown_FieldMask,
11144 kUpb_WellKnown_Duration,
11145 kUpb_WellKnown_Timestamp,
11146
11147 // number wrappers
11148 kUpb_WellKnown_DoubleValue,
11149 kUpb_WellKnown_FloatValue,
11150 kUpb_WellKnown_Int64Value,
11151 kUpb_WellKnown_UInt64Value,
11152 kUpb_WellKnown_Int32Value,
11153 kUpb_WellKnown_UInt32Value,
11154
11155 // string wrappers
11156 kUpb_WellKnown_StringValue,
11157 kUpb_WellKnown_BytesValue,
11158 kUpb_WellKnown_BoolValue,
11159 kUpb_WellKnown_Value,
11160 kUpb_WellKnown_ListValue,
11161 kUpb_WellKnown_Struct,
11162} upb_WellKnown;
11163
11164#ifdef __cplusplus
11165extern "C" {
11166#endif
11167
11168const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m);
11169
11170const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m,
11171 int i);
11172int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m);
11173
Jason Lunn67dee292023-07-13 13:15:26 -070011174UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m,
11175 int i);
11176UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011177
Jason Lunn67dee292023-07-13 13:15:26 -070011178UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011179
11180// Returns a field by either JSON name or regular proto name.
11181const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
11182 const upb_MessageDef* m, const char* name, size_t size);
11183UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName(
11184 const upb_MessageDef* m, const char* name) {
11185 return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name));
11186}
11187
11188// Lookup of either field or oneof by name. Returns whether either was found.
11189// If the return is true, then the found def will be set, and the non-found
11190// one set to NULL.
Jason Lunn67dee292023-07-13 13:15:26 -070011191UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
11192 const char* name, size_t size,
11193 const upb_FieldDef** f,
11194 const upb_OneofDef** o);
Eric Salo8809a112022-11-21 13:01:06 -080011195UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m,
11196 const char* name,
11197 const upb_FieldDef** f,
11198 const upb_OneofDef** o) {
11199 return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o);
11200}
11201
11202const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m,
11203 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011204UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011205 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011206UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber(
11207 const upb_MessageDef* m, uint32_t i);
Eric Salo8809a112022-11-21 13:01:06 -080011208const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m,
11209 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011210UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011211 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011212UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011213bool upb_MessageDef_HasOptions(const upb_MessageDef* m);
11214bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m);
11215bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m);
11216
11217// Creates a mini descriptor string for a message, returns true on success.
11218bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a,
11219 upb_StringView* out);
11220
Jason Lunn67dee292023-07-13 13:15:26 -070011221UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011222const char* upb_MessageDef_Name(const upb_MessageDef* m);
11223
11224const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i);
11225const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m,
11226 int i);
11227const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m,
11228 int i);
11229
11230int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m);
11231int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m);
11232int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m);
11233
Jason Lunn67dee292023-07-13 13:15:26 -070011234UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m,
11235 int i);
11236UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011237int upb_MessageDef_RealOneofCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011238
Mike Kruskal232ecf42023-01-14 00:09:40 -080011239const UPB_DESC(MessageOptions) *
11240 upb_MessageDef_Options(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011241
11242upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i);
11243int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m);
11244
11245const upb_MessageReservedRange* upb_MessageDef_ReservedRange(
11246 const upb_MessageDef* m, int i);
11247int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m);
11248
Jason Lunn67dee292023-07-13 13:15:26 -070011249UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m);
11250UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011251
11252#ifdef __cplusplus
11253} /* extern "C" */
11254#endif
11255
11256
11257#endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */
11258
Protobuf Team Botfea76452023-09-12 20:32:11 +000011259// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011260
11261#ifndef UPB_REFLECTION_METHOD_DEF_H_
11262#define UPB_REFLECTION_METHOD_DEF_H_
11263
11264
11265// Must be last.
11266
11267#ifdef __cplusplus
11268extern "C" {
11269#endif
11270
11271bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
11272const char* upb_MethodDef_FullName(const upb_MethodDef* m);
11273bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
11274int upb_MethodDef_Index(const upb_MethodDef* m);
11275const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
11276const char* upb_MethodDef_Name(const upb_MethodDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011277const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011278const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
11279bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
11280const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
11281
11282#ifdef __cplusplus
11283} /* extern "C" */
11284#endif
11285
11286
11287#endif /* UPB_REFLECTION_METHOD_DEF_H_ */
11288
Protobuf Team Botfea76452023-09-12 20:32:11 +000011289// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011290
11291#ifndef UPB_REFLECTION_ONEOF_DEF_H_
11292#define UPB_REFLECTION_ONEOF_DEF_H_
11293
11294
11295// Must be last.
11296
11297#ifdef __cplusplus
11298extern "C" {
11299#endif
11300
Jason Lunn67dee292023-07-13 13:15:26 -070011301UPB_API const upb_MessageDef* upb_OneofDef_ContainingType(
11302 const upb_OneofDef* o);
11303UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i);
11304UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011305const char* upb_OneofDef_FullName(const upb_OneofDef* o);
11306bool upb_OneofDef_HasOptions(const upb_OneofDef* o);
11307uint32_t upb_OneofDef_Index(const upb_OneofDef* o);
11308bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o);
11309const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o,
11310 const char* name);
11311const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o,
11312 const char* name,
11313 size_t size);
11314const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o,
11315 uint32_t num);
Jason Lunn67dee292023-07-13 13:15:26 -070011316UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011317int upb_OneofDef_numfields(const upb_OneofDef* o);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011318const UPB_DESC(OneofOptions) * upb_OneofDef_Options(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011319
11320#ifdef __cplusplus
11321} /* extern "C" */
11322#endif
11323
11324
11325#endif /* UPB_REFLECTION_ONEOF_DEF_H_ */
11326
Protobuf Team Botfea76452023-09-12 20:32:11 +000011327// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011328
11329#ifndef UPB_REFLECTION_SERVICE_DEF_H_
11330#define UPB_REFLECTION_SERVICE_DEF_H_
11331
11332
11333// Must be last.
11334
11335#ifdef __cplusplus
11336extern "C" {
11337#endif
11338
11339const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
11340const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
11341 const char* name);
11342const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
11343bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
11344int upb_ServiceDef_Index(const upb_ServiceDef* s);
11345const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i);
11346int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
11347const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011348const UPB_DESC(ServiceOptions) *
11349 upb_ServiceDef_Options(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080011350
11351#ifdef __cplusplus
11352} /* extern "C" */
11353#endif
11354
11355
11356#endif /* UPB_REFLECTION_SERVICE_DEF_H_ */
Protobuf Team Botffc56ba2023-09-08 15:29:06 +000011357// IWYU pragma: end_exports
Eric Salo8809a112022-11-21 13:01:06 -080011358
11359#endif /* UPB_REFLECTION_DEF_H_ */
11360
11361// Must be last.
11362
11363#ifdef __cplusplus
11364extern "C" {
11365#endif
11366
11367enum { upb_JsonDecode_IgnoreUnknown = 1 };
11368
Jason Lunn67dee292023-07-13 13:15:26 -070011369UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
11370 const upb_MessageDef* m, const upb_DefPool* symtab,
11371 int options, upb_Arena* arena, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011372
11373#ifdef __cplusplus
11374} /* extern "C" */
11375#endif
11376
11377
11378#endif /* UPB_JSONDECODE_H_ */
11379
11380#ifndef UPB_LEX_ATOI_H_
11381#define UPB_LEX_ATOI_H_
11382
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011383#include <stdint.h>
11384
Eric Salo8809a112022-11-21 13:01:06 -080011385// Must be last.
11386
11387#ifdef __cplusplus
11388extern "C" {
11389#endif
11390
11391// We use these hand-written routines instead of strto[u]l() because the "long
11392// long" variants aren't in c89. Also our version allows setting a ptr limit.
11393// Return the new position of the pointer after parsing the int, or NULL on
11394// integer overflow.
11395
11396const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val);
11397const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
11398 bool* is_neg);
11399
11400#ifdef __cplusplus
11401} /* extern "C" */
11402#endif
11403
11404
11405#endif /* UPB_LEX_ATOI_H_ */
11406
11407#ifndef UPB_LEX_UNICODE_H_
11408#define UPB_LEX_UNICODE_H_
11409
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011410#include <stdint.h>
11411
Eric Salo8809a112022-11-21 13:01:06 -080011412// Must be last.
11413
11414#ifdef __cplusplus
11415extern "C" {
11416#endif
11417
11418// Returns true iff a codepoint is the value for a high surrogate.
11419UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) {
11420 return (cp >= 0xd800 && cp <= 0xdbff);
11421}
11422
11423// Returns true iff a codepoint is the value for a low surrogate.
11424UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) {
11425 return (cp >= 0xdc00 && cp <= 0xdfff);
11426}
11427
11428// Returns the high 16-bit surrogate value for a supplementary codepoint.
11429// Does not sanity-check the input.
11430UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) {
11431 return (cp >> 10) + 0xd7c0;
11432}
11433
11434// Returns the low 16-bit surrogate value for a supplementary codepoint.
11435// Does not sanity-check the input.
11436UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) {
11437 return (cp & 0x3ff) | 0xdc00;
11438}
11439
11440// Returns the 32-bit value corresponding to a pair of 16-bit surrogates.
11441// Does not sanity-check the input.
11442UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) {
11443 return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000;
11444}
11445
11446// Outputs a codepoint as UTF8.
11447// Returns the number of bytes written (1-4 on success, 0 on error).
11448// Does not sanity-check the input. Specifically does not check for surrogates.
11449int upb_Unicode_ToUTF8(uint32_t cp, char* out);
11450
11451#ifdef __cplusplus
11452} /* extern "C" */
11453#endif
11454
11455
11456#endif /* UPB_LEX_UNICODE_H_ */
11457
11458#ifndef UPB_REFLECTION_MESSAGE_H_
11459#define UPB_REFLECTION_MESSAGE_H_
11460
Protobuf Team Bot473d20d2023-09-15 22:27:16 +000011461#include <stddef.h>
11462
Eric Salo8809a112022-11-21 13:01:06 -080011463
11464// Must be last.
11465
11466#ifdef __cplusplus
11467extern "C" {
11468#endif
11469
Eric Salo3f36a912022-12-05 14:12:25 -080011470// Returns a mutable pointer to a map, array, or submessage value. If the given
11471// arena is non-NULL this will construct a new object if it was not previously
11472// present. May not be called for primitive fields.
Jason Lunn67dee292023-07-13 13:15:26 -070011473UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg,
11474 const upb_FieldDef* f,
11475 upb_Arena* a);
Eric Salo8809a112022-11-21 13:01:06 -080011476
Eric Salo3f36a912022-12-05 14:12:25 -080011477// Returns the field that is set in the oneof, or NULL if none are set.
Jason Lunn67dee292023-07-13 13:15:26 -070011478UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
11479 const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011480
Eric Salo3f36a912022-12-05 14:12:25 -080011481// Clear all data and unknown fields.
11482void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011483
Eric Salo3f36a912022-12-05 14:12:25 -080011484// Clears any field presence and sets the value back to its default.
Jason Lunn67dee292023-07-13 13:15:26 -070011485UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg,
11486 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011487
Eric Salo3f36a912022-12-05 14:12:25 -080011488// May only be called for fields where upb_FieldDef_HasPresence(f) == true.
Jason Lunn67dee292023-07-13 13:15:26 -070011489UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg,
11490 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011491
Eric Salo3f36a912022-12-05 14:12:25 -080011492// Returns the value in the message associated with this field def.
Jason Lunn67dee292023-07-13 13:15:26 -070011493UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
11494 const upb_FieldDef* f);
Eric Salo3f36a912022-12-05 14:12:25 -080011495
11496// Sets the given field to the given value. For a msg/array/map/string, the
11497// caller must ensure that the target data outlives |msg| (by living either in
11498// the same arena or a different arena that outlives it).
11499//
11500// Returns false if allocation fails.
Jason Lunn67dee292023-07-13 13:15:26 -070011501UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
11502 upb_MessageValue val, upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -080011503
11504// Iterate over present fields.
11505//
11506// size_t iter = kUpb_Message_Begin;
11507// const upb_FieldDef *f;
11508// upb_MessageValue val;
11509// while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) {
11510// process_field(f, val);
11511// }
11512//
11513// If ext_pool is NULL, no extensions will be returned. If the given symtab
11514// returns extensions that don't match what is in this message, those extensions
11515// will be skipped.
Eric Salo8809a112022-11-21 13:01:06 -080011516
11517#define kUpb_Message_Begin -1
Eric Salo3f36a912022-12-05 14:12:25 -080011518
Eric Salo8809a112022-11-21 13:01:06 -080011519bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
11520 const upb_DefPool* ext_pool, const upb_FieldDef** f,
11521 upb_MessageValue* val, size_t* iter);
11522
Eric Salo3f36a912022-12-05 14:12:25 -080011523// Clears all unknown field data from this message and all submessages.
Jason Lunn67dee292023-07-13 13:15:26 -070011524UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg,
11525 const upb_MessageDef* m, int maxdepth);
Eric Salo8809a112022-11-21 13:01:06 -080011526
11527#ifdef __cplusplus
11528} /* extern "C" */
11529#endif
11530
11531
11532#endif /* UPB_REFLECTION_MESSAGE_H_ */
11533
11534#ifndef UPB_JSON_ENCODE_H_
11535#define UPB_JSON_ENCODE_H_
11536
11537
11538// Must be last.
11539
11540#ifdef __cplusplus
11541extern "C" {
11542#endif
11543
11544enum {
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000011545 /* When set, emits 0/default values. TODO: proto3 only? */
Eric Salo8809a112022-11-21 13:01:06 -080011546 upb_JsonEncode_EmitDefaults = 1 << 0,
11547
11548 /* When set, use normal (snake_case) field names instead of JSON (camelCase)
11549 names. */
11550 upb_JsonEncode_UseProtoNames = 1 << 1,
11551
11552 /* When set, emits enums as their integer values instead of as their names. */
11553 upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2
11554};
11555
11556/* Encodes the given |msg| to JSON format. The message's reflection is given in
Protobuf Team Botad884532023-09-05 18:31:02 +000011557 * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL,
11558 * extensions will not be printed).
Eric Salo8809a112022-11-21 13:01:06 -080011559 *
11560 * Output is placed in the given buffer, and always NULL-terminated. The output
11561 * size (excluding NULL) is returned. This means that a return value >= |size|
11562 * implies that the output was truncated. (These are the same semantics as
11563 * snprintf()). */
Jason Lunn67dee292023-07-13 13:15:26 -070011564UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m,
11565 const upb_DefPool* ext_pool, int options,
11566 char* buf, size_t size, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011567
11568#ifdef __cplusplus
11569} /* extern "C" */
11570#endif
11571
11572
11573#endif /* UPB_JSONENCODE_H_ */
11574
11575#ifndef UPB_LEX_ROUND_TRIP_H_
11576#define UPB_LEX_ROUND_TRIP_H_
11577
11578// Must be last.
11579
11580// Encodes a float or double that is round-trippable, but as short as possible.
11581// These routines are not fully optimal (not guaranteed to be shortest), but are
11582// short-ish and match the implementation that has been used in protobuf since
11583// the beginning.
11584
11585// The given buffer size must be at least kUpb_RoundTripBufferSize.
11586enum { kUpb_RoundTripBufferSize = 32 };
11587
11588#ifdef __cplusplus
11589extern "C" {
11590#endif
11591
11592void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size);
11593void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size);
11594
11595#ifdef __cplusplus
11596} /* extern "C" */
11597#endif
11598
11599
11600#endif /* UPB_LEX_ROUND_TRIP_H_ */
11601
11602#ifndef UPB_PORT_VSNPRINTF_COMPAT_H_
11603#define UPB_PORT_VSNPRINTF_COMPAT_H_
11604
11605// Must be last.
11606
11607UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt,
11608 va_list ap) {
11609#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
11610 // The msvc runtime has a non-conforming vsnprintf() that requires the
11611 // following compatibility code to become conformant.
11612 int n = -1;
11613 if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap);
11614 if (n == -1) n = _vscprintf(fmt, ap);
11615 return n;
11616#else
11617 return vsnprintf(buf, size, fmt, ap);
11618#endif
11619}
11620
11621
11622#endif // UPB_PORT_VSNPRINTF_COMPAT_H_
11623
11624#ifndef UPB_LEX_STRTOD_H_
11625#define UPB_LEX_STRTOD_H_
11626
11627// Must be last.
11628
11629#ifdef __cplusplus
11630extern "C" {
11631#endif
11632
11633double _upb_NoLocaleStrtod(const char *str, char **endptr);
11634
11635#ifdef __cplusplus
11636} /* extern "C" */
11637#endif
11638
11639
11640#endif /* UPB_LEX_STRTOD_H_ */
11641
Sandy Zhange3b09432023-08-07 09:30:02 -070011642#ifndef UPB_MEM_INTERNAL_ARENA_H_
11643#define UPB_MEM_INTERNAL_ARENA_H_
Eric Salo8809a112022-11-21 13:01:06 -080011644
11645
11646// Must be last.
11647
11648typedef struct _upb_MemBlock _upb_MemBlock;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011649
11650struct upb_Arena {
11651 _upb_ArenaHead head;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011652
Deanna Garciac7d979d2023-04-14 17:22:13 -070011653 // upb_alloc* together with a low bit which signals if there is an initial
11654 // block.
11655 uintptr_t block_alloc;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011656
Deanna Garciac7d979d2023-04-14 17:22:13 -070011657 // When multiple arenas are fused together, each arena points to a parent
11658 // arena (root points to itself). The root tracks how many live arenas
11659 // reference it.
Joshua Habermand3995ec2022-09-30 16:54:39 -070011660
Deanna Garciac7d979d2023-04-14 17:22:13 -070011661 // The low bit is tagged:
11662 // 0: pointer to parent
11663 // 1: count, left shifted by one
11664 UPB_ATOMIC(uintptr_t) parent_or_count;
11665
11666 // All nodes that are fused together are in a singly-linked list.
11667 UPB_ATOMIC(upb_Arena*) next; // NULL at end of list.
11668
11669 // The last element of the linked list. This is present only as an
11670 // optimization, so that we do not have to iterate over all members for every
11671 // fuse. Only significant for an arena root. In other cases it is ignored.
11672 UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members.
11673
11674 // Linked list of blocks to free/cleanup. Atomic only for the benefit of
11675 // upb_Arena_SpaceAllocated().
11676 UPB_ATOMIC(_upb_MemBlock*) blocks;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011677};
11678
Eric Salodfb71552023-03-22 12:35:09 -070011679UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) {
11680 return (parent_or_count & 1) == 1;
11681}
Eric Salo8809a112022-11-21 13:01:06 -080011682
Eric Salodfb71552023-03-22 12:35:09 -070011683UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) {
11684 return (parent_or_count & 1) == 0;
11685}
11686
Deanna Garciac7d979d2023-04-14 17:22:13 -070011687UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) {
Eric Salodfb71552023-03-22 12:35:09 -070011688 UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
11689 return parent_or_count >> 1;
11690}
11691
Deanna Garciac7d979d2023-04-14 17:22:13 -070011692UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) {
11693 uintptr_t parent_or_count = (refcount << 1) | 1;
Eric Salodfb71552023-03-22 12:35:09 -070011694 UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
11695 return parent_or_count;
11696}
11697
11698UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) {
11699 UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
11700 return (upb_Arena*)parent_or_count;
11701}
11702
11703UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) {
11704 uintptr_t parent_or_count = (uintptr_t)a;
11705 UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
11706 return parent_or_count;
11707}
Joshua Habermand3995ec2022-09-30 16:54:39 -070011708
Deanna Garciac7d979d2023-04-14 17:22:13 -070011709UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) {
11710 return (upb_alloc*)(arena->block_alloc & ~0x1);
11711}
11712
11713UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc,
11714 bool has_initial) {
11715 uintptr_t alloc_uint = (uintptr_t)alloc;
11716 UPB_ASSERT((alloc_uint & 1) == 0);
11717 return alloc_uint | (has_initial ? 1 : 0);
11718}
11719
11720UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) {
11721 return arena->block_alloc & 0x1;
11722}
11723
Joshua Habermand3995ec2022-09-30 16:54:39 -070011724
Sandy Zhange3b09432023-08-07 09:30:02 -070011725#endif /* UPB_MEM_INTERNAL_ARENA_H_ */
Eric Salo8809a112022-11-21 13:01:06 -080011726
Eric Salodfb71552023-03-22 12:35:09 -070011727#ifndef UPB_PORT_ATOMIC_H_
11728#define UPB_PORT_ATOMIC_H_
11729
11730
11731#ifdef UPB_USE_C11_ATOMICS
11732
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011733// IWYU pragma: begin_exports
Eric Salodfb71552023-03-22 12:35:09 -070011734#include <stdatomic.h>
11735#include <stdbool.h>
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011736// IWYU pragma: end_exports
Eric Salodfb71552023-03-22 12:35:09 -070011737
Deanna Garciac7d979d2023-04-14 17:22:13 -070011738#define upb_Atomic_Init(addr, val) atomic_init(addr, val)
11739#define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order)
11740#define upb_Atomic_Store(addr, val, order) \
11741 atomic_store_explicit(addr, val, order)
11742#define upb_Atomic_Add(addr, val, order) \
11743 atomic_fetch_add_explicit(addr, val, order)
11744#define upb_Atomic_Sub(addr, val, order) \
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070011745 atomic_fetch_sub_explicit(addr, val, order)
11746#define upb_Atomic_Exchange(addr, val, order) \
11747 atomic_exchange_explicit(addr, val, order)
Deanna Garciac7d979d2023-04-14 17:22:13 -070011748#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
11749 success_order, failure_order) \
11750 atomic_compare_exchange_strong_explicit(addr, expected, desired, \
11751 success_order, failure_order)
11752#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
11753 failure_order) \
11754 atomic_compare_exchange_weak_explicit(addr, expected, desired, \
11755 success_order, failure_order)
Eric Salodfb71552023-03-22 12:35:09 -070011756
11757#else // !UPB_USE_C11_ATOMICS
11758
Deanna Garciac7d979d2023-04-14 17:22:13 -070011759#include <string.h>
Eric Salodfb71552023-03-22 12:35:09 -070011760
Deanna Garciac7d979d2023-04-14 17:22:13 -070011761#define upb_Atomic_Init(addr, val) (*addr = val)
11762#define upb_Atomic_Load(addr, order) (*addr)
11763#define upb_Atomic_Store(addr, val, order) (*(addr) = val)
11764#define upb_Atomic_Add(addr, val, order) (*(addr) += val)
11765#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val)
Eric Salodfb71552023-03-22 12:35:09 -070011766
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070011767UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) {
11768 void* old;
11769 memcpy(&old, addr, sizeof(value));
11770 memcpy(addr, &value, sizeof(value));
11771 return old;
11772}
11773
11774#define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val)
11775
Deanna Garciac7d979d2023-04-14 17:22:13 -070011776// `addr` and `expected` are logically double pointers.
11777UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
11778 void* expected,
11779 void* desired) {
11780 if (memcmp(addr, expected, sizeof(desired)) == 0) {
11781 memcpy(addr, &desired, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070011782 return true;
11783 } else {
Deanna Garciac7d979d2023-04-14 17:22:13 -070011784 memcpy(expected, addr, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070011785 return false;
11786 }
11787}
11788
Deanna Garciac7d979d2023-04-14 17:22:13 -070011789#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
11790 success_order, failure_order) \
11791 _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \
11792 (void*)desired)
11793#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
11794 failure_order) \
11795 upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0)
11796
Eric Salodfb71552023-03-22 12:35:09 -070011797#endif
11798
11799
11800#endif // UPB_PORT_ATOMIC_H_
11801
Eric Salob7d54ac2022-12-29 11:59:42 -080011802#ifndef UPB_WIRE_READER_H_
11803#define UPB_WIRE_READER_H_
11804
11805
Sandy Zhange3b09432023-08-07 09:30:02 -070011806#ifndef UPB_WIRE_INTERNAL_SWAP_H_
11807#define UPB_WIRE_INTERNAL_SWAP_H_
Eric Salob7d54ac2022-12-29 11:59:42 -080011808
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011809#include <stdint.h>
11810
Eric Salob7d54ac2022-12-29 11:59:42 -080011811// Must be last.
11812
11813#ifdef __cplusplus
11814extern "C" {
11815#endif
11816
11817UPB_INLINE bool _upb_IsLittleEndian(void) {
11818 int x = 1;
11819 return *(char*)&x == 1;
11820}
11821
11822UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) {
11823 if (_upb_IsLittleEndian()) return val;
11824
11825 return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
11826 ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
11827}
11828
11829UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) {
11830 if (_upb_IsLittleEndian()) return val;
11831
11832 return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) |
11833 _upb_BigEndian_Swap32((uint32_t)(val >> 32));
11834}
11835
11836#ifdef __cplusplus
11837} /* extern "C" */
11838#endif
11839
11840
Sandy Zhange3b09432023-08-07 09:30:02 -070011841#endif /* UPB_WIRE_INTERNAL_SWAP_H_ */
Eric Salob7d54ac2022-12-29 11:59:42 -080011842
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011843#ifndef UPB_WIRE_TYPES_H_
11844#define UPB_WIRE_TYPES_H_
11845
11846// A list of types as they are encoded on the wire.
11847typedef enum {
11848 kUpb_WireType_Varint = 0,
11849 kUpb_WireType_64Bit = 1,
11850 kUpb_WireType_Delimited = 2,
11851 kUpb_WireType_StartGroup = 3,
11852 kUpb_WireType_EndGroup = 4,
11853 kUpb_WireType_32Bit = 5
11854} upb_WireType;
11855
11856#endif /* UPB_WIRE_TYPES_H_ */
11857
Eric Salob7d54ac2022-12-29 11:59:42 -080011858// Must be last.
11859
11860#ifdef __cplusplus
11861extern "C" {
11862#endif
11863
11864// The upb_WireReader interface is suitable for general-purpose parsing of
11865// protobuf binary wire format. It is designed to be used along with
11866// upb_EpsCopyInputStream for buffering, and all parsing routines in this file
11867// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is
11868// available to read without any bounds checks.
11869
11870#define kUpb_WireReader_WireTypeMask 7
11871#define kUpb_WireReader_WireTypeBits 3
11872
11873typedef struct {
11874 const char* ptr;
11875 uint64_t val;
11876} _upb_WireReader_ReadLongVarintRet;
11877
11878_upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint(
11879 const char* ptr, uint64_t val);
11880
11881static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr,
11882 uint64_t* val,
11883 int maxlen,
11884 uint64_t maxval) {
11885 uint64_t byte = (uint8_t)*ptr;
11886 if (UPB_LIKELY((byte & 0x80) == 0)) {
11887 *val = (uint32_t)byte;
11888 return ptr + 1;
11889 }
11890 const char* start = ptr;
11891 _upb_WireReader_ReadLongVarintRet res =
11892 _upb_WireReader_ReadLongVarint(ptr, byte);
11893 if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) ||
11894 res.val > maxval) {
11895 return NULL; // Malformed.
11896 }
11897 *val = res.val;
11898 return res.ptr;
11899}
11900
11901// Parses a tag into `tag`, and returns a pointer past the end of the tag, or
11902// NULL if there was an error in the tag data.
11903//
11904// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11905// Bounds checks must be performed before calling this function, preferably
11906// by calling upb_EpsCopyInputStream_IsDone().
11907static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
11908 uint32_t* tag) {
11909 uint64_t val;
11910 ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX);
11911 if (!ptr) return NULL;
11912 *tag = val;
11913 return ptr;
11914}
11915
11916// Given a tag, returns the field number.
11917UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
11918 return tag >> kUpb_WireReader_WireTypeBits;
11919}
11920
11921// Given a tag, returns the wire type.
11922UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
11923 return tag & kUpb_WireReader_WireTypeMask;
11924}
11925
11926UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr,
11927 uint64_t* val) {
11928 return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX);
11929}
11930
11931// Skips data for a varint, returning a pointer past the end of the varint, or
11932// NULL if there was an error in the varint data.
11933//
11934// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11935// Bounds checks must be performed before calling this function, preferably
11936// by calling upb_EpsCopyInputStream_IsDone().
11937UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) {
11938 uint64_t val;
11939 return upb_WireReader_ReadVarint(ptr, &val);
11940}
11941
11942// Reads a varint indicating the size of a delimited field into `size`, or
11943// NULL if there was an error in the varint data.
11944//
11945// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11946// Bounds checks must be performed before calling this function, preferably
11947// by calling upb_EpsCopyInputStream_IsDone().
11948UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) {
11949 uint64_t size64;
11950 ptr = upb_WireReader_ReadVarint(ptr, &size64);
11951 if (!ptr || size64 >= INT32_MAX) return NULL;
11952 *size = size64;
11953 return ptr;
11954}
11955
11956// Reads a fixed32 field, performing byte swapping if necessary.
11957//
11958// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
11959// Bounds checks must be performed before calling this function, preferably
11960// by calling upb_EpsCopyInputStream_IsDone().
11961UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) {
11962 uint32_t uval;
11963 memcpy(&uval, ptr, 4);
11964 uval = _upb_BigEndian_Swap32(uval);
11965 memcpy(val, &uval, 4);
11966 return ptr + 4;
11967}
11968
11969// Reads a fixed64 field, performing byte swapping if necessary.
11970//
11971// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
11972// Bounds checks must be performed before calling this function, preferably
11973// by calling upb_EpsCopyInputStream_IsDone().
11974UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) {
11975 uint64_t uval;
11976 memcpy(&uval, ptr, 8);
11977 uval = _upb_BigEndian_Swap64(uval);
11978 memcpy(val, &uval, 8);
11979 return ptr + 8;
11980}
11981
Mike Kruskal232ecf42023-01-14 00:09:40 -080011982const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag,
11983 int depth_limit,
11984 upb_EpsCopyInputStream* stream);
11985
Eric Salob7d54ac2022-12-29 11:59:42 -080011986// Skips data for a group, returning a pointer past the end of the group, or
11987// NULL if there was an error parsing the group. The `tag` argument should be
11988// the start group tag that begins the group. The `depth_limit` argument
11989// indicates how many levels of recursion the group is allowed to have before
11990// reporting a parse error (this limit exists to protect against stack
11991// overflow).
Eric Salob7d54ac2022-12-29 11:59:42 -080011992//
Mike Kruskal232ecf42023-01-14 00:09:40 -080011993// TODO: evaluate how the depth_limit should be specified. Do users need
11994// control over this?
11995UPB_INLINE const char* upb_WireReader_SkipGroup(
11996 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
11997 return _upb_WireReader_SkipGroup(ptr, tag, 100, stream);
11998}
11999
12000UPB_INLINE const char* _upb_WireReader_SkipValue(
Eric Salob7d54ac2022-12-29 11:59:42 -080012001 const char* ptr, uint32_t tag, int depth_limit,
12002 upb_EpsCopyInputStream* stream) {
12003 switch (upb_WireReader_GetWireType(tag)) {
12004 case kUpb_WireType_Varint:
12005 return upb_WireReader_SkipVarint(ptr);
12006 case kUpb_WireType_32Bit:
12007 return ptr + 4;
12008 case kUpb_WireType_64Bit:
12009 return ptr + 8;
12010 case kUpb_WireType_Delimited: {
12011 int size;
12012 ptr = upb_WireReader_ReadSize(ptr, &size);
12013 if (!ptr) return NULL;
12014 ptr += size;
12015 return ptr;
12016 }
12017 case kUpb_WireType_StartGroup:
Mike Kruskal232ecf42023-01-14 00:09:40 -080012018 return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream);
Eric Salob7d54ac2022-12-29 11:59:42 -080012019 case kUpb_WireType_EndGroup:
12020 return NULL; // Should be handled before now.
12021 default:
12022 return NULL; // Unknown wire type.
12023 }
12024}
12025
Mike Kruskal232ecf42023-01-14 00:09:40 -080012026// Skips data for a wire value of any type, returning a pointer past the end of
12027// the data, or NULL if there was an error parsing the group. The `tag` argument
12028// should be the tag that was just parsed. The `depth_limit` argument indicates
12029// how many levels of recursion a group is allowed to have before reporting a
12030// parse error (this limit exists to protect against stack overflow).
12031//
12032// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
12033// Bounds checks must be performed before calling this function, preferably
12034// by calling upb_EpsCopyInputStream_IsDone().
12035//
12036// TODO: evaluate how the depth_limit should be specified. Do users need
12037// control over this?
12038UPB_INLINE const char* upb_WireReader_SkipValue(
12039 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
12040 return _upb_WireReader_SkipValue(ptr, tag, 100, stream);
12041}
12042
Eric Salob7d54ac2022-12-29 11:59:42 -080012043#ifdef __cplusplus
12044} /* extern "C" */
12045#endif
12046
12047
12048#endif // UPB_WIRE_READER_H_
12049
Adam Cozzette8059da22023-08-16 07:57:14 -070012050#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12051#define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12052
12053
12054#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12055#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12056
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012057#include <stdint.h>
12058
Adam Cozzette8059da22023-08-16 07:57:14 -070012059
12060// Must be last.
12061
12062#ifdef __cplusplus
12063extern "C" {
12064#endif
12065
12066UPB_INLINE char _upb_ToBase92(int8_t ch) {
12067 extern const char _kUpb_ToBase92[];
12068 UPB_ASSERT(0 <= ch && ch < 92);
12069 return _kUpb_ToBase92[ch];
12070}
12071
12072UPB_INLINE char _upb_FromBase92(uint8_t ch) {
12073 extern const int8_t _kUpb_FromBase92[];
12074 if (' ' > ch || ch > '~') return -1;
12075 return _kUpb_FromBase92[ch - ' '];
12076}
12077
12078UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr,
12079 const char* end, char first_ch,
12080 uint8_t min, uint8_t max,
12081 uint32_t* out_val) {
12082 uint32_t val = 0;
12083 uint32_t shift = 0;
12084 const int bits_per_char =
12085 upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min));
12086 char ch = first_ch;
12087 while (1) {
12088 uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min);
12089 val |= bits << shift;
12090 if (ptr == end || *ptr < min || max < *ptr) {
12091 *out_val = val;
12092 UPB_ASSUME(ptr != NULL);
12093 return ptr;
12094 }
12095 ch = *ptr++;
12096 shift += bits_per_char;
12097 if (shift >= 32) return NULL;
12098 }
12099}
12100
12101#ifdef __cplusplus
12102} /* extern "C" */
12103#endif
12104
12105
12106#endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12107
12108// Must be last.
12109
12110// upb_MdDecoder: used internally for decoding MiniDescriptors for messages,
12111// extensions, and enums.
12112typedef struct {
12113 const char* end;
12114 upb_Status* status;
12115 jmp_buf err;
12116} upb_MdDecoder;
12117
12118UPB_PRINTF(2, 3)
12119UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d,
12120 const char* fmt, ...) {
12121 if (d->status) {
12122 va_list argp;
12123 upb_Status_SetErrorMessage(d->status, "Error building mini table: ");
12124 va_start(argp, fmt);
12125 upb_Status_VAppendErrorFormat(d->status, fmt, argp);
12126 va_end(argp);
12127 }
12128 UPB_LONGJMP(d->err, 1);
12129}
12130
12131UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d,
12132 const void* ptr) {
12133 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory");
12134}
12135
12136UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint(
12137 upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max,
12138 uint32_t* out_val) {
12139 ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val);
12140 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint");
12141 return ptr;
12142}
12143
12144
12145#endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12146
12147#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12148#define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12149
12150
12151// Must be last.
12152
12153typedef enum {
12154 kUpb_EncodedType_Double = 0,
12155 kUpb_EncodedType_Float = 1,
12156 kUpb_EncodedType_Fixed32 = 2,
12157 kUpb_EncodedType_Fixed64 = 3,
12158 kUpb_EncodedType_SFixed32 = 4,
12159 kUpb_EncodedType_SFixed64 = 5,
12160 kUpb_EncodedType_Int32 = 6,
12161 kUpb_EncodedType_UInt32 = 7,
12162 kUpb_EncodedType_SInt32 = 8,
12163 kUpb_EncodedType_Int64 = 9,
12164 kUpb_EncodedType_UInt64 = 10,
12165 kUpb_EncodedType_SInt64 = 11,
12166 kUpb_EncodedType_OpenEnum = 12,
12167 kUpb_EncodedType_Bool = 13,
12168 kUpb_EncodedType_Bytes = 14,
12169 kUpb_EncodedType_String = 15,
12170 kUpb_EncodedType_Group = 16,
12171 kUpb_EncodedType_Message = 17,
12172 kUpb_EncodedType_ClosedEnum = 18,
12173
12174 kUpb_EncodedType_RepeatedBase = 20,
12175} upb_EncodedType;
12176
12177typedef enum {
12178 kUpb_EncodedFieldModifier_FlipPacked = 1 << 0,
12179 kUpb_EncodedFieldModifier_IsRequired = 1 << 1,
12180 kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2,
12181} upb_EncodedFieldModifier;
12182
12183enum {
12184 kUpb_EncodedValue_MinField = ' ',
12185 kUpb_EncodedValue_MaxField = 'I',
12186 kUpb_EncodedValue_MinModifier = 'L',
12187 kUpb_EncodedValue_MaxModifier = '[',
12188 kUpb_EncodedValue_End = '^',
12189 kUpb_EncodedValue_MinSkip = '_',
12190 kUpb_EncodedValue_MaxSkip = '~',
12191 kUpb_EncodedValue_OneofSeparator = '~',
12192 kUpb_EncodedValue_FieldSeparator = '|',
12193 kUpb_EncodedValue_MinOneofField = ' ',
12194 kUpb_EncodedValue_MaxOneofField = 'b',
12195 kUpb_EncodedValue_MaxEnumMask = 'A',
12196};
12197
12198enum {
12199 kUpb_EncodedVersion_EnumV1 = '!',
12200 kUpb_EncodedVersion_ExtensionV1 = '#',
12201 kUpb_EncodedVersion_MapV1 = '%',
12202 kUpb_EncodedVersion_MessageV1 = '$',
12203 kUpb_EncodedVersion_MessageSetV1 = '&',
12204};
12205
12206
12207#endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12208
12209#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12210#define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12211
12212// Must be last.
12213
12214typedef enum {
12215 kUpb_FieldModifier_IsRepeated = 1 << 0,
12216 kUpb_FieldModifier_IsPacked = 1 << 1,
12217 kUpb_FieldModifier_IsClosedEnum = 1 << 2,
12218 kUpb_FieldModifier_IsProto3Singular = 1 << 3,
12219 kUpb_FieldModifier_IsRequired = 1 << 4,
12220} kUpb_FieldModifier;
12221
12222typedef enum {
12223 kUpb_MessageModifier_ValidateUtf8 = 1 << 0,
12224 kUpb_MessageModifier_DefaultIsPacked = 1 << 1,
12225 kUpb_MessageModifier_IsExtendable = 1 << 2,
12226} kUpb_MessageModifier;
12227
12228
12229#endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12230
12231#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
12232#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
12233
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012234#include <stdint.h>
12235
Adam Cozzette8059da22023-08-16 07:57:14 -070012236
12237// Must be last.
12238
12239// If the input buffer has at least this many bytes available, the encoder call
12240// is guaranteed to succeed (as long as field number order is maintained).
12241#define kUpb_MtDataEncoder_MinSize 16
12242
12243typedef struct {
12244 char* end; // Limit of the buffer passed as a parameter.
12245 // Aliased to internal-only members in .cc.
12246 char internal[32];
12247} upb_MtDataEncoder;
12248
12249#ifdef __cplusplus
12250extern "C" {
12251#endif
12252
12253// Encodes field/oneof information for a given message. The sequence of calls
12254// should look like:
12255//
12256// upb_MtDataEncoder e;
12257// char buf[256];
12258// char* ptr = buf;
12259// e.end = ptr + sizeof(buf);
12260// unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero
12261// ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod);
12262// // Fields *must* be in field number order.
12263// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12264// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12265// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12266//
12267// // If oneofs are present. Oneofs must be encoded after regular fields.
12268// ptr = upb_MiniTable_StartOneof(&e, ptr)
12269// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12270// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12271//
12272// ptr = upb_MiniTable_StartOneof(&e, ptr);
12273// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12274// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12275//
12276// Oneofs must be encoded after all regular fields.
12277char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr,
12278 uint64_t msg_mod);
12279char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr,
12280 upb_FieldType type, uint32_t field_num,
12281 uint64_t field_mod);
12282char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr);
12283char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr,
12284 uint32_t field_num);
12285
12286// Encodes the set of values for a given enum. The values must be given in
12287// order (after casting to uint32_t), and repeats are not allowed.
12288char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr);
12289char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr,
12290 uint32_t val);
12291char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr);
12292
12293// Encodes an entire mini descriptor for an extension.
12294char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr,
12295 upb_FieldType type, uint32_t field_num,
12296 uint64_t field_mod);
12297
12298// Encodes an entire mini descriptor for a map.
12299char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr,
12300 upb_FieldType key_type,
12301 upb_FieldType value_type, uint64_t key_mod,
12302 uint64_t value_mod);
12303
12304// Encodes an entire mini descriptor for a message set.
12305char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr);
12306
12307#ifdef __cplusplus
12308} /* extern "C" */
12309#endif
12310
12311
12312#endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */
12313
Eric Salo8809a112022-11-21 13:01:06 -080012314#ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_
12315#define UPB_REFLECTION_DEF_POOL_INTERNAL_H_
12316
12317
12318// Must be last.
12319
12320#ifdef __cplusplus
12321extern "C" {
12322#endif
12323
12324upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s);
12325size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s);
12326upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s);
12327
12328bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext,
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012329 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012330bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v,
12331 upb_Status* status);
12332bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size,
12333 upb_value* v);
12334
12335void** _upb_DefPool_ScratchData(const upb_DefPool* s);
12336size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080012337void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform);
Eric Salo8809a112022-11-21 13:01:06 -080012338
12339// For generated code only: loads a generated descriptor.
12340typedef struct _upb_DefPool_Init {
12341 struct _upb_DefPool_Init** deps; // Dependencies of this file.
12342 const upb_MiniTableFile* layout;
12343 const char* filename;
12344 upb_StringView descriptor; // Serialized descriptor.
12345} _upb_DefPool_Init;
12346
12347bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init);
12348
12349// Should only be directly called by tests. This variant lets us suppress
12350// the use of compiled-in tables, forcing a rebuild of the tables at runtime.
12351bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init,
12352 bool rebuild_minitable);
12353
12354#ifdef __cplusplus
12355} /* extern "C" */
12356#endif
12357
12358
12359#endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */
12360
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000012361#ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
12362#define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
12363
12364
Eric Salo8809a112022-11-21 13:01:06 -080012365// Must be last.
12366
12367// We want to copy the options verbatim into the destination options proto.
12368// We use serialize+parse as our deep copy.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012369#define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \
12370 if (UPB_DESC(desc_type##_has_options)(proto)) { \
12371 size_t size; \
12372 char* pb = UPB_DESC(options_type##_serialize)( \
12373 UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \
12374 if (!pb) _upb_DefBuilder_OomErr(ctx); \
12375 target = \
12376 UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \
12377 if (!target) _upb_DefBuilder_OomErr(ctx); \
12378 } else { \
12379 target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \
Eric Salo8809a112022-11-21 13:01:06 -080012380 }
12381
12382#ifdef __cplusplus
12383extern "C" {
12384#endif
12385
12386struct upb_DefBuilder {
12387 upb_DefPool* symtab;
12388 upb_FileDef* file; // File we are building.
12389 upb_Arena* arena; // Allocate defs here.
12390 upb_Arena* tmp_arena; // For temporary allocations.
12391 upb_Status* status; // Record errors here.
12392 const upb_MiniTableFile* layout; // NULL if we should build layouts.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012393 upb_MiniTablePlatform platform; // Platform we are targeting.
Eric Salo8809a112022-11-21 13:01:06 -080012394 int enum_count; // Count of enums built so far.
12395 int msg_count; // Count of messages built so far.
12396 int ext_count; // Count of extensions built so far.
12397 jmp_buf err; // longjmp() on error.
12398};
12399
12400extern const char* kUpbDefOptDefault;
12401
12402// ctx->status has already been set elsewhere so just fail/longjmp()
12403UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx);
12404
12405UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt,
12406 ...) UPB_PRINTF(2, 3);
12407UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx);
12408
12409const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx,
12410 const char* prefix,
12411 upb_StringView name);
12412
12413// Given a symbol and the base symbol inside which it is defined,
12414// find the symbol's definition.
12415const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx,
12416 const char* from_name_dbg,
12417 const char* base, upb_StringView sym,
12418 upb_deftype_t* type);
12419
12420const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx,
12421 const char* from_name_dbg, const char* base,
12422 upb_StringView sym, upb_deftype_t type);
12423
12424char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f,
12425 const char** src, const char* end);
12426
12427const char* _upb_DefBuilder_FullToShort(const char* fullname);
12428
12429UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) {
12430 if (bytes == 0) return NULL;
12431 void* ret = upb_Arena_Malloc(ctx->arena, bytes);
12432 if (!ret) _upb_DefBuilder_OomErr(ctx);
12433 return ret;
12434}
12435
12436// Adds a symbol |v| to the symtab, which must be a def pointer previously
12437// packed with pack_def(). The def's pointer to upb_FileDef* must be set before
12438// adding, so we know which entries to remove if building this file fails.
12439UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name,
12440 upb_value v) {
12441 upb_StringView sym = {.data = name, .size = strlen(name)};
12442 bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status);
12443 if (!ok) _upb_DefBuilder_FailJmp(ctx);
12444}
12445
12446UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) {
12447 return ctx->arena;
12448}
12449
12450UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) {
12451 return ctx->file;
12452}
12453
12454// This version of CheckIdent() is only called by other, faster versions after
12455// they detect a parsing error.
12456void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name,
12457 bool full);
12458
Eric Salo8809a112022-11-21 13:01:06 -080012459// Verify a full identifier string. This is slightly more complicated than
12460// verifying a relative identifier string because we must track '.' chars.
12461UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx,
12462 upb_StringView name) {
12463 bool good = name.size > 0;
12464 bool start = true;
12465
12466 for (size_t i = 0; i < name.size; i++) {
12467 const char c = name.data[i];
12468 const char d = c | 0x20; // force lowercase
12469 const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_');
12470 const bool is_numer = ('0' <= c) & (c <= '9') & !start;
12471 const bool is_dot = (c == '.') & !start;
12472
12473 good &= is_alpha | is_numer | is_dot;
12474 start = is_dot;
12475 }
12476
12477 if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true);
12478}
12479
12480#ifdef __cplusplus
12481} /* extern "C" */
12482#endif
12483
12484
12485#endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */
12486
12487#ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
12488#define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
12489
12490
12491// Must be last.
12492
12493#ifdef __cplusplus
12494extern "C" {
12495#endif
12496
12497upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i);
12498bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a);
12499const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e);
12500
12501// Allocate and initialize an array of |n| enum defs.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012502upb_EnumDef* _upb_EnumDefs_New(
12503 upb_DefBuilder* ctx, int n,
12504 const UPB_DESC(EnumDescriptorProto) * const* protos,
12505 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080012506
12507#ifdef __cplusplus
12508} /* extern "C" */
12509#endif
12510
12511
12512#endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */
12513
12514#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
12515#define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
12516
12517
12518// Must be last.
12519
12520#ifdef __cplusplus
12521extern "C" {
12522#endif
12523
12524upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i);
12525
12526// Allocate and initialize an array of |n| enum value defs owned by |e|.
12527upb_EnumValueDef* _upb_EnumValueDefs_New(
12528 upb_DefBuilder* ctx, const char* prefix, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012529 const UPB_DESC(EnumValueDescriptorProto) * const* protos, upb_EnumDef* e,
Eric Salo8809a112022-11-21 13:01:06 -080012530 bool* is_sorted);
12531
12532const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v,
12533 int n, upb_Arena* a);
12534
12535#ifdef __cplusplus
12536} /* extern "C" */
12537#endif
12538
12539
12540#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */
12541
12542#ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
12543#define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
12544
12545
12546// Must be last.
12547
12548#ifdef __cplusplus
12549extern "C" {
12550#endif
12551
12552upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i);
12553
12554const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable(
12555 const upb_FieldDef* f);
12556bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f);
12557bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f);
12558int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
12559uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f);
12560void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix,
12561 upb_FieldDef* f);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012562void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx,
12563 const upb_FieldDef* f);
12564
12565// Allocate and initialize an array of |n| extensions (field defs).
12566upb_FieldDef* _upb_Extensions_New(
12567 upb_DefBuilder* ctx, int n,
12568 const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix,
12569 upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012570
12571// Allocate and initialize an array of |n| field defs.
12572upb_FieldDef* _upb_FieldDefs_New(
12573 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012574 const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix,
Eric Salo8809a112022-11-21 13:01:06 -080012575 upb_MessageDef* m, bool* is_sorted);
12576
12577// Allocate and return a list of pointers to the |n| field defs in |ff|,
12578// sorted by field number.
12579const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n,
12580 upb_Arena* a);
12581
12582#ifdef __cplusplus
12583} /* extern "C" */
12584#endif
12585
12586
12587#endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */
12588
12589#ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_
12590#define UPB_REFLECTION_FILE_DEF_INTERNAL_H_
12591
12592
12593// Must be last.
12594
12595#ifdef __cplusplus
12596extern "C" {
12597#endif
12598
12599const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable(
12600 const upb_FileDef* f, int i);
12601const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f);
12602const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f);
12603
12604// upb_FileDef_Package() returns "" if f->package is NULL, this does not.
12605const char* _upb_FileDef_RawPackage(const upb_FileDef* f);
12606
12607void _upb_FileDef_Create(upb_DefBuilder* ctx,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012608 const UPB_DESC(FileDescriptorProto) * file_proto);
Eric Salo8809a112022-11-21 13:01:06 -080012609
12610#ifdef __cplusplus
12611} /* extern "C" */
12612#endif
12613
12614
12615#endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */
12616
12617#ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
12618#define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
12619
12620
12621// Must be last.
12622
12623#ifdef __cplusplus
12624extern "C" {
12625#endif
12626
12627upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i);
12628bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m);
12629bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size,
12630 upb_value v, upb_Arena* a);
12631void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
12632 const upb_FieldDef* f);
12633bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012634void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012635void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx,
12636 const upb_MessageDef* m);
12637void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m);
12638
12639// Allocate and initialize an array of |n| message defs.
12640upb_MessageDef* _upb_MessageDefs_New(
Mike Kruskal232ecf42023-01-14 00:09:40 -080012641 upb_DefBuilder* ctx, int n, const UPB_DESC(DescriptorProto) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012642 const upb_MessageDef* containing_type);
12643
12644#ifdef __cplusplus
12645} /* extern "C" */
12646#endif
12647
12648
12649#endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */
12650
12651#ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
12652#define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
12653
12654
12655// Must be last.
12656
12657#ifdef __cplusplus
12658extern "C" {
12659#endif
12660
12661upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i);
12662
12663// Allocate and initialize an array of |n| service defs.
12664upb_ServiceDef* _upb_ServiceDefs_New(
12665 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012666 const UPB_DESC(ServiceDescriptorProto) * const* protos);
Eric Salo8809a112022-11-21 13:01:06 -080012667
12668#ifdef __cplusplus
12669} /* extern "C" */
12670#endif
12671
12672
12673#endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */
12674
12675#ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_
12676#define UPB_REFLECTION_DESC_STATE_INTERNAL_H_
12677
12678
12679// Must be last.
12680
12681// Manages the storage for mini descriptor strings as they are being encoded.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000012682// TODO: Move some of this state directly into the encoder, maybe.
Eric Salo8809a112022-11-21 13:01:06 -080012683typedef struct {
12684 upb_MtDataEncoder e;
12685 size_t bufsize;
12686 char* buf;
12687 char* ptr;
12688} upb_DescState;
12689
12690#ifdef __cplusplus
12691extern "C" {
12692#endif
12693
12694UPB_INLINE void _upb_DescState_Init(upb_DescState* d) {
12695 d->bufsize = kUpb_MtDataEncoder_MinSize * 2;
12696 d->buf = NULL;
12697 d->ptr = NULL;
12698}
12699
12700bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a);
12701
12702#ifdef __cplusplus
12703} /* extern "C" */
12704#endif
12705
12706
12707#endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */
12708
12709#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
12710#define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
12711
12712
Protobuf Team Botfea76452023-09-12 20:32:11 +000012713// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012714
12715#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
12716#define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
12717
12718
12719// Must be last.
12720
12721#ifdef __cplusplus
12722extern "C" {
12723#endif
12724
12725int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r);
12726int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r);
12727
12728#ifdef __cplusplus
12729} /* extern "C" */
12730#endif
12731
12732
12733#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */
12734
12735// Must be last.
12736
12737#ifdef __cplusplus
12738extern "C" {
12739#endif
12740
12741upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r,
12742 int i);
12743
12744// Allocate and initialize an array of |n| reserved ranges owned by |e|.
12745upb_EnumReservedRange* _upb_EnumReservedRanges_New(
12746 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012747 const UPB_DESC(EnumDescriptorProto_EnumReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012748 const upb_EnumDef* e);
12749
12750#ifdef __cplusplus
12751} /* extern "C" */
12752#endif
12753
12754
12755#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */
12756
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000012757#ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_
12758#define UPB_REFLECTION_INTERNAL_STRDUP2_H_
12759
12760#include <stddef.h>
12761
12762
12763// Must be last.
12764
12765#ifdef __cplusplus
12766extern "C" {
12767#endif
12768
12769// Variant that works with a length-delimited rather than NULL-delimited string,
12770// as supported by strtable.
12771char* upb_strdup2(const char* s, size_t len, upb_Arena* a);
12772
12773#ifdef __cplusplus
12774} /* extern "C" */
12775#endif
12776
12777
12778#endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */
12779
Eric Salo8809a112022-11-21 13:01:06 -080012780#ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
12781#define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
12782
12783
12784// Must be last.
12785
12786#ifdef __cplusplus
12787extern "C" {
12788#endif
12789
12790upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i);
12791
12792// Allocate and initialize an array of |n| extension ranges owned by |m|.
12793upb_ExtensionRange* _upb_ExtensionRanges_New(
12794 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012795 const UPB_DESC(DescriptorProto_ExtensionRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012796 const upb_MessageDef* m);
12797
12798#ifdef __cplusplus
12799} /* extern "C" */
12800#endif
12801
12802
12803#endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */
12804
12805#ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
12806#define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
12807
12808
12809// Must be last.
12810
12811#ifdef __cplusplus
12812extern "C" {
12813#endif
12814
12815upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012816void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o,
12817 const upb_FieldDef* f, const char* name, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -080012818
12819// Allocate and initialize an array of |n| oneof defs owned by |m|.
12820upb_OneofDef* _upb_OneofDefs_New(
12821 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012822 const UPB_DESC(OneofDescriptorProto) * const* protos, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012823
12824size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m);
12825
12826#ifdef __cplusplus
12827} /* extern "C" */
12828#endif
12829
12830
12831#endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */
12832
12833#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
12834#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
12835
12836
Protobuf Team Botfea76452023-09-12 20:32:11 +000012837// IWYU pragma: private, include "upb/upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012838
12839#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
12840#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
12841
12842
12843// Must be last.
12844
12845#ifdef __cplusplus
12846extern "C" {
12847#endif
12848
12849int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r);
12850int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r);
12851
12852#ifdef __cplusplus
12853} /* extern "C" */
12854#endif
12855
12856
12857#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */
12858
12859// Must be last.
12860
12861#ifdef __cplusplus
12862extern "C" {
12863#endif
12864
12865upb_MessageReservedRange* _upb_MessageReservedRange_At(
12866 const upb_MessageReservedRange* r, int i);
12867
12868// Allocate and initialize an array of |n| reserved ranges owned by |m|.
12869upb_MessageReservedRange* _upb_MessageReservedRanges_New(
12870 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012871 const UPB_DESC(DescriptorProto_ReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012872 const upb_MessageDef* m);
12873
12874#ifdef __cplusplus
12875} /* extern "C" */
12876#endif
12877
12878
12879#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */
12880
12881#ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
12882#define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
12883
12884
12885// Must be last.
12886
12887#ifdef __cplusplus
12888extern "C" {
12889#endif
12890
12891upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i);
12892
12893// Allocate and initialize an array of |n| method defs owned by |s|.
12894upb_MethodDef* _upb_MethodDefs_New(
12895 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012896 const UPB_DESC(MethodDescriptorProto) * const* protos, upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012897
12898#ifdef __cplusplus
12899} /* extern "C" */
12900#endif
12901
12902
12903#endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */
12904
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012905#ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_
12906#define UPB_WIRE_INTERNAL_CONSTANTS_H_
Eric Salo8809a112022-11-21 13:01:06 -080012907
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012908#define kUpb_WireFormat_DefaultDepthLimit 100
Eric Salo8809a112022-11-21 13:01:06 -080012909
12910// MessageSet wire format is:
12911// message MessageSet {
12912// repeated group Item = 1 {
12913// required int32 type_id = 2;
12914// required bytes message = 3;
12915// }
12916// }
12917
12918enum {
12919 kUpb_MsgSet_Item = 1,
12920 kUpb_MsgSet_TypeId = 2,
12921 kUpb_MsgSet_Message = 3,
12922};
12923
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012924#endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */
Eric Salo8809a112022-11-21 13:01:06 -080012925
12926/*
12927 * Internal implementation details of the decoder that are shared between
12928 * decode.c and decode_fast.c.
12929 */
12930
Sandy Zhange3b09432023-08-07 09:30:02 -070012931#ifndef UPB_WIRE_INTERNAL_DECODE_H_
12932#define UPB_WIRE_INTERNAL_DECODE_H_
Eric Salo8809a112022-11-21 13:01:06 -080012933
Eric Salo3f36a912022-12-05 14:12:25 -080012934#include "utf8_range.h"
Joshua Habermand3995ec2022-09-30 16:54:39 -070012935
12936// Must be last.
12937
12938#define DECODE_NOGROUP (uint32_t) - 1
12939
12940typedef struct upb_Decoder {
Eric Salo10505992022-12-12 12:16:36 -080012941 upb_EpsCopyInputStream input;
12942 const upb_ExtensionRegistry* extreg;
12943 const char* unknown; // Start of unknown data, preserve at buffer flip
12944 upb_Message* unknown_msg; // Pointer to preserve data to
12945 int depth; // Tracks recursion depth to bound stack usage.
12946 uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP.
Joshua Habermand3995ec2022-09-30 16:54:39 -070012947 uint16_t options;
12948 bool missing_required;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012949 upb_Arena arena;
Mike Kruskal232ecf42023-01-14 00:09:40 -080012950 upb_DecodeStatus status;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012951 jmp_buf err;
12952
12953#ifndef NDEBUG
12954 const char* debug_tagstart;
12955 const char* debug_valstart;
12956#endif
12957} upb_Decoder;
12958
12959/* Error function that will abort decoding with longjmp(). We can't declare this
12960 * UPB_NORETURN, even though it is appropriate, because if we do then compilers
12961 * will "helpfully" refuse to tailcall to it
12962 * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
12963 * of our optimizations. That is also why we must declare it in a separate file,
12964 * otherwise the compiler will see that it calls longjmp() and deduce that it is
12965 * noreturn. */
12966const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status);
12967
12968extern const uint8_t upb_utf8_offsets[];
12969
12970UPB_INLINE
12971bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) {
12972 const char* end = ptr + len;
12973
12974 // Check 8 bytes at a time for any non-ASCII char.
12975 while (end - ptr >= 8) {
12976 uint64_t data;
12977 memcpy(&data, ptr, 8);
12978 if (data & 0x8080808080808080) goto non_ascii;
12979 ptr += 8;
12980 }
12981
12982 // Check one byte at a time for non-ASCII.
12983 while (ptr < end) {
12984 if (*ptr & 0x80) goto non_ascii;
12985 ptr++;
12986 }
12987
12988 return true;
12989
12990non_ascii:
12991 return utf8_range2((const unsigned char*)ptr, end - ptr) == 0;
12992}
12993
12994const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr,
12995 const upb_Message* msg,
12996 const upb_MiniTable* l);
12997
12998/* x86-64 pointers always have the high 16 bits matching. So we can shift
12999 * left 8 and right 8 without loss of information. */
13000UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) {
13001 return ((intptr_t)tablep << 8) | tablep->table_mask;
13002}
13003
13004UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) {
13005 return (const upb_MiniTable*)(table >> 8);
13006}
13007
Eric Salo10505992022-12-12 12:16:36 -080013008const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
13009 const char* ptr, int overrun);
13010
13011UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) {
Eric Salob7d54ac2022-12-29 11:59:42 -080013012 return upb_EpsCopyInputStream_IsDoneWithCallback(
13013 &d->input, ptr, &_upb_Decoder_IsDoneFallback);
Joshua Habermand3995ec2022-09-30 16:54:39 -070013014}
13015
Eric Salo10505992022-12-12 12:16:36 -080013016UPB_INLINE const char* _upb_Decoder_BufferFlipCallback(
13017 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) {
13018 upb_Decoder* d = (upb_Decoder*)e;
13019 if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
Joshua Habermand3995ec2022-09-30 16:54:39 -070013020
Eric Salo10505992022-12-12 12:16:36 -080013021 if (d->unknown) {
13022 if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown,
13023 old_end - d->unknown, &d->arena)) {
13024 _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
13025 }
13026 d->unknown = new_start;
Joshua Habermand3995ec2022-09-30 16:54:39 -070013027 }
Eric Salo10505992022-12-12 12:16:36 -080013028 return new_start;
Joshua Habermand3995ec2022-09-30 16:54:39 -070013029}
13030
13031#if UPB_FASTTABLE
13032UPB_INLINE
13033const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr,
13034 upb_Message* msg, intptr_t table,
13035 uint64_t hasbits, uint64_t tag) {
13036 const upb_MiniTable* table_p = decode_totablep(table);
13037 uint8_t mask = table;
13038 uint64_t data;
13039 size_t idx = tag & mask;
13040 UPB_ASSUME((idx & 7) == 0);
13041 idx >>= 3;
13042 data = table_p->fasttable[idx].field_data ^ tag;
13043 UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table,
13044 hasbits, data);
13045}
13046#endif
13047
13048UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) {
13049 uint16_t tag;
13050 memcpy(&tag, ptr, 2);
13051 return tag;
13052}
13053
Joshua Habermand3995ec2022-09-30 16:54:39 -070013054
Sandy Zhange3b09432023-08-07 09:30:02 -070013055#endif /* UPB_WIRE_INTERNAL_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -070013056
Eric Salo8809a112022-11-21 13:01:06 -080013057// This should #undef all macros #defined in def.inc
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013058
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013059#undef UPB_SIZE
13060#undef UPB_PTR_AT
Joshua Habermandd69a482021-05-17 22:40:33 -070013061#undef UPB_MAPTYPE_STRING
Eric Salo3f36a912022-12-05 14:12:25 -080013062#undef UPB_EXPORT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013063#undef UPB_INLINE
Eric Salo3f36a912022-12-05 14:12:25 -080013064#undef UPB_API
13065#undef UPB_API_INLINE
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013066#undef UPB_ALIGN_UP
13067#undef UPB_ALIGN_DOWN
13068#undef UPB_ALIGN_MALLOC
13069#undef UPB_ALIGN_OF
Joshua Habermand3995ec2022-09-30 16:54:39 -070013070#undef UPB_MALLOC_ALIGN
Joshua Habermandd69a482021-05-17 22:40:33 -070013071#undef UPB_LIKELY
13072#undef UPB_UNLIKELY
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013073#undef UPB_FORCEINLINE
13074#undef UPB_NOINLINE
13075#undef UPB_NORETURN
Joshua Habermandd69a482021-05-17 22:40:33 -070013076#undef UPB_PRINTF
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013077#undef UPB_MAX
13078#undef UPB_MIN
13079#undef UPB_UNUSED
13080#undef UPB_ASSUME
13081#undef UPB_ASSERT
13082#undef UPB_UNREACHABLE
Joshua Habermandd69a482021-05-17 22:40:33 -070013083#undef UPB_SETJMP
13084#undef UPB_LONGJMP
13085#undef UPB_PTRADD
13086#undef UPB_MUSTTAIL
13087#undef UPB_FASTTABLE_SUPPORTED
Mike Kruskal232ecf42023-01-14 00:09:40 -080013088#undef UPB_FASTTABLE_MASK
Joshua Habermandd69a482021-05-17 22:40:33 -070013089#undef UPB_FASTTABLE
13090#undef UPB_FASTTABLE_INIT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013091#undef UPB_POISON_MEMORY_REGION
13092#undef UPB_UNPOISON_MEMORY_REGION
13093#undef UPB_ASAN
Sandy Zhange3b09432023-08-07 09:30:02 -070013094#undef UPB_ASAN_GUARD_SIZE
13095#undef UPB_CLANG_ASAN
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070013096#undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3
Joshua Habermand3995ec2022-09-30 16:54:39 -070013097#undef UPB_DEPRECATED
13098#undef UPB_GNUC_MIN
Mike Kruskal232ecf42023-01-14 00:09:40 -080013099#undef UPB_DESCRIPTOR_UPB_H_FILENAME
13100#undef UPB_DESC
13101#undef UPB_IS_GOOGLE3
Eric Salodfb71552023-03-22 12:35:09 -070013102#undef UPB_ATOMIC
13103#undef UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -070013104#undef UPB_PRIVATE