blob: c4be0d71dd0f9cd1ee8e5c4c2dad3d6fc6b05d14 [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 Bot06310352023-09-26 21:54:58 +000012 * #include "upb/foobar.h"
13 * #include "upb/baz.h"
Joshua Habermandd69a482021-05-17 22:40:33 -070014 *
15 * // MUST be last included header.
Protobuf Team Bot06310352023-09-26 21:54:58 +000016 * #include "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 Bot06310352023-09-26 21:54:58 +000022 * #include "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
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000365#ifndef UPB_GENERATED_CODE_SUPPORT_H_
366#define UPB_GENERATED_CODE_SUPPORT_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700367
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000368// IWYU pragma: begin_exports
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800369
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000370#ifndef UPB_MESSAGE_ACCESSORS_H_
371#define UPB_MESSAGE_ACCESSORS_H_
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000372
Joshua Habermand3995ec2022-09-30 16:54:39 -0700373
Eric Salo8809a112022-11-21 13:01:06 -0800374#ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_
375#define UPB_BASE_DESCRIPTOR_CONSTANTS_H_
376
Eric Salodfb71552023-03-22 12:35:09 -0700377// Must be last.
378
Eric Salo8809a112022-11-21 13:01:06 -0800379// The types a field can have. Note that this list is not identical to the
380// types defined in descriptor.proto, which gives INT32 and SINT32 separate
381// types (we distinguish the two with the "integer encoding" enum below).
382// This enum is an internal convenience only and has no meaning outside of upb.
383typedef enum {
384 kUpb_CType_Bool = 1,
385 kUpb_CType_Float = 2,
386 kUpb_CType_Int32 = 3,
387 kUpb_CType_UInt32 = 4,
Protobuf Team Bot986cbb62023-09-19 15:03:51 +0000388 kUpb_CType_Enum = 5, // Enum values are int32. TODO: rename
Eric Salo8809a112022-11-21 13:01:06 -0800389 kUpb_CType_Message = 6,
390 kUpb_CType_Double = 7,
391 kUpb_CType_Int64 = 8,
392 kUpb_CType_UInt64 = 9,
393 kUpb_CType_String = 10,
394 kUpb_CType_Bytes = 11
395} upb_CType;
396
397// The repeated-ness of each field; this matches descriptor.proto.
398typedef enum {
399 kUpb_Label_Optional = 1,
400 kUpb_Label_Required = 2,
401 kUpb_Label_Repeated = 3
402} upb_Label;
403
404// Descriptor types, as defined in descriptor.proto.
405typedef enum {
406 kUpb_FieldType_Double = 1,
407 kUpb_FieldType_Float = 2,
408 kUpb_FieldType_Int64 = 3,
409 kUpb_FieldType_UInt64 = 4,
410 kUpb_FieldType_Int32 = 5,
411 kUpb_FieldType_Fixed64 = 6,
412 kUpb_FieldType_Fixed32 = 7,
413 kUpb_FieldType_Bool = 8,
414 kUpb_FieldType_String = 9,
415 kUpb_FieldType_Group = 10,
416 kUpb_FieldType_Message = 11,
417 kUpb_FieldType_Bytes = 12,
418 kUpb_FieldType_UInt32 = 13,
419 kUpb_FieldType_Enum = 14,
420 kUpb_FieldType_SFixed32 = 15,
421 kUpb_FieldType_SFixed64 = 16,
422 kUpb_FieldType_SInt32 = 17,
423 kUpb_FieldType_SInt64 = 18,
424} upb_FieldType;
425
426#define kUpb_FieldType_SizeOf 19
427
Eric Salodfb71552023-03-22 12:35:09 -0700428#ifdef __cplusplus
429extern "C" {
430#endif
431
432UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) {
433 // clang-format off
434 const unsigned kUnpackableTypes =
435 (1 << kUpb_FieldType_String) |
436 (1 << kUpb_FieldType_Bytes) |
437 (1 << kUpb_FieldType_Message) |
438 (1 << kUpb_FieldType_Group);
439 // clang-format on
440 return (1 << type) & ~kUnpackableTypes;
441}
442
443#ifdef __cplusplus
444} /* extern "C" */
445#endif
446
447
Eric Salo8809a112022-11-21 13:01:06 -0800448#endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */
449
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000450#ifndef UPB_MESSAGE_ARRAY_H_
451#define UPB_MESSAGE_ARRAY_H_
452
453#include <stddef.h>
454
455
Eric Salo8809a112022-11-21 13:01:06 -0800456/* upb_Arena is a specific allocator implementation that uses arena allocation.
457 * The user provides an allocator that will be used to allocate the underlying
458 * arena blocks. Arenas by nature do not require the individual allocations
459 * to be freed. However the Arena does allow users to register cleanup
460 * functions that will run when the arena is destroyed.
Joshua Habermandd69a482021-05-17 22:40:33 -0700461 *
Eric Salo8809a112022-11-21 13:01:06 -0800462 * A upb_Arena is *not* thread-safe.
463 *
464 * You could write a thread-safe arena allocator that satisfies the
465 * upb_alloc interface, but it would not be as efficient for the
466 * single-threaded case. */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800467
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700468#ifndef UPB_MEM_ARENA_H_
469#define UPB_MEM_ARENA_H_
Joshua Habermandd69a482021-05-17 22:40:33 -0700470
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700471#include <stddef.h>
472#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800473#include <string.h>
474
475
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700476#ifndef UPB_MEM_ALLOC_H_
477#define UPB_MEM_ALLOC_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700478
479// Must be last.
480
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800481#ifdef __cplusplus
482extern "C" {
483#endif
484
Joshua Habermand3995ec2022-09-30 16:54:39 -0700485typedef struct upb_alloc upb_alloc;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800486
Joshua Habermand3995ec2022-09-30 16:54:39 -0700487/* A combined `malloc()`/`free()` function.
488 * If `size` is 0 then the function acts like `free()`, otherwise it acts like
489 * `realloc()`. Only `oldsize` bytes from a previous allocation are
490 * preserved. */
491typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize,
492 size_t size);
493
494/* A upb_alloc is a possibly-stateful allocator object.
495 *
496 * It could either be an arena allocator (which doesn't require individual
497 * `free()` calls) or a regular `malloc()` (which does). The client must
498 * therefore free memory unless it knows that the allocator is an arena
499 * allocator. */
500struct upb_alloc {
501 upb_alloc_func* func;
502};
503
504UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) {
505 UPB_ASSERT(alloc);
506 return alloc->func(alloc, NULL, 0, size);
507}
508
509UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize,
510 size_t size) {
511 UPB_ASSERT(alloc);
512 return alloc->func(alloc, ptr, oldsize, size);
513}
514
515UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) {
516 UPB_ASSERT(alloc);
517 alloc->func(alloc, ptr, 0, 0);
518}
519
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700520// The global allocator used by upb. Uses the standard malloc()/free().
Joshua Habermand3995ec2022-09-30 16:54:39 -0700521
522extern upb_alloc upb_alloc_global;
523
524/* Functions that hard-code the global malloc.
525 *
526 * We still get benefit because we can put custom logic into our global
527 * allocator, like injecting out-of-memory faults in debug/testing builds. */
528
529UPB_INLINE void* upb_gmalloc(size_t size) {
530 return upb_malloc(&upb_alloc_global, size);
531}
532
533UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) {
534 return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
535}
536
537UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); }
538
539#ifdef __cplusplus
540} /* extern "C" */
541#endif
542
543
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700544#endif /* UPB_MEM_ALLOC_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700545
546// Must be last.
547
Joshua Habermand3995ec2022-09-30 16:54:39 -0700548typedef struct upb_Arena upb_Arena;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800549
550typedef struct {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700551 char *ptr, *end;
552} _upb_ArenaHead;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800553
Eric Salo8809a112022-11-21 13:01:06 -0800554#ifdef __cplusplus
555extern "C" {
556#endif
557
Mike Kruskal3bc50492022-12-01 13:34:12 -0800558// Creates an arena from the given initial block (if any -- n may be 0).
559// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
560// is a fixed-size arena and cannot grow.
Eric Salo3f36a912022-12-05 14:12:25 -0800561UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc);
Mike Kruskal3bc50492022-12-01 13:34:12 -0800562
Eric Salo3f36a912022-12-05 14:12:25 -0800563UPB_API void upb_Arena_Free(upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -0800564UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b);
565
Protobuf Team Bot777d6a92023-10-06 23:52:49 +0000566void upb_Arena_IncRefFor(upb_Arena* arena, const void* owner);
567void upb_Arena_DecRefFor(upb_Arena* arena, const void* owner);
568
Joshua Habermand3995ec2022-09-30 16:54:39 -0700569void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size);
570size_t upb_Arena_SpaceAllocated(upb_Arena* arena);
571uint32_t upb_Arena_DebugRefCount(upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800572
Joshua Habermand3995ec2022-09-30 16:54:39 -0700573UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) {
574 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
575 return (size_t)(h->end - h->ptr);
576}
577
Eric Salo3f36a912022-12-05 14:12:25 -0800578UPB_API_INLINE void* upb_Arena_Malloc(upb_Arena* a, size_t size) {
Eric Salo8809a112022-11-21 13:01:06 -0800579 size = UPB_ALIGN_MALLOC(size);
Sandy Zhange3b09432023-08-07 09:30:02 -0700580 size_t span = size + UPB_ASAN_GUARD_SIZE;
581 if (UPB_UNLIKELY(_upb_ArenaHas(a) < span)) {
Eric Salo8809a112022-11-21 13:01:06 -0800582 return _upb_Arena_SlowMalloc(a, size);
583 }
584
585 // We have enough space to do a fast malloc.
Joshua Habermand3995ec2022-09-30 16:54:39 -0700586 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
587 void* ret = h->ptr;
588 UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret);
589 UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size);
590 UPB_UNPOISON_MEMORY_REGION(ret, size);
591
Sandy Zhange3b09432023-08-07 09:30:02 -0700592 h->ptr += span;
Joshua Habermand3995ec2022-09-30 16:54:39 -0700593
594 return ret;
595}
596
Joshua Habermand3995ec2022-09-30 16:54:39 -0700597// Shrinks the last alloc from arena.
598// REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena.
599// We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if
600// this was not the last alloc.
Eric Salo3f36a912022-12-05 14:12:25 -0800601UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
602 size_t oldsize, size_t size) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700603 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
604 oldsize = UPB_ALIGN_MALLOC(oldsize);
605 size = UPB_ALIGN_MALLOC(size);
Sandy Zhange3b09432023-08-07 09:30:02 -0700606 // Must be the last alloc.
607 UPB_ASSERT((char*)ptr + oldsize == h->ptr - UPB_ASAN_GUARD_SIZE);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700608 UPB_ASSERT(size <= oldsize);
609 h->ptr = (char*)ptr + size;
610}
611
Eric Salo3f36a912022-12-05 14:12:25 -0800612UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
613 size_t size) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700614 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
615 oldsize = UPB_ALIGN_MALLOC(oldsize);
616 size = UPB_ALIGN_MALLOC(size);
617 bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr;
618
619 if (is_most_recent_alloc) {
620 ptrdiff_t diff = size - oldsize;
621 if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) {
622 h->ptr += diff;
623 return ptr;
624 }
625 } else if (size <= oldsize) {
626 return ptr;
627 }
628
629 void* ret = upb_Arena_Malloc(a, size);
630
631 if (ret && oldsize > 0) {
632 memcpy(ret, ptr, UPB_MIN(oldsize, size));
633 }
634
635 return ret;
636}
637
Eric Salo3f36a912022-12-05 14:12:25 -0800638UPB_API_INLINE upb_Arena* upb_Arena_New(void) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700639 return upb_Arena_Init(NULL, 0, &upb_alloc_global);
640}
641
642#ifdef __cplusplus
643} /* extern "C" */
644#endif
645
646
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700647#endif /* UPB_MEM_ARENA_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700648
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000649// Users should include array.h or map.h instead.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000650// IWYU pragma: private, include "upb/message/array.h"
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000651
652#ifndef UPB_MESSAGE_VALUE_H_
653#define UPB_MESSAGE_VALUE_H_
654
655#include <stdint.h>
656
657#ifndef UPB_BASE_STRING_VIEW_H_
658#define UPB_BASE_STRING_VIEW_H_
659
660#include <string.h>
661
Joshua Habermand3995ec2022-09-30 16:54:39 -0700662// Must be last.
663
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000664#define UPB_STRINGVIEW_INIT(ptr, len) \
665 { ptr, len }
666
667#define UPB_STRINGVIEW_FORMAT "%.*s"
668#define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data
669
670// LINT.IfChange(struct_definition)
671typedef struct {
672 const char* data;
673 size_t size;
674} upb_StringView;
675// LINT.ThenChange(
676// GoogleInternalName0,
677// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string
678// )
679
680#ifdef __cplusplus
681extern "C" {
682#endif
683
684UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data,
685 size_t size) {
686 upb_StringView ret;
687 ret.data = data;
688 ret.size = size;
689 return ret;
690}
691
692UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) {
693 return upb_StringView_FromDataAndSize(data, strlen(data));
694}
695
696UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
697 return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
698}
699
700#ifdef __cplusplus
701} /* extern "C" */
702#endif
703
704
705#endif /* UPB_BASE_STRING_VIEW_H_ */
706
707#ifndef UPB_MINI_TABLE_TYPES_H_
708#define UPB_MINI_TABLE_TYPES_H_
709
710#include <stdint.h>
711
712
713#ifndef UPB_MESSAGE_TYPES_H_
714#define UPB_MESSAGE_TYPES_H_
715
716// This typedef is in a leaf header to resolve a circular dependency between
717// messages and mini tables.
718typedef void upb_Message;
719
720#endif /* UPB_MESSAGE_TYPES_H_ */
721
722// Must be last.
723
724#ifdef __cplusplus
725extern "C" {
726#endif
727
728// When a upb_Message* is stored in a message, array, or map, it is stored in a
729// tagged form. If the tag bit is set, the referenced upb_Message is of type
730// _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of
731// that field's true message type. This forms the basis of what we call
732// "dynamic tree shaking."
733//
734// See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for
735// more information.
736typedef uintptr_t upb_TaggedMessagePtr;
737
738// Internal-only because empty messages cannot be created by the user.
739UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr,
740 bool empty) {
741 UPB_ASSERT(((uintptr_t)ptr & 1) == 0);
742 return (uintptr_t)ptr | (empty ? 1 : 0);
743}
744
745// Users who enable unlinked sub-messages must use this to test whether a
746// message is empty before accessing it. If a message is empty, it must be
747// first promoted using the interfaces in message/promote.h.
748UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) {
749 return ptr & 1;
750}
751
752UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage(
753 upb_TaggedMessagePtr ptr) {
754 return (upb_Message*)(ptr & ~(uintptr_t)1);
755}
756
757UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
758 upb_TaggedMessagePtr ptr) {
759 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr));
760 return _upb_TaggedMessagePtr_GetMessage(ptr);
761}
762
763UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage(
764 upb_TaggedMessagePtr ptr) {
765 UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr));
766 return _upb_TaggedMessagePtr_GetMessage(ptr);
767}
768
769#ifdef __cplusplus
770} /* extern "C" */
771#endif
772
773
774#endif /* UPB_MINI_TABLE_TYPES_H_ */
775
776typedef union {
777 bool bool_val;
778 float float_val;
779 double double_val;
780 int32_t int32_val;
781 int64_t int64_val;
782 uint32_t uint32_val;
783 uint64_t uint64_val;
784 const struct upb_Array* array_val;
785 const struct upb_Map* map_val;
786 const upb_Message* msg_val;
787 upb_StringView str_val;
788
789 // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of
790 // msg_val if unlinked sub-messages may possibly be in use. See the
791 // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more
792 // information.
793 upb_TaggedMessagePtr tagged_msg_val;
794} upb_MessageValue;
795
796typedef union {
797 struct upb_Array* array;
798 struct upb_Map* map;
799 upb_Message* msg;
800} upb_MutableMessageValue;
801
802#endif /* UPB_MESSAGE_VALUE_H_ */
803
804// Must be last.
805
806typedef struct upb_Array upb_Array;
807
Joshua Habermand3995ec2022-09-30 16:54:39 -0700808#ifdef __cplusplus
809extern "C" {
810#endif
811
Eric Salob598b2d2022-12-22 23:14:27 -0800812// Creates a new array on the given arena that holds elements of this type.
813UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700814
Eric Salob598b2d2022-12-22 23:14:27 -0800815// Returns the number of elements in the array.
816UPB_API size_t upb_Array_Size(const upb_Array* arr);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700817
Eric Salob598b2d2022-12-22 23:14:27 -0800818// Returns the given element, which must be within the array's current size.
819UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700820
Eric Salob598b2d2022-12-22 23:14:27 -0800821// Sets the given element, which must be within the array's current size.
822UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700823
Eric Salob598b2d2022-12-22 23:14:27 -0800824// Appends an element to the array. Returns false on allocation failure.
825UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val,
826 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700827
Eric Salob598b2d2022-12-22 23:14:27 -0800828// Moves elements within the array using memmove().
829// Like memmove(), the source and destination elements may be overlapping.
830UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx,
831 size_t count);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700832
Eric Salob598b2d2022-12-22 23:14:27 -0800833// Inserts one or more empty elements into the array.
834// Existing elements are shifted right.
835// The new elements have undefined state and must be set with `upb_Array_Set()`.
836// REQUIRES: `i <= upb_Array_Size(arr)`
837UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count,
838 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700839
Eric Salob598b2d2022-12-22 23:14:27 -0800840// Deletes one or more elements from the array.
841// Existing elements are shifted left.
842// REQUIRES: `i + count <= upb_Array_Size(arr)`
843UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700844
Eric Salob598b2d2022-12-22 23:14:27 -0800845// Changes the size of a vector. New elements are initialized to NULL/0.
846// Returns false on allocation failure.
847UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700848
Jie Luo3560e232023-06-12 00:33:50 -0700849// Returns pointer to array data.
850UPB_API const void* upb_Array_DataPtr(const upb_Array* arr);
851
852// Returns mutable pointer to array data.
853UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr);
854
Joshua Habermand3995ec2022-09-30 16:54:39 -0700855#ifdef __cplusplus
856} /* extern "C" */
857#endif
858
859
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000860#endif /* UPB_MESSAGE_ARRAY_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700861
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000862#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
863#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
Protobuf Team Botdcc1f612023-09-05 21:56:25 +0000864
Protobuf Team Botdcc1f612023-09-05 21:56:25 +0000865
Adam Cozzette8059da22023-08-16 07:57:14 -0700866#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
867#define UPB_MESSAGE_INTERNAL_EXTENSION_H_
Mike Kruskal3bc50492022-12-01 13:34:12 -0800868
869
Deanna Garciabd6a0cf2023-04-20 10:30:44 -0700870// Public APIs for message operations that do not depend on the schema.
Eric Salo8809a112022-11-21 13:01:06 -0800871//
Deanna Garciabd6a0cf2023-04-20 10:30:44 -0700872// MiniTable-based accessors live in accessors.h.
Eric Salo8809a112022-11-21 13:01:06 -0800873
874#ifndef UPB_MESSAGE_MESSAGE_H_
875#define UPB_MESSAGE_MESSAGE_H_
876
Protobuf Team Bot75af7f92023-09-06 18:07:53 +0000877#include <stddef.h>
878
Eric Salo8809a112022-11-21 13:01:06 -0800879
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000880#ifndef UPB_MINI_TABLE_MESSAGE_H_
881#define UPB_MINI_TABLE_MESSAGE_H_
882
883
884#ifndef UPB_MINI_TABLE_ENUM_H_
885#define UPB_MINI_TABLE_ENUM_H_
886
887
888#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
889#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
890
891#include <stdint.h>
892
893// Must be last.
894
895struct upb_MiniTableEnum {
896 uint32_t mask_limit; // Limit enum value that can be tested with mask.
897 uint32_t value_count; // Number of values after the bitfield.
898 uint32_t data[]; // Bitmask + enumerated values follow.
899};
900
901typedef enum {
902 _kUpb_FastEnumCheck_ValueIsInEnum = 0,
903 _kUpb_FastEnumCheck_ValueIsNotInEnum = 1,
904 _kUpb_FastEnumCheck_CannotCheckFast = 2,
905} _kUpb_FastEnumCheck_Status;
906
907#ifdef __cplusplus
908extern "C" {
909#endif
910
911UPB_INLINE _kUpb_FastEnumCheck_Status _upb_MiniTable_CheckEnumValueFast(
912 const struct upb_MiniTableEnum* e, uint32_t val) {
913 if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast;
914 uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32);
915 return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum
916 : _kUpb_FastEnumCheck_ValueIsNotInEnum;
917}
918
919UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow(
920 const struct upb_MiniTableEnum* e, uint32_t val) {
921 if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32));
922 // OPT: binary search long lists?
923 const uint32_t* start = &e->data[e->mask_limit / 32];
924 const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count];
925 for (const uint32_t* p = start; p < limit; p++) {
926 if (*p == val) return true;
927 }
928 return false;
929}
930
931#ifdef __cplusplus
932} /* extern "C" */
933#endif
934
935
936#endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */
937
938// Must be last
939
940typedef struct upb_MiniTableEnum upb_MiniTableEnum;
941
Protobuf Team Bot450e0652023-09-21 17:36:36 +0000942#ifdef __cplusplus
943extern "C" {
944#endif
945
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000946// Validates enum value against range defined by enum mini table.
947UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e,
948 uint32_t val) {
949 _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val);
950 if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) {
951 return _upb_MiniTable_CheckEnumValueSlow(e, val);
952 }
953 return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false;
954}
955
Protobuf Team Bot450e0652023-09-21 17:36:36 +0000956#ifdef __cplusplus
957} /* extern "C" */
958#endif
959
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000960
961#endif /* UPB_MINI_TABLE_ENUM_H_ */
962
963#ifndef UPB_MINI_TABLE_FIELD_H_
964#define UPB_MINI_TABLE_FIELD_H_
965
966
967#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
968#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
969
970#include <stdint.h>
971
972
973// Must be last.
974
975struct upb_MiniTableField {
976 uint32_t number;
977 uint16_t offset;
978 int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index
979
980 // Indexes into `upb_MiniTable.subs`
981 // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM
982 uint16_t UPB_PRIVATE(submsg_index);
983
984 uint8_t UPB_PRIVATE(descriptortype);
985
986 // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift)
987 uint8_t mode;
988};
989
990#define kUpb_NoSub ((uint16_t)-1)
991
992typedef enum {
993 kUpb_FieldMode_Map = 0,
994 kUpb_FieldMode_Array = 1,
995 kUpb_FieldMode_Scalar = 2,
996} upb_FieldMode;
997
998// Mask to isolate the upb_FieldMode from field.mode.
999#define kUpb_FieldMode_Mask 3
1000
1001// Extra flags on the mode field.
1002typedef enum {
1003 kUpb_LabelFlags_IsPacked = 4,
1004 kUpb_LabelFlags_IsExtension = 8,
1005 // Indicates that this descriptor type is an "alternate type":
1006 // - for Int32, this indicates that the actual type is Enum (but was
1007 // rewritten to Int32 because it is an open enum that requires no check).
1008 // - for Bytes, this indicates that the actual type is String (but does
1009 // not require any UTF-8 check).
1010 kUpb_LabelFlags_IsAlternate = 16,
1011} upb_LabelFlags;
1012
1013// Note: we sort by this number when calculating layout order.
1014typedef enum {
1015 kUpb_FieldRep_1Byte = 0,
1016 kUpb_FieldRep_4Byte = 1,
1017 kUpb_FieldRep_StringView = 2,
1018 kUpb_FieldRep_8Byte = 3,
1019
1020 kUpb_FieldRep_NativePointer =
1021 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte),
1022 kUpb_FieldRep_Max = kUpb_FieldRep_8Byte,
1023} upb_FieldRep;
1024
1025#define kUpb_FieldRep_Shift 6
1026
1027UPB_INLINE upb_FieldRep
1028_upb_MiniTableField_GetRep(const struct upb_MiniTableField* field) {
1029 return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift);
1030}
1031
1032#ifdef __cplusplus
1033extern "C" {
1034#endif
1035
1036UPB_INLINE upb_FieldMode
1037upb_FieldMode_Get(const struct upb_MiniTableField* field) {
1038 return (upb_FieldMode)(field->mode & 3);
1039}
1040
1041UPB_INLINE void _upb_MiniTableField_CheckIsArray(
1042 const struct upb_MiniTableField* field) {
1043 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer);
1044 UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array);
1045 UPB_ASSUME(field->presence == 0);
1046}
1047
1048UPB_INLINE void _upb_MiniTableField_CheckIsMap(
1049 const struct upb_MiniTableField* field) {
1050 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer);
1051 UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map);
1052 UPB_ASSUME(field->presence == 0);
1053}
1054
1055UPB_INLINE bool upb_IsRepeatedOrMap(const struct upb_MiniTableField* field) {
1056 // This works because upb_FieldMode has no value 3.
1057 return !(field->mode & kUpb_FieldMode_Scalar);
1058}
1059
1060UPB_INLINE bool upb_IsSubMessage(const struct upb_MiniTableField* field) {
1061 return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message ||
1062 field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group;
1063}
1064
1065#ifdef __cplusplus
1066} /* extern "C" */
1067#endif
1068
1069
1070#endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */
1071
1072#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1073#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1074
1075
1076// Must be last.
1077
1078struct upb_Decoder;
1079typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr,
1080 upb_Message* msg, intptr_t table,
1081 uint64_t hasbits, uint64_t data);
1082typedef struct {
1083 uint64_t field_data;
1084 _upb_FieldParser* field_parser;
1085} _upb_FastTable_Entry;
1086
1087typedef enum {
1088 kUpb_ExtMode_NonExtendable = 0, // Non-extendable message.
1089 kUpb_ExtMode_Extendable = 1, // Normal extendable message.
1090 kUpb_ExtMode_IsMessageSet = 2, // MessageSet message.
1091 kUpb_ExtMode_IsMessageSet_ITEM =
1092 3, // MessageSet item (temporary only, see decode.c)
1093
1094 // During table building we steal a bit to indicate that the message is a map
1095 // entry. *Only* used during table building!
1096 kUpb_ExtMode_IsMapEntry = 4,
1097} upb_ExtMode;
1098
1099union upb_MiniTableSub;
1100
1101// upb_MiniTable represents the memory layout of a given upb_MessageDef.
1102// The members are public so generated code can initialize them,
1103// but users MUST NOT directly read or write any of its members.
1104struct upb_MiniTable {
1105 const union upb_MiniTableSub* subs;
1106 const struct upb_MiniTableField* fields;
1107
1108 // Must be aligned to sizeof(void*). Doesn't include internal members like
1109 // unknown fields, extension dict, pointer to msglayout, etc.
1110 uint16_t size;
1111
1112 uint16_t field_count;
1113 uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1
1114 uint8_t dense_below;
1115 uint8_t table_mask;
1116 uint8_t required_count; // Required fields have the lowest hasbits.
1117
1118 // To statically initialize the tables of variable length, we need a flexible
1119 // array member, and we need to compile in gnu99 mode (constant initialization
1120 // of flexible array members is a GNU extension, not in C99 unfortunately.
1121 _upb_FastTable_Entry fasttable[];
1122};
1123
1124#ifdef __cplusplus
1125extern "C" {
1126#endif
1127
1128// A MiniTable for an empty message, used for unlinked sub-messages.
1129extern const struct upb_MiniTable _kUpb_MiniTable_Empty;
1130
1131// Computes a bitmask in which the |l->required_count| lowest bits are set,
1132// except that we skip the lowest bit (because upb never uses hasbit 0).
1133//
1134// Sample output:
1135// requiredmask(1) => 0b10 (0x2)
1136// requiredmask(5) => 0b111110 (0x3e)
1137UPB_INLINE uint64_t upb_MiniTable_requiredmask(const struct upb_MiniTable* l) {
1138 int n = l->required_count;
1139 assert(0 < n && n <= 63);
1140 return ((1ULL << n) - 1) << 1;
1141}
1142
1143#ifdef __cplusplus
1144} /* extern "C" */
1145#endif
1146
1147
1148#endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */
Protobuf Team Bot473d20d2023-09-15 22:27:16 +00001149#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_
1150#define UPB_MINI_TABLE_INTERNAL_SUB_H_
1151
1152
1153union upb_MiniTableSub {
1154 const struct upb_MiniTable* submsg;
1155 const struct upb_MiniTableEnum* subenum;
1156};
1157
1158#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
1159
1160// Must be last.
1161
1162#ifdef __cplusplus
1163extern "C" {
1164#endif
1165
1166typedef struct upb_MiniTableField upb_MiniTableField;
1167
1168UPB_API_INLINE upb_FieldType
1169upb_MiniTableField_Type(const upb_MiniTableField* field) {
1170 if (field->mode & kUpb_LabelFlags_IsAlternate) {
1171 if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) {
1172 return kUpb_FieldType_Enum;
1173 } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) {
1174 return kUpb_FieldType_String;
1175 } else {
1176 UPB_ASSERT(false);
1177 }
1178 }
1179 return (upb_FieldType)field->UPB_PRIVATE(descriptortype);
1180}
1181
1182UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) {
1183 switch (upb_MiniTableField_Type(f)) {
1184 case kUpb_FieldType_Double:
1185 return kUpb_CType_Double;
1186 case kUpb_FieldType_Float:
1187 return kUpb_CType_Float;
1188 case kUpb_FieldType_Int64:
1189 case kUpb_FieldType_SInt64:
1190 case kUpb_FieldType_SFixed64:
1191 return kUpb_CType_Int64;
1192 case kUpb_FieldType_Int32:
1193 case kUpb_FieldType_SFixed32:
1194 case kUpb_FieldType_SInt32:
1195 return kUpb_CType_Int32;
1196 case kUpb_FieldType_UInt64:
1197 case kUpb_FieldType_Fixed64:
1198 return kUpb_CType_UInt64;
1199 case kUpb_FieldType_UInt32:
1200 case kUpb_FieldType_Fixed32:
1201 return kUpb_CType_UInt32;
1202 case kUpb_FieldType_Enum:
1203 return kUpb_CType_Enum;
1204 case kUpb_FieldType_Bool:
1205 return kUpb_CType_Bool;
1206 case kUpb_FieldType_String:
1207 return kUpb_CType_String;
1208 case kUpb_FieldType_Bytes:
1209 return kUpb_CType_Bytes;
1210 case kUpb_FieldType_Group:
1211 case kUpb_FieldType_Message:
1212 return kUpb_CType_Message;
1213 }
1214 UPB_UNREACHABLE();
1215}
1216
1217UPB_API_INLINE bool upb_MiniTableField_IsExtension(
1218 const upb_MiniTableField* field) {
1219 return field->mode & kUpb_LabelFlags_IsExtension;
1220}
1221
1222UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
1223 const upb_MiniTableField* field) {
1224 return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum;
1225}
1226
1227UPB_API_INLINE bool upb_MiniTableField_HasPresence(
1228 const upb_MiniTableField* field) {
1229 if (upb_MiniTableField_IsExtension(field)) {
1230 return !upb_IsRepeatedOrMap(field);
1231 } else {
1232 return field->presence != 0;
1233 }
1234}
1235
1236#ifdef __cplusplus
1237} /* extern "C" */
1238#endif
1239
1240
1241#endif /* UPB_MINI_TABLE_FIELD_H_ */
1242
1243// Must be last.
1244
1245#ifdef __cplusplus
1246extern "C" {
1247#endif
1248
1249typedef struct upb_MiniTable upb_MiniTable;
1250
1251UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
1252 const upb_MiniTable* table, uint32_t number);
1253
1254UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
1255 const upb_MiniTable* t, uint32_t index) {
1256 return &t->fields[index];
1257}
1258
1259// Returns the MiniTable for this message field. If the field is unlinked,
1260// returns NULL.
1261UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
1262 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1263 UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message);
1264 const upb_MiniTable* ret =
1265 mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
1266 UPB_ASSUME(ret);
1267 return ret == &_kUpb_MiniTable_Empty ? NULL : ret;
1268}
1269
1270// Returns the MiniTableEnum for this enum field. If the field is unlinked,
1271// returns NULL.
1272UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
1273 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1274 UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum);
1275 return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum;
1276}
1277
1278// Returns true if this MiniTable field is linked to a MiniTable for the
1279// sub-message.
1280UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
1281 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1282 return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL;
1283}
1284
1285// If this field is in a oneof, returns the first field in the oneof.
1286//
1287// Otherwise returns NULL.
1288//
1289// Usage:
1290// const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f);
1291// do {
1292// ..
1293// } while (upb_MiniTable_NextOneofField(m, &field);
1294//
1295const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m,
1296 const upb_MiniTableField* f);
1297
1298// Iterates to the next field in the oneof. If this is the last field in the
1299// oneof, returns false. The ordering of fields in the oneof is not
1300// guaranteed.
1301// REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated
1302// by prior upb_MiniTable_NextOneofField calls.
1303bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
1304 const upb_MiniTableField** f);
1305
1306#ifdef __cplusplus
1307} /* extern "C" */
1308#endif
1309
1310
1311#endif /* UPB_MINI_TABLE_MESSAGE_H_ */
1312
Eric Salo8809a112022-11-21 13:01:06 -08001313// Must be last.
1314
1315#ifdef __cplusplus
1316extern "C" {
1317#endif
1318
1319// Creates a new message with the given mini_table on the given arena.
Eric Salo10505992022-12-12 12:16:36 -08001320UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table,
1321 upb_Arena* arena);
Eric Salo8809a112022-11-21 13:01:06 -08001322
1323// Adds unknown data (serialized protobuf data) to the given message.
1324// The data is copied into the message instance.
1325void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
1326 upb_Arena* arena);
1327
1328// Returns a reference to the message's unknown data.
1329const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len);
1330
1331// Removes partial unknown data from message.
1332void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len);
1333
1334// Returns the number of extensions present in this message.
1335size_t upb_Message_ExtensionCount(const upb_Message* msg);
1336
1337#ifdef __cplusplus
1338} /* extern "C" */
1339#endif
1340
1341
1342#endif /* UPB_MESSAGE_MESSAGE_H_ */
1343
Mike Kruskal9d435022023-07-11 12:45:07 -07001344#ifndef UPB_MINI_TABLE_EXTENSION_H_
1345#define UPB_MINI_TABLE_EXTENSION_H_
Eric Salo8809a112022-11-21 13:01:06 -08001346
1347
Mike Kruskal9d435022023-07-11 12:45:07 -07001348#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
1349#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
Eric Salo8809a112022-11-21 13:01:06 -08001350
1351
1352// Must be last.
1353
Eric Salo8809a112022-11-21 13:01:06 -08001354struct upb_MiniTableExtension {
Deanna Garcia59cfc2f2023-01-31 13:19:28 -08001355 // Do not move this field. We need to be able to alias pointers.
Mike Kruskal9d435022023-07-11 12:45:07 -07001356 struct upb_MiniTableField field;
Deanna Garcia59cfc2f2023-01-31 13:19:28 -08001357
Mike Kruskal9d435022023-07-11 12:45:07 -07001358 const struct upb_MiniTable* extendee;
1359 union upb_MiniTableSub sub; // NULL unless submessage or proto2 enum
Eric Salo8809a112022-11-21 13:01:06 -08001360};
1361
1362
Mike Kruskal9d435022023-07-11 12:45:07 -07001363#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */
1364
Mike Kruskal9d435022023-07-11 12:45:07 -07001365typedef struct upb_MiniTableExtension upb_MiniTableExtension;
1366
Mike Kruskal9d435022023-07-11 12:45:07 -07001367#endif /* UPB_MINI_TABLE_EXTENSION_H_ */
Eric Salo8809a112022-11-21 13:01:06 -08001368
1369// Must be last.
1370
1371// The internal representation of an extension is self-describing: it contains
1372// enough information that we can serialize it to binary format without needing
1373// to look it up in a upb_ExtensionRegistry.
1374//
1375// This representation allocates 16 bytes to data on 64-bit platforms.
1376// This is rather wasteful for scalars (in the extreme case of bool,
1377// it wastes 15 bytes). We accept this because we expect messages to be
1378// the most common extension type.
1379typedef struct {
1380 const upb_MiniTableExtension* ext;
1381 union {
1382 upb_StringView str;
1383 void* ptr;
1384 char scalar_data[8];
1385 } data;
1386} upb_Message_Extension;
1387
1388#ifdef __cplusplus
1389extern "C" {
1390#endif
1391
1392// Adds the given extension data to the given message.
1393// |ext| is copied into the message instance.
1394// This logically replaces any previously-added extension with this number.
1395upb_Message_Extension* _upb_Message_GetOrCreateExtension(
1396 upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena);
1397
1398// Returns an array of extensions for this message.
1399// Note: the array is ordered in reverse relative to the order of creation.
1400const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg,
1401 size_t* count);
1402
1403// Returns an extension for the given field number, or NULL if no extension
1404// exists for this field number.
1405const upb_Message_Extension* _upb_Message_Getext(
1406 const upb_Message* msg, const upb_MiniTableExtension* ext);
1407
Eric Salo8809a112022-11-21 13:01:06 -08001408#ifdef __cplusplus
1409} /* extern "C" */
1410#endif
1411
1412
Adam Cozzette8059da22023-08-16 07:57:14 -07001413#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */
Eric Salo8809a112022-11-21 13:01:06 -08001414
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001415// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
1416
1417#ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_
1418#define UPB_COLLECTIONS_INTERNAL_MAP_H_
1419
1420
1421#ifndef UPB_HASH_STR_TABLE_H_
1422#define UPB_HASH_STR_TABLE_H_
1423
1424
1425/*
1426 * upb_table
1427 *
1428 * This header is INTERNAL-ONLY! Its interfaces are not public or stable!
1429 * This file defines very fast int->upb_value (inttable) and string->upb_value
1430 * (strtable) hash tables.
1431 *
1432 * The table uses chained scatter with Brent's variation (inspired by the Lua
1433 * implementation of hash tables). The hash function for strings is Austin
1434 * Appleby's "MurmurHash."
1435 *
1436 * The inttable uses uintptr_t as its key, which guarantees it can be used to
1437 * store pointers or integers of at least 32 bits (upb isn't really useful on
1438 * systems where sizeof(void*) < 4).
1439 *
1440 * The table must be homogeneous (all values of the same type). In debug
1441 * mode, we check this on insert and lookup.
1442 */
1443
1444#ifndef UPB_HASH_COMMON_H_
1445#define UPB_HASH_COMMON_H_
1446
1447#include <string.h>
1448
1449
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001450// Must be last.
1451
1452#ifdef __cplusplus
1453extern "C" {
1454#endif
1455
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001456/* upb_value ******************************************************************/
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001457
1458typedef struct {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001459 uint64_t val;
1460} upb_value;
1461
1462UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; }
1463
1464/* For each value ctype, define the following set of functions:
1465 *
1466 * // Get/set an int32 from a upb_value.
1467 * int32_t upb_value_getint32(upb_value val);
1468 * void upb_value_setint32(upb_value *val, int32_t cval);
1469 *
1470 * // Construct a new upb_value from an int32.
1471 * upb_value upb_value_int32(int32_t val); */
1472#define FUNCS(name, membername, type_t, converter) \
1473 UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \
1474 val->val = (converter)cval; \
1475 } \
1476 UPB_INLINE upb_value upb_value_##name(type_t val) { \
1477 upb_value ret; \
1478 upb_value_set##name(&ret, val); \
1479 return ret; \
1480 } \
1481 UPB_INLINE type_t upb_value_get##name(upb_value val) { \
1482 return (type_t)(converter)val.val; \
1483 }
1484
1485FUNCS(int32, int32, int32_t, int32_t)
1486FUNCS(int64, int64, int64_t, int64_t)
1487FUNCS(uint32, uint32, uint32_t, uint32_t)
1488FUNCS(uint64, uint64, uint64_t, uint64_t)
1489FUNCS(bool, _bool, bool, bool)
1490FUNCS(cstr, cstr, char*, uintptr_t)
1491FUNCS(uintptr, uptr, uintptr_t, uintptr_t)
1492FUNCS(ptr, ptr, void*, uintptr_t)
1493FUNCS(constptr, constptr, const void*, uintptr_t)
1494
1495#undef FUNCS
1496
1497UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) {
1498 memcpy(&val->val, &cval, sizeof(cval));
1499}
1500
1501UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) {
1502 memcpy(&val->val, &cval, sizeof(cval));
1503}
1504
1505UPB_INLINE upb_value upb_value_float(float cval) {
1506 upb_value ret;
1507 upb_value_setfloat(&ret, cval);
1508 return ret;
1509}
1510
1511UPB_INLINE upb_value upb_value_double(double cval) {
1512 upb_value ret;
1513 upb_value_setdouble(&ret, cval);
1514 return ret;
1515}
1516
1517/* upb_tabkey *****************************************************************/
1518
1519/* Either:
1520 * 1. an actual integer key, or
1521 * 2. a pointer to a string prefixed by its uint32_t length, owned by us.
1522 *
1523 * ...depending on whether this is a string table or an int table. We would
1524 * make this a union of those two types, but C89 doesn't support statically
1525 * initializing a non-first union member. */
1526typedef uintptr_t upb_tabkey;
1527
1528UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) {
1529 char* mem = (char*)key;
1530 if (len) memcpy(len, mem, sizeof(*len));
1531 return mem + sizeof(*len);
1532}
1533
1534UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) {
1535 upb_StringView ret;
1536 uint32_t len;
1537 ret.data = upb_tabstr(key, &len);
1538 ret.size = len;
1539 return ret;
1540}
1541
1542/* upb_tabval *****************************************************************/
1543
1544typedef struct upb_tabval {
1545 uint64_t val;
1546} upb_tabval;
1547
1548#define UPB_TABVALUE_EMPTY_INIT \
1549 { -1 }
1550
1551/* upb_table ******************************************************************/
1552
1553typedef struct _upb_tabent {
1554 upb_tabkey key;
1555 upb_tabval val;
1556
1557 /* Internal chaining. This is const so we can create static initializers for
1558 * tables. We cast away const sometimes, but *only* when the containing
1559 * upb_table is known to be non-const. This requires a bit of care, but
1560 * the subtlety is confined to table.c. */
1561 const struct _upb_tabent* next;
1562} upb_tabent;
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001563
1564typedef struct {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001565 size_t count; /* Number of entries in the hash part. */
1566 uint32_t mask; /* Mask to turn hash value -> bucket. */
1567 uint32_t max_count; /* Max count before we hit our load limit. */
1568 uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
1569 upb_tabent* entries;
1570} upb_table;
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001571
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001572UPB_INLINE size_t upb_table_size(const upb_table* t) {
1573 return t->size_lg2 ? 1 << t->size_lg2 : 0;
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001574}
1575
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001576// Internal-only functions, in .h file only out of necessity.
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001577
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001578UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; }
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001579
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001580uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001581
1582#ifdef __cplusplus
1583} /* extern "C" */
1584#endif
1585
1586
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001587#endif /* UPB_HASH_COMMON_H_ */
Adam Cozzette8059da22023-08-16 07:57:14 -07001588
1589// Must be last.
1590
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001591typedef struct {
1592 upb_table t;
1593} upb_strtable;
1594
Adam Cozzette8059da22023-08-16 07:57:14 -07001595#ifdef __cplusplus
1596extern "C" {
1597#endif
1598
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001599// Initialize a table. If memory allocation failed, false is returned and
1600// the table is uninitialized.
1601bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a);
1602
1603// Returns the number of values in the table.
1604UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) {
1605 return t->t.count;
Adam Cozzette8059da22023-08-16 07:57:14 -07001606}
1607
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001608void upb_strtable_clear(upb_strtable* t);
1609
1610// Inserts the given key into the hashtable with the given value.
1611// The key must not already exist in the hash table. The key is not required
1612// to be NULL-terminated, and the table will make an internal copy of the key.
1613//
1614// If a table resize was required but memory allocation failed, false is
1615// returned and the table is unchanged. */
1616bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len,
1617 upb_value val, upb_Arena* a);
1618
1619// Looks up key in this table, returning "true" if the key was found.
1620// If v is non-NULL, copies the value for this key into *v.
1621bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len,
1622 upb_value* v);
1623
1624// For NULL-terminated strings.
1625UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key,
1626 upb_value* v) {
1627 return upb_strtable_lookup2(t, key, strlen(key), v);
1628}
1629
1630// Removes an item from the table. Returns true if the remove was successful,
1631// and stores the removed item in *val if non-NULL.
1632bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len,
1633 upb_value* val);
1634
1635UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key,
1636 upb_value* v) {
1637 return upb_strtable_remove2(t, key, strlen(key), v);
1638}
1639
1640// Exposed for testing only.
1641bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a);
1642
1643/* Iteration over strtable:
1644 *
1645 * intptr_t iter = UPB_STRTABLE_BEGIN;
1646 * upb_StringView key;
1647 * upb_value val;
1648 * while (upb_strtable_next2(t, &key, &val, &iter)) {
1649 * // ...
1650 * }
1651 */
1652
1653#define UPB_STRTABLE_BEGIN -1
1654
1655bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key,
1656 upb_value* val, intptr_t* iter);
1657void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter);
1658void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v);
1659
1660/* DEPRECATED iterators, slated for removal.
1661 *
1662 * Iterators for string tables. We are subject to some kind of unusual
1663 * design constraints:
1664 *
1665 * For high-level languages:
1666 * - we must be able to guarantee that we don't crash or corrupt memory even if
1667 * the program accesses an invalidated iterator.
1668 *
1669 * For C++11 range-based for:
1670 * - iterators must be copyable
1671 * - iterators must be comparable
1672 * - it must be possible to construct an "end" value.
1673 *
1674 * Iteration order is undefined.
1675 *
1676 * Modifying the table invalidates iterators. upb_{str,int}table_done() is
1677 * guaranteed to work even on an invalidated iterator, as long as the table it
1678 * is iterating over has not been freed. Calling next() or accessing data from
1679 * an invalidated iterator yields unspecified elements from the table, but it is
1680 * guaranteed not to crash and to return real table elements (except when done()
1681 * is true). */
1682/* upb_strtable_iter **********************************************************/
1683
1684/* upb_strtable_iter i;
1685 * upb_strtable_begin(&i, t);
1686 * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
1687 * const char *key = upb_strtable_iter_key(&i);
1688 * const upb_value val = upb_strtable_iter_value(&i);
1689 * // ...
1690 * }
1691 */
1692
1693typedef struct {
1694 const upb_strtable* t;
1695 size_t index;
1696} upb_strtable_iter;
1697
1698UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) {
1699 return &i->t->t.entries[i->index];
1700}
1701
1702void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t);
1703void upb_strtable_next(upb_strtable_iter* i);
1704bool upb_strtable_done(const upb_strtable_iter* i);
1705upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i);
1706upb_value upb_strtable_iter_value(const upb_strtable_iter* i);
1707void upb_strtable_iter_setdone(upb_strtable_iter* i);
1708bool upb_strtable_iter_isequal(const upb_strtable_iter* i1,
1709 const upb_strtable_iter* i2);
Adam Cozzette8059da22023-08-16 07:57:14 -07001710
1711#ifdef __cplusplus
1712} /* extern "C" */
1713#endif
1714
1715
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001716#endif /* UPB_HASH_STR_TABLE_H_ */
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001717
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001718#ifndef UPB_MESSAGE_MAP_H_
1719#define UPB_MESSAGE_MAP_H_
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001720
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001721#include <stddef.h>
Mike Kruskal9d435022023-07-11 12:45:07 -07001722
1723
1724// Must be last.
1725
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001726typedef struct upb_Map upb_Map;
1727
Mike Kruskal9d435022023-07-11 12:45:07 -07001728#ifdef __cplusplus
1729extern "C" {
1730#endif
1731
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001732// Creates a new map on the given arena with the given key/value size.
1733UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type,
1734 upb_CType value_type);
Mike Kruskal9d435022023-07-11 12:45:07 -07001735
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001736// Returns the number of entries in the map.
1737UPB_API size_t upb_Map_Size(const upb_Map* map);
1738
1739// Stores a value for the given key into |*val| (or the zero value if the key is
1740// not present). Returns whether the key was present. The |val| pointer may be
1741// NULL, in which case the function tests whether the given key is present.
1742UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key,
1743 upb_MessageValue* val);
1744
1745// Removes all entries in the map.
1746UPB_API void upb_Map_Clear(upb_Map* map);
1747
1748typedef enum {
1749 kUpb_MapInsertStatus_Inserted = 0,
1750 kUpb_MapInsertStatus_Replaced = 1,
1751 kUpb_MapInsertStatus_OutOfMemory = 2,
1752} upb_MapInsertStatus;
1753
1754// Sets the given key to the given value, returning whether the key was inserted
1755// or replaced. If the key was inserted, then any existing iterators will be
1756// invalidated.
1757UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key,
1758 upb_MessageValue val,
1759 upb_Arena* arena);
1760
1761// Sets the given key to the given value. Returns false if memory allocation
1762// failed. If the key is newly inserted, then any existing iterators will be
1763// invalidated.
1764UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key,
1765 upb_MessageValue val, upb_Arena* arena) {
1766 return upb_Map_Insert(map, key, val, arena) !=
1767 kUpb_MapInsertStatus_OutOfMemory;
Mike Kruskal9d435022023-07-11 12:45:07 -07001768}
1769
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001770// Deletes this key from the table. Returns true if the key was present.
1771// If present and |val| is non-NULL, stores the deleted value.
1772UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
1773 upb_MessageValue* val);
1774
1775// (DEPRECATED and going away soon. Do not use.)
1776UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key,
1777 upb_MessageValue* val) {
1778 return upb_Map_Delete(map, key, val);
Mike Kruskal9d435022023-07-11 12:45:07 -07001779}
1780
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001781// Map iteration:
1782//
1783// size_t iter = kUpb_Map_Begin;
1784// upb_MessageValue key, val;
1785// while (upb_Map_Next(map, &key, &val, &iter)) {
1786// ...
1787// }
1788
1789#define kUpb_Map_Begin ((size_t)-1)
1790
1791// Advances to the next entry. Returns false if no more entries are present.
1792// Otherwise returns true and populates both *key and *value.
1793UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key,
1794 upb_MessageValue* val, size_t* iter);
1795
1796// Sets the value for the entry pointed to by iter.
1797// WARNING: this does not currently work for string values!
1798UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter,
1799 upb_MessageValue val);
1800
1801// DEPRECATED iterator, slated for removal.
1802
1803/* Map iteration:
1804 *
1805 * size_t iter = kUpb_Map_Begin;
1806 * while (upb_MapIterator_Next(map, &iter)) {
1807 * upb_MessageValue key = upb_MapIterator_Key(map, iter);
1808 * upb_MessageValue val = upb_MapIterator_Value(map, iter);
1809 * }
1810 */
1811
1812// Advances to the next entry. Returns false if no more entries are present.
1813UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter);
1814
1815// Returns true if the iterator still points to a valid entry, or false if the
1816// iterator is past the last element. It is an error to call this function with
1817// kUpb_Map_Begin (you must call next() at least once first).
1818UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter);
1819
1820// Returns the key and value for this entry of the map.
1821UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter);
1822UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);
1823
1824#ifdef __cplusplus
1825} /* extern "C" */
1826#endif
1827
1828
1829#endif /* UPB_MESSAGE_MAP_H_ */
1830
1831// Must be last.
1832
1833struct upb_Map {
1834 // Size of key and val, based on the map type.
1835 // Strings are represented as '0' because they must be handled specially.
1836 char key_size;
1837 char val_size;
1838
1839 upb_strtable table;
1840};
1841
1842#ifdef __cplusplus
1843extern "C" {
1844#endif
1845
1846// Converting between internal table representation and user values.
1847//
1848// _upb_map_tokey() and _upb_map_fromkey() are inverses.
1849// _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
1850//
1851// These functions account for the fact that strings are treated differently
1852// from other types when stored in a map.
1853
1854UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) {
Mike Kruskal9d435022023-07-11 12:45:07 -07001855 if (size == UPB_MAPTYPE_STRING) {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001856 return *(upb_StringView*)key;
Mike Kruskal9d435022023-07-11 12:45:07 -07001857 } else {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001858 return upb_StringView_FromDataAndSize((const char*)key, size);
Mike Kruskal9d435022023-07-11 12:45:07 -07001859 }
1860}
1861
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001862UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) {
1863 if (size == UPB_MAPTYPE_STRING) {
1864 memcpy(out, &key, sizeof(key));
1865 } else {
1866 memcpy(out, key.data, size);
1867 }
1868}
1869
1870UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size,
1871 upb_value* msgval, upb_Arena* a) {
1872 if (size == UPB_MAPTYPE_STRING) {
1873 upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp));
1874 if (!strp) return false;
1875 *strp = *(upb_StringView*)val;
1876 *msgval = upb_value_ptr(strp);
1877 } else {
1878 memcpy(msgval, val, size);
1879 }
1880 return true;
1881}
1882
1883UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
1884 if (size == UPB_MAPTYPE_STRING) {
1885 const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val);
1886 memcpy(out, strp, sizeof(upb_StringView));
1887 } else {
1888 memcpy(out, &val, size);
1889 }
1890}
1891
1892UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) {
1893 upb_strtable_iter it;
1894 it.t = &map->table;
1895 it.index = *iter;
1896 upb_strtable_next(&it);
1897 *iter = it.index;
1898 if (upb_strtable_done(&it)) return NULL;
1899 return (void*)str_tabent(&it);
1900}
1901
1902UPB_INLINE void _upb_Map_Clear(upb_Map* map) {
1903 upb_strtable_clear(&map->table);
1904}
1905
1906UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size,
1907 upb_value* val) {
1908 upb_StringView k = _upb_map_tokey(key, key_size);
1909 return upb_strtable_remove2(&map->table, k.data, k.size, val);
1910}
1911
1912UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key,
1913 size_t key_size, void* val, size_t val_size) {
1914 upb_value tabval;
1915 upb_StringView k = _upb_map_tokey(key, key_size);
1916 bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
1917 if (ret && val) {
1918 _upb_map_fromvalue(tabval, val, val_size);
1919 }
1920 return ret;
1921}
1922
1923UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key,
1924 size_t key_size, void* val,
1925 size_t val_size, upb_Arena* a) {
1926 upb_StringView strkey = _upb_map_tokey(key, key_size);
1927 upb_value tabval = {0};
1928 if (!_upb_map_tovalue(val, val_size, &tabval, a)) {
1929 return kUpb_MapInsertStatus_OutOfMemory;
1930 }
1931
1932 // TODO: add overwrite operation to minimize number of lookups.
1933 bool removed =
1934 upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL);
1935 if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) {
1936 return kUpb_MapInsertStatus_OutOfMemory;
1937 }
1938 return removed ? kUpb_MapInsertStatus_Replaced
1939 : kUpb_MapInsertStatus_Inserted;
1940}
1941
1942UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) {
1943 return map->table.t.count;
1944}
1945
1946// Strings/bytes are special-cased in maps.
1947extern char _upb_Map_CTypeSizeTable[12];
1948
1949UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) {
1950 return _upb_Map_CTypeSizeTable[ctype];
1951}
1952
1953// Creates a new map on the given arena with this key/value type.
1954upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
1955
Mike Kruskal9d435022023-07-11 12:45:07 -07001956#ifdef __cplusplus
1957} /* extern "C" */
1958#endif
1959
1960
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001961#endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */
Adam Cozzette8059da22023-08-16 07:57:14 -07001962
Sandy Zhange3b09432023-08-07 09:30:02 -07001963/*
1964** Our memory representation for parsing tables and messages themselves.
1965** Functions in this file are used by generated code and possibly reflection.
1966**
1967** The definitions in this file are internal to upb.
1968**/
1969
1970#ifndef UPB_MESSAGE_INTERNAL_H_
1971#define UPB_MESSAGE_INTERNAL_H_
1972
1973#include <stdlib.h>
1974#include <string.h>
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001975
1976
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001977#ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_
1978#define UPB_MINI_TABLE_INTERNAL_TYPES_H_
1979
1980typedef struct upb_Message_InternalData upb_Message_InternalData;
1981
1982typedef struct {
1983 union {
1984 upb_Message_InternalData* internal;
1985
1986 // Force 8-byte alignment, since the data members may contain members that
1987 // require 8-byte alignment.
1988 double d;
1989 };
1990} upb_Message_Internal;
1991
1992#endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_
1993
Mike Kruskal3bc50492022-12-01 13:34:12 -08001994#ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
1995#define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
1996
1997
1998// Must be last.
1999
2000#ifdef __cplusplus
2001extern "C" {
2002#endif
2003
2004/* Extension registry: a dynamic data structure that stores a map of:
2005 * (upb_MiniTable, number) -> extension info
2006 *
2007 * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing
2008 * binary format.
2009 *
2010 * upb_ExtensionRegistry is part of the mini-table (msglayout) family of
2011 * objects. Like all mini-table objects, it is suitable for reflection-less
2012 * builds that do not want to expose names into the binary.
2013 *
2014 * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory
2015 * allocation and dynamic initialization:
2016 * * If reflection is being used, then upb_DefPool will construct an appropriate
2017 * upb_ExtensionRegistry automatically.
2018 * * For a mini-table only build, the user must manually construct the
2019 * upb_ExtensionRegistry and populate it with all of the extensions the user
2020 * cares about.
2021 * * A third alternative is to manually unpack relevant extensions after the
2022 * main parse is complete, similar to how Any works. This is perhaps the
2023 * nicest solution from the perspective of reducing dependencies, avoiding
2024 * dynamic memory allocation, and avoiding the need to parse uninteresting
2025 * extensions. The downsides are:
2026 * (1) parse errors are not caught during the main parse
2027 * (2) the CPU hit of parsing comes during access, which could cause an
2028 * undesirable stutter in application performance.
2029 *
2030 * Users cannot directly get or put into this map. Users can only add the
2031 * extensions from a generated module and pass the extension registry to the
2032 * binary decoder.
2033 *
2034 * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use
2035 * reflection do not need to populate a upb_ExtensionRegistry directly.
2036 */
2037
2038typedef struct upb_ExtensionRegistry upb_ExtensionRegistry;
2039
2040// Creates a upb_ExtensionRegistry in the given arena.
2041// The arena must outlive any use of the extreg.
Eric Salo10505992022-12-12 12:16:36 -08002042UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002043
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002044UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r,
2045 const upb_MiniTableExtension* e);
2046
Mike Kruskal3bc50492022-12-01 13:34:12 -08002047// Adds the given extension info for the array |e| of size |count| into the
2048// registry. If there are any errors, the entire array is backed out.
2049// The extensions must outlive the registry.
2050// Possible errors include OOM or an extension number that already exists.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00002051// TODO: There is currently no way to know the exact reason for failure.
Mike Kruskal3bc50492022-12-01 13:34:12 -08002052bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r,
2053 const upb_MiniTableExtension** e,
2054 size_t count);
2055
2056// Looks up the extension (if any) defined for message type |t| and field
2057// number |num|. Returns the extension if found, otherwise NULL.
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002058UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
Mike Kruskal3bc50492022-12-01 13:34:12 -08002059 const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num);
2060
2061#ifdef __cplusplus
2062} /* extern "C" */
2063#endif
2064
2065
2066#endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */
2067
Eric Salo8809a112022-11-21 13:01:06 -08002068// Must be last.
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002069
Eric Salo8809a112022-11-21 13:01:06 -08002070#ifdef __cplusplus
2071extern "C" {
2072#endif
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002073
Eric Salo8809a112022-11-21 13:01:06 -08002074extern const float kUpb_FltInfinity;
2075extern const double kUpb_Infinity;
2076extern const double kUpb_NaN;
2077
2078/* Internal members of a upb_Message that track unknown fields and/or
2079 * extensions. We can change this without breaking binary compatibility. We put
2080 * these before the user's data. The user's upb_Message* points after the
2081 * upb_Message_Internal. */
2082
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00002083struct upb_Message_InternalData {
Eric Salo8809a112022-11-21 13:01:06 -08002084 /* Total size of this structure, including the data that follows.
2085 * Must be aligned to 8, which is alignof(upb_Message_Extension) */
2086 uint32_t size;
2087
2088 /* Offsets relative to the beginning of this structure.
2089 *
2090 * Unknown data grows forward from the beginning to unknown_end.
2091 * Extension data grows backward from size to ext_begin.
2092 * When the two meet, we're out of data and have to realloc.
2093 *
2094 * If we imagine that the final member of this struct is:
2095 * char data[size - overhead]; // overhead =
2096 * sizeof(upb_Message_InternalData)
2097 *
2098 * Then we have:
2099 * unknown data: data[0 .. (unknown_end - overhead)]
2100 * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
2101 uint32_t unknown_end;
2102 uint32_t ext_begin;
2103 /* Data follows, as if there were an array:
2104 * char data[size - sizeof(upb_Message_InternalData)]; */
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00002105};
Eric Salo8809a112022-11-21 13:01:06 -08002106
2107/* Maps upb_CType -> memory size. */
2108extern char _upb_CTypeo_size[12];
2109
2110UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) {
2111 return t->size + sizeof(upb_Message_Internal);
2112}
2113
2114// Inline version upb_Message_New(), for internal use.
2115UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table,
2116 upb_Arena* arena) {
2117 size_t size = upb_msg_sizeof(mini_table);
2118 void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal));
2119 if (UPB_UNLIKELY(!mem)) return NULL;
2120 upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message);
2121 memset(mem, 0, size);
2122 return msg;
2123}
2124
2125UPB_INLINE upb_Message_Internal* upb_Message_Getinternal(
2126 const upb_Message* msg) {
2127 ptrdiff_t size = sizeof(upb_Message_Internal);
2128 return (upb_Message_Internal*)((char*)msg - size);
2129}
2130
Eric Salo8809a112022-11-21 13:01:06 -08002131// Discards the unknown fields for this message only.
2132void _upb_Message_DiscardUnknown_shallow(upb_Message* msg);
2133
2134// Adds unknown data (serialized protobuf data) to the given message.
2135// The data is copied into the message instance.
2136bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
2137 upb_Arena* arena);
2138
Eric Salo8809a112022-11-21 13:01:06 -08002139#ifdef __cplusplus
2140} /* extern "C" */
2141#endif
2142
2143
2144#endif /* UPB_MESSAGE_INTERNAL_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002145
Eric Salo8809a112022-11-21 13:01:06 -08002146// Must be last.
2147
Eric Salob7d54ac2022-12-29 11:59:42 -08002148#if defined(__GNUC__) && !defined(__clang__)
2149// GCC raises incorrect warnings in these functions. It thinks that we are
2150// overrunning buffers, but we carefully write the functions in this file to
2151// guarantee that this is impossible. GCC gets this wrong due it its failure
2152// to perform constant propagation as we expect:
2153// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217
2154// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226
2155//
2156// Unfortunately this also indicates that GCC is not optimizing away the
2157// switch() in cases where it should be, compromising the performance.
2158#pragma GCC diagnostic push
2159#pragma GCC diagnostic ignored "-Warray-bounds"
2160#pragma GCC diagnostic ignored "-Wstringop-overflow"
Mike Kruskal232ecf42023-01-14 00:09:40 -08002161#if __GNUC__ >= 11
Eric Salob7d54ac2022-12-29 11:59:42 -08002162#pragma GCC diagnostic ignored "-Wstringop-overread"
2163#endif
Mike Kruskal232ecf42023-01-14 00:09:40 -08002164#endif
Eric Salob7d54ac2022-12-29 11:59:42 -08002165
Eric Salo8809a112022-11-21 13:01:06 -08002166#ifdef __cplusplus
2167extern "C" {
2168#endif
2169
Mike Kruskal9d435022023-07-11 12:45:07 -07002170// LINT.IfChange(presence_logic)
2171
2172// Hasbit access ///////////////////////////////////////////////////////////////
2173
2174UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; }
2175
2176UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); }
2177
2178UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) {
2179 return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) &
2180 _upb_hasbit_mask(idx)) != 0;
2181}
2182
2183UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) {
2184 (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx);
2185}
2186
2187UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) {
2188 (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx);
2189}
2190
2191UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) {
2192 UPB_ASSERT(f->presence > 0);
2193 return f->presence;
2194}
2195
2196UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg,
2197 const upb_MiniTableField* f) {
2198 return _upb_hasbit(msg, _upb_Message_Hasidx(f));
2199}
2200
2201UPB_INLINE void _upb_sethas_field(const upb_Message* msg,
2202 const upb_MiniTableField* f) {
2203 _upb_sethas(msg, _upb_Message_Hasidx(f));
2204}
2205
2206// Oneof case access ///////////////////////////////////////////////////////////
2207
2208UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) {
2209 UPB_ASSERT(f->presence < 0);
2210 return ~(ptrdiff_t)f->presence;
2211}
2212
2213UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg,
2214 const upb_MiniTableField* f) {
2215 return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t);
2216}
2217
2218UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg,
2219 const upb_MiniTableField* f) {
2220 return *_upb_oneofcase_field((upb_Message*)msg, f);
2221}
2222
2223// LINT.ThenChange(GoogleInternalName2)
Mike Kruskal9d435022023-07-11 12:45:07 -07002224
Eric Salo8809a112022-11-21 13:01:06 -08002225UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) {
2226 return field->presence < 0;
2227}
2228
2229UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg,
2230 const upb_MiniTableField* field) {
2231 return (char*)msg + field->offset;
2232}
2233
2234UPB_INLINE const void* _upb_MiniTableField_GetConstPtr(
2235 const upb_Message* msg, const upb_MiniTableField* field) {
2236 return (char*)msg + field->offset;
2237}
2238
Eric Salo10505992022-12-12 12:16:36 -08002239UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg,
2240 const upb_MiniTableField* field) {
Eric Salo8809a112022-11-21 13:01:06 -08002241 if (field->presence > 0) {
2242 _upb_sethas_field(msg, field);
2243 } else if (_upb_MiniTableField_InOneOf(field)) {
2244 *_upb_oneofcase_field(msg, field) = field->number;
2245 }
2246}
2247
Mike Kruskal3bc50492022-12-01 13:34:12 -08002248UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val,
2249 const upb_MiniTableField* field) {
Eric Salo8809a112022-11-21 13:01:06 -08002250 char zero[16] = {0};
2251 switch (_upb_MiniTableField_GetRep(field)) {
2252 case kUpb_FieldRep_1Byte:
2253 return memcmp(&zero, default_val, 1) != 0;
2254 case kUpb_FieldRep_4Byte:
2255 return memcmp(&zero, default_val, 4) != 0;
2256 case kUpb_FieldRep_8Byte:
2257 return memcmp(&zero, default_val, 8) != 0;
2258 case kUpb_FieldRep_StringView: {
2259 const upb_StringView* sv = (const upb_StringView*)default_val;
2260 return sv->size != 0;
2261 }
2262 }
2263 UPB_UNREACHABLE();
2264}
2265
2266UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from,
2267 const upb_MiniTableField* field) {
2268 switch (_upb_MiniTableField_GetRep(field)) {
2269 case kUpb_FieldRep_1Byte:
2270 memcpy(to, from, 1);
2271 return;
2272 case kUpb_FieldRep_4Byte:
2273 memcpy(to, from, 4);
2274 return;
2275 case kUpb_FieldRep_8Byte:
2276 memcpy(to, from, 8);
2277 return;
2278 case kUpb_FieldRep_StringView: {
2279 memcpy(to, from, sizeof(upb_StringView));
2280 return;
2281 }
2282 }
2283 UPB_UNREACHABLE();
2284}
2285
Eric Salob7d54ac2022-12-29 11:59:42 -08002286UPB_INLINE size_t
2287_upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
2288 const unsigned char table[] = {
2289 0,
2290 3, // kUpb_FieldType_Double = 1,
2291 2, // kUpb_FieldType_Float = 2,
2292 3, // kUpb_FieldType_Int64 = 3,
2293 3, // kUpb_FieldType_UInt64 = 4,
2294 2, // kUpb_FieldType_Int32 = 5,
2295 3, // kUpb_FieldType_Fixed64 = 6,
2296 2, // kUpb_FieldType_Fixed32 = 7,
2297 0, // kUpb_FieldType_Bool = 8,
2298 UPB_SIZE(3, 4), // kUpb_FieldType_String = 9,
2299 UPB_SIZE(2, 3), // kUpb_FieldType_Group = 10,
2300 UPB_SIZE(2, 3), // kUpb_FieldType_Message = 11,
2301 UPB_SIZE(3, 4), // kUpb_FieldType_Bytes = 12,
2302 2, // kUpb_FieldType_UInt32 = 13,
2303 2, // kUpb_FieldType_Enum = 14,
2304 2, // kUpb_FieldType_SFixed32 = 15,
2305 3, // kUpb_FieldType_SFixed64 = 16,
2306 2, // kUpb_FieldType_SInt32 = 17,
2307 3, // kUpb_FieldType_SInt64 = 18,
2308 };
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002309 return table[field->UPB_PRIVATE(descriptortype)];
Eric Salob7d54ac2022-12-29 11:59:42 -08002310}
2311
Eric Salo8809a112022-11-21 13:01:06 -08002312// Here we define universal getter/setter functions for message fields.
2313// These look very branchy and inefficient, but as long as the MiniTableField
2314// values are known at compile time, all the branches are optimized away and
2315// we are left with ideal code. This can happen either through through
2316// literals or UPB_ASSUME():
2317//
Eric Salob598b2d2022-12-22 23:14:27 -08002318// // Via struct literals.
Eric Salo8809a112022-11-21 13:01:06 -08002319// bool FooMessage_set_bool_field(const upb_Message* msg, bool val) {
2320// const upb_MiniTableField field = {1, 0, 0, /* etc... */};
2321// // All value in "field" are compile-time known.
Eric Salo10505992022-12-12 12:16:36 -08002322// _upb_Message_SetNonExtensionField(msg, &field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002323// }
2324//
2325// // Via UPB_ASSUME().
Eric Salo10505992022-12-12 12:16:36 -08002326// UPB_INLINE bool upb_Message_SetBool(upb_Message* msg,
2327// const upb_MiniTableField* field,
2328// bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002329// UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002330// UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2331// UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Eric Salo10505992022-12-12 12:16:36 -08002332// _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002333// }
2334//
2335// As a result, we can use these universal getters/setters for *all* message
2336// accessors: generated code, MiniTable accessors, and reflection. The only
2337// exception is the binary encoder/decoder, which need to be a bit more clever
Eric Salob598b2d2022-12-22 23:14:27 -08002338// about how they read/write the message data, for efficiency.
Eric Salo10505992022-12-12 12:16:36 -08002339//
2340// These functions work on both extensions and non-extensions. If the field
2341// of a setter is known to be a non-extension, the arena may be NULL and the
2342// returned bool value may be ignored since it will always succeed.
Eric Salo8809a112022-11-21 13:01:06 -08002343
Eric Salo10505992022-12-12 12:16:36 -08002344UPB_INLINE bool _upb_Message_HasExtensionField(
2345 const upb_Message* msg, const upb_MiniTableExtension* ext) {
2346 UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field));
2347 return _upb_Message_Getext(msg, ext) != NULL;
2348}
2349
2350UPB_INLINE bool _upb_Message_HasNonExtensionField(
2351 const upb_Message* msg, const upb_MiniTableField* field) {
2352 UPB_ASSERT(upb_MiniTableField_HasPresence(field));
2353 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2354 if (_upb_MiniTableField_InOneOf(field)) {
2355 return _upb_getoneofcase_field(msg, field) == field->number;
2356 } else {
2357 return _upb_hasbit_field(msg, field);
2358 }
2359}
2360
2361static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002362 const upb_Message* msg, const upb_MiniTableField* field,
2363 const void* default_val, void* val) {
2364 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2365 if ((_upb_MiniTableField_InOneOf(field) ||
Mike Kruskal3bc50492022-12-01 13:34:12 -08002366 _upb_MiniTable_ValueIsNonZero(default_val, field)) &&
Eric Salo10505992022-12-12 12:16:36 -08002367 !_upb_Message_HasNonExtensionField(msg, field)) {
Eric Salo8809a112022-11-21 13:01:06 -08002368 _upb_MiniTable_CopyFieldData(val, default_val, field);
2369 return;
2370 }
2371 _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field),
2372 field);
2373}
2374
Eric Salo10505992022-12-12 12:16:36 -08002375UPB_INLINE void _upb_Message_GetExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002376 const upb_Message* msg, const upb_MiniTableExtension* mt_ext,
2377 const void* default_val, void* val) {
2378 UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field));
2379 const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext);
2380 if (ext) {
2381 _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field);
2382 } else {
2383 _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field);
2384 }
2385}
2386
Eric Salo10505992022-12-12 12:16:36 -08002387UPB_INLINE void _upb_Message_GetField(const upb_Message* msg,
2388 const upb_MiniTableField* field,
2389 const void* default_val, void* val) {
Eric Salo8809a112022-11-21 13:01:06 -08002390 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002391 _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field,
2392 default_val, val);
Eric Salo8809a112022-11-21 13:01:06 -08002393 } else {
Eric Salo10505992022-12-12 12:16:36 -08002394 _upb_Message_GetNonExtensionField(msg, field, default_val, val);
Eric Salo8809a112022-11-21 13:01:06 -08002395 }
2396}
2397
Eric Salo10505992022-12-12 12:16:36 -08002398UPB_INLINE void _upb_Message_SetNonExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002399 upb_Message* msg, const upb_MiniTableField* field, const void* val) {
2400 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Eric Salo10505992022-12-12 12:16:36 -08002401 _upb_Message_SetPresence(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08002402 _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val,
2403 field);
2404}
2405
Eric Salo10505992022-12-12 12:16:36 -08002406UPB_INLINE bool _upb_Message_SetExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002407 upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val,
2408 upb_Arena* a) {
Eric Salo10505992022-12-12 12:16:36 -08002409 UPB_ASSERT(a);
Eric Salo8809a112022-11-21 13:01:06 -08002410 upb_Message_Extension* ext =
2411 _upb_Message_GetOrCreateExtension(msg, mt_ext, a);
2412 if (!ext) return false;
2413 _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field);
2414 return true;
2415}
2416
Eric Salo10505992022-12-12 12:16:36 -08002417UPB_INLINE bool _upb_Message_SetField(upb_Message* msg,
2418 const upb_MiniTableField* field,
2419 const void* val, upb_Arena* a) {
Eric Salo8809a112022-11-21 13:01:06 -08002420 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002421 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2422 return _upb_Message_SetExtensionField(msg, ext, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08002423 } else {
Eric Salo10505992022-12-12 12:16:36 -08002424 _upb_Message_SetNonExtensionField(msg, field, val);
Eric Salo8809a112022-11-21 13:01:06 -08002425 return true;
2426 }
2427}
2428
Eric Salo10505992022-12-12 12:16:36 -08002429UPB_INLINE void _upb_Message_ClearExtensionField(
2430 upb_Message* msg, const upb_MiniTableExtension* ext_l) {
2431 upb_Message_Internal* in = upb_Message_Getinternal(msg);
2432 if (!in->internal) return;
2433 const upb_Message_Extension* base =
2434 UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension);
2435 upb_Message_Extension* ext =
2436 (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l);
2437 if (ext) {
2438 *ext = *base;
2439 in->internal->ext_begin += sizeof(upb_Message_Extension);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002440 }
2441}
2442
Eric Salo10505992022-12-12 12:16:36 -08002443UPB_INLINE void _upb_Message_ClearNonExtensionField(
Mike Kruskal3bc50492022-12-01 13:34:12 -08002444 upb_Message* msg, const upb_MiniTableField* field) {
2445 if (field->presence > 0) {
Eric Salob598b2d2022-12-22 23:14:27 -08002446 _upb_clearhas(msg, _upb_Message_Hasidx(field));
Mike Kruskal3bc50492022-12-01 13:34:12 -08002447 } else if (_upb_MiniTableField_InOneOf(field)) {
2448 uint32_t* oneof_case = _upb_oneofcase_field(msg, field);
2449 if (*oneof_case != field->number) return;
2450 *oneof_case = 0;
2451 }
2452 const char zeros[16] = {0};
2453 _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros,
2454 field);
2455}
2456
Jie Luo3560e232023-06-12 00:33:50 -07002457UPB_INLINE void _upb_Message_AssertMapIsUntagged(
2458 const upb_Message* msg, const upb_MiniTableField* field) {
Adam Cozzette7d5592e2023-08-23 12:15:26 -07002459 UPB_UNUSED(msg);
Jie Luo3560e232023-06-12 00:33:50 -07002460 _upb_MiniTableField_CheckIsMap(field);
2461#ifndef NDEBUG
2462 upb_TaggedMessagePtr default_val = 0;
2463 upb_TaggedMessagePtr tagged;
2464 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
2465 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged));
2466#endif
2467}
2468
Mike Kruskal232ecf42023-01-14 00:09:40 -08002469UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08002470 upb_Message* msg, const upb_MiniTableField* field, size_t key_size,
2471 size_t val_size, upb_Arena* arena) {
2472 _upb_MiniTableField_CheckIsMap(field);
Jie Luo3560e232023-06-12 00:33:50 -07002473 _upb_Message_AssertMapIsUntagged(msg, field);
Eric Salob7d54ac2022-12-29 11:59:42 -08002474 upb_Map* map = NULL;
2475 upb_Map* default_map_value = NULL;
2476 _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map);
2477 if (!map) {
2478 map = _upb_Map_New(arena, key_size, val_size);
2479 // Check again due to: https://godbolt.org/z/7WfaoKG1r
2480 _upb_MiniTableField_CheckIsMap(field);
2481 _upb_Message_SetNonExtensionField(msg, field, &map);
2482 }
2483 return map;
2484}
2485
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002486#ifdef __cplusplus
2487} /* extern "C" */
2488#endif
2489
2490#if defined(__GNUC__) && !defined(__clang__)
2491#pragma GCC diagnostic pop
2492#endif
2493
2494
Sandy Zhange3b09432023-08-07 09:30:02 -07002495#endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002496
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002497#ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_
2498#define UPB_MESSAGE_INTERNAL_ARRAY_H_
2499
2500#include <string.h>
2501
2502
2503// Must be last.
2504
2505#ifdef __cplusplus
2506extern "C" {
2507#endif
2508
2509// LINT.IfChange(struct_definition)
2510// Our internal representation for repeated fields.
2511struct upb_Array {
2512 uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
2513 size_t size; /* The number of elements in the array. */
2514 size_t capacity; /* Allocated storage. Measured in elements. */
2515};
2516// LINT.ThenChange(GoogleInternalName1)
2517
2518UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) {
2519 size_t ret = arr->data & 7;
2520 UPB_ASSERT(ret <= 4);
2521 return ret;
2522}
2523
2524UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) {
2525 _upb_Array_ElementSizeLg2(arr); // Check assertion.
2526 return (void*)(arr->data & ~(uintptr_t)7);
2527}
2528
2529UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) {
2530 UPB_ASSERT(elem_size_lg2 <= 4);
2531 return (uintptr_t)ptr | elem_size_lg2;
2532}
2533
2534UPB_INLINE void* _upb_array_ptr(upb_Array* arr) {
2535 return (void*)_upb_array_constptr(arr);
2536}
2537
2538UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) {
2539 UPB_ASSERT(elem_size_lg2 <= 4);
2540 UPB_ASSERT(((uintptr_t)ptr & 7) == 0);
2541 return (uintptr_t)ptr | (unsigned)elem_size_lg2;
2542}
2543
2544extern const char _upb_Array_CTypeSizeLg2Table[];
2545
2546UPB_INLINE size_t _upb_Array_CTypeSizeLg2(upb_CType ctype) {
2547 return _upb_Array_CTypeSizeLg2Table[ctype];
2548}
2549
2550UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity,
2551 int elem_size_lg2) {
2552 UPB_ASSERT(elem_size_lg2 <= 4);
2553 const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN);
2554 const size_t bytes = arr_size + (init_capacity << elem_size_lg2);
2555 upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes);
2556 if (!arr) return NULL;
2557 arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2);
2558 arr->size = 0;
2559 arr->capacity = init_capacity;
2560 return arr;
2561}
2562
2563// Resizes the capacity of the array to be at least min_size.
2564bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena);
2565
2566UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size,
2567 upb_Arena* arena) {
2568 if (arr->capacity < size) return _upb_array_realloc(arr, size, arena);
2569 return true;
2570}
2571
2572// Resize without initializing new elements.
2573UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size,
2574 upb_Arena* arena) {
2575 UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking.
2576 if (!_upb_array_reserve(arr, size, arena)) return false;
2577 arr->size = size;
2578 return true;
2579}
2580
2581// This function is intended for situations where elem_size is compile-time
2582// constant or a known expression of the form (1 << lg2), so that the expression
2583// i*elem_size does not result in an actual multiplication.
2584UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data,
2585 size_t elem_size) {
2586 UPB_ASSERT(i < arr->size);
2587 UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr));
2588 char* arr_data = (char*)_upb_array_ptr(arr);
2589 memcpy(arr_data + (i * elem_size), data, elem_size);
2590}
2591
2592UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) {
2593 *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL;
2594}
2595
2596#ifdef __cplusplus
2597} /* extern "C" */
2598#endif
2599
2600
2601#endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */
2602
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002603// Must be last.
2604
2605#ifdef __cplusplus
2606extern "C" {
2607#endif
Eric Salo10505992022-12-12 12:16:36 -08002608
2609UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg,
2610 const upb_MiniTableField* field) {
Mike Kruskal3bc50492022-12-01 13:34:12 -08002611 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002612 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2613 _upb_Message_ClearExtensionField(msg, ext);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002614 } else {
Eric Salo10505992022-12-12 12:16:36 -08002615 _upb_Message_ClearNonExtensionField(msg, field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002616 }
2617}
2618
Jie Luof36a5c62023-05-23 17:56:18 -07002619UPB_API_INLINE void upb_Message_Clear(upb_Message* msg,
2620 const upb_MiniTable* l) {
2621 // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction.
2622 char* mem = (char*)msg - sizeof(upb_Message_Internal);
2623 memset(mem, 0, upb_msg_sizeof(l));
2624}
2625
Eric Salo10505992022-12-12 12:16:36 -08002626UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg,
2627 const upb_MiniTableField* field) {
2628 if (upb_MiniTableField_IsExtension(field)) {
2629 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2630 return _upb_Message_HasExtensionField(msg, ext);
2631 } else {
2632 return _upb_Message_HasNonExtensionField(msg, field);
2633 }
Mike Kruskal3bc50492022-12-01 13:34:12 -08002634}
Eric Salo8809a112022-11-21 13:01:06 -08002635
Eric Salob598b2d2022-12-22 23:14:27 -08002636UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
2637 const upb_Message* message, const upb_MiniTableField* oneof_field) {
2638 UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field));
2639 return _upb_getoneofcase_field(message, oneof_field);
2640}
2641
Eric Salo10505992022-12-12 12:16:36 -08002642UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
2643 const upb_MiniTableField* field,
2644 bool default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002645 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002646 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002647 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002648 bool ret;
Eric Salo10505992022-12-12 12:16:36 -08002649 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002650 return ret;
2651}
2652
Eric Salo10505992022-12-12 12:16:36 -08002653UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
2654 const upb_MiniTableField* field,
2655 bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002656 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002657 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002658 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002659 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002660}
2661
Eric Salo10505992022-12-12 12:16:36 -08002662UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
2663 const upb_MiniTableField* field,
2664 int32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002665 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2666 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Eric Salo8809a112022-11-21 13:01:06 -08002667 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002668 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002669 int32_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002670 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002671 return ret;
2672}
2673
Eric Salo10505992022-12-12 12:16:36 -08002674UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
2675 const upb_MiniTableField* field,
2676 int32_t value, upb_Arena* a) {
Deanna Garciab26afb52023-04-25 13:37:18 -07002677 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2678 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Eric Salo8809a112022-11-21 13:01:06 -08002679 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002680 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002681 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002682}
2683
Eric Salo10505992022-12-12 12:16:36 -08002684UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
2685 const upb_MiniTableField* field,
2686 uint32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002687 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Eric Salo8809a112022-11-21 13:01:06 -08002688 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002689 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002690 uint32_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002691 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002692 return ret;
2693}
2694
Eric Salo10505992022-12-12 12:16:36 -08002695UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
2696 const upb_MiniTableField* field,
2697 uint32_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002698 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Eric Salo8809a112022-11-21 13:01:06 -08002699 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002700 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002701 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002702}
2703
Deanna Garciab26afb52023-04-25 13:37:18 -07002704UPB_API_INLINE void upb_Message_SetClosedEnum(
Eric Salo3f36a912022-12-05 14:12:25 -08002705 upb_Message* msg, const upb_MiniTable* msg_mini_table,
2706 const upb_MiniTableField* field, int32_t value) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002707 UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field));
Eric Salo8809a112022-11-21 13:01:06 -08002708 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002709 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002710 UPB_ASSERT(upb_MiniTableEnum_CheckValue(
2711 upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value));
Eric Salo10505992022-12-12 12:16:36 -08002712 _upb_Message_SetNonExtensionField(msg, field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002713}
2714
Eric Salo10505992022-12-12 12:16:36 -08002715UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
2716 const upb_MiniTableField* field,
2717 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002718 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Eric Salo8809a112022-11-21 13:01:06 -08002719 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002720 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002721 int64_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002722 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002723 return ret;
2724}
2725
Eric Salo10505992022-12-12 12:16:36 -08002726UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
2727 const upb_MiniTableField* field,
2728 int64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002729 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Eric Salo8809a112022-11-21 13:01:06 -08002730 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002731 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002732 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002733}
2734
Eric Salo10505992022-12-12 12:16:36 -08002735UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
2736 const upb_MiniTableField* field,
2737 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002738 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Eric Salo8809a112022-11-21 13:01:06 -08002739 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002740 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002741 uint64_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002742 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002743 return ret;
2744}
2745
Eric Salo10505992022-12-12 12:16:36 -08002746UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
2747 const upb_MiniTableField* field,
2748 uint64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002749 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Eric Salo8809a112022-11-21 13:01:06 -08002750 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002751 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002752 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002753}
2754
Eric Salo10505992022-12-12 12:16:36 -08002755UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
2756 const upb_MiniTableField* field,
2757 float default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002758 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Eric Salo8809a112022-11-21 13:01:06 -08002759 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002760 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002761 float ret;
Eric Salo10505992022-12-12 12:16:36 -08002762 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002763 return ret;
2764}
2765
Eric Salo10505992022-12-12 12:16:36 -08002766UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
2767 const upb_MiniTableField* field,
2768 float value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002769 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Eric Salo8809a112022-11-21 13:01:06 -08002770 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002771 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002772 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002773}
2774
Eric Salo10505992022-12-12 12:16:36 -08002775UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
2776 const upb_MiniTableField* field,
2777 double default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002778 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Eric Salo8809a112022-11-21 13:01:06 -08002779 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002780 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002781 double ret;
Eric Salo10505992022-12-12 12:16:36 -08002782 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002783 return ret;
2784}
2785
Eric Salo10505992022-12-12 12:16:36 -08002786UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
2787 const upb_MiniTableField* field,
2788 double value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002789 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Eric Salo8809a112022-11-21 13:01:06 -08002790 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002791 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002792 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002793}
2794
Eric Salo3f36a912022-12-05 14:12:25 -08002795UPB_API_INLINE upb_StringView
Eric Salo10505992022-12-12 12:16:36 -08002796upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
2797 upb_StringView def_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002798 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2799 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Eric Salo8809a112022-11-21 13:01:06 -08002800 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002801 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002802 upb_StringView ret;
Eric Salo10505992022-12-12 12:16:36 -08002803 _upb_Message_GetField(msg, field, &def_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002804 return ret;
2805}
2806
Eric Salo10505992022-12-12 12:16:36 -08002807UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
2808 const upb_MiniTableField* field,
2809 upb_StringView value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002810 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2811 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Eric Salo8809a112022-11-21 13:01:06 -08002812 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002813 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002814 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002815}
2816
Jie Luo3560e232023-06-12 00:33:50 -07002817UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
Eric Salo8809a112022-11-21 13:01:06 -08002818 const upb_Message* msg, const upb_MiniTableField* field,
2819 upb_Message* default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002820 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08002821 UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
2822 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002823 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Jie Luo3560e232023-06-12 00:33:50 -07002824 upb_TaggedMessagePtr tagged;
2825 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
2826 return tagged;
Eric Salo8809a112022-11-21 13:01:06 -08002827}
2828
Jie Luo3560e232023-06-12 00:33:50 -07002829UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
2830 const upb_Message* msg, const upb_MiniTableField* field,
2831 upb_Message* default_val) {
2832 upb_TaggedMessagePtr tagged =
2833 upb_Message_GetTaggedMessagePtr(msg, field, default_val);
2834 return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged);
2835}
2836
2837// For internal use only; users cannot set tagged messages because only the
2838// parser and the message copier are allowed to directly create an empty
2839// message.
2840UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
2841 upb_Message* msg, const upb_MiniTable* mini_table,
2842 const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002843 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08002844 UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
2845 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002846 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Deanna Garciac7d979d2023-04-14 17:22:13 -07002847 UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg);
Eric Salo10505992022-12-12 12:16:36 -08002848 _upb_Message_SetNonExtensionField(msg, field, &sub_message);
Eric Salo8809a112022-11-21 13:01:06 -08002849}
2850
Jie Luo3560e232023-06-12 00:33:50 -07002851UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
2852 const upb_MiniTable* mini_table,
2853 const upb_MiniTableField* field,
2854 upb_Message* sub_message) {
2855 _upb_Message_SetTaggedMessagePtr(
2856 msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false));
2857}
2858
Mike Kruskal232ecf42023-01-14 00:09:40 -08002859UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
Eric Salo8809a112022-11-21 13:01:06 -08002860 upb_Message* msg, const upb_MiniTable* mini_table,
2861 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002862 UPB_ASSERT(arena);
2863 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08002864 upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*);
2865 if (!sub_message) {
2866 const upb_MiniTable* sub_mini_table =
Deanna Garciac7d979d2023-04-14 17:22:13 -07002867 mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
Eric Salo8809a112022-11-21 13:01:06 -08002868 UPB_ASSERT(sub_mini_table);
2869 sub_message = _upb_Message_New(sub_mini_table, arena);
2870 *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message;
Eric Salo10505992022-12-12 12:16:36 -08002871 _upb_Message_SetPresence(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08002872 }
2873 return sub_message;
2874}
2875
Eric Salob598b2d2022-12-22 23:14:27 -08002876UPB_API_INLINE const upb_Array* upb_Message_GetArray(
Eric Salo8809a112022-11-21 13:01:06 -08002877 const upb_Message* msg, const upb_MiniTableField* field) {
Eric Salob7d54ac2022-12-29 11:59:42 -08002878 _upb_MiniTableField_CheckIsArray(field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07002879 upb_Array* ret;
Eric Salo8809a112022-11-21 13:01:06 -08002880 const upb_Array* default_val = NULL;
Eric Salo10505992022-12-12 12:16:36 -08002881 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002882 return ret;
2883}
2884
Eric Salob598b2d2022-12-22 23:14:27 -08002885UPB_API_INLINE upb_Array* upb_Message_GetMutableArray(
Eric Salo8809a112022-11-21 13:01:06 -08002886 upb_Message* msg, const upb_MiniTableField* field) {
Eric Salob7d54ac2022-12-29 11:59:42 -08002887 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08002888 return (upb_Array*)upb_Message_GetArray(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08002889}
2890
Eric Salob598b2d2022-12-22 23:14:27 -08002891UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
Eric Salob7d54ac2022-12-29 11:59:42 -08002892 upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002893 UPB_ASSERT(arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08002894 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08002895 upb_Array* array = upb_Message_GetMutableArray(msg, field);
2896 if (!array) {
Eric Salob7d54ac2022-12-29 11:59:42 -08002897 array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field));
2898 // Check again due to: https://godbolt.org/z/7WfaoKG1r
2899 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08002900 _upb_Message_SetField(msg, field, &array, arena);
2901 }
2902 return array;
2903}
2904
Jie Luof36a5c62023-05-23 17:56:18 -07002905UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized(
Eric Salob7d54ac2022-12-29 11:59:42 -08002906 upb_Message* msg, const upb_MiniTableField* field, size_t size,
2907 upb_Arena* arena) {
2908 _upb_MiniTableField_CheckIsArray(field);
2909 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena);
2910 if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL;
Eric Salob7d54ac2022-12-29 11:59:42 -08002911 return _upb_array_ptr(arr);
2912}
Eric Salo10505992022-12-12 12:16:36 -08002913
Eric Salob7d54ac2022-12-29 11:59:42 -08002914UPB_API_INLINE const upb_Map* upb_Message_GetMap(
2915 const upb_Message* msg, const upb_MiniTableField* field) {
2916 _upb_MiniTableField_CheckIsMap(field);
Jie Luo3560e232023-06-12 00:33:50 -07002917 _upb_Message_AssertMapIsUntagged(msg, field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07002918 upb_Map* ret;
Eric Salob7d54ac2022-12-29 11:59:42 -08002919 const upb_Map* default_val = NULL;
2920 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
2921 return ret;
2922}
2923
Jie Luo3560e232023-06-12 00:33:50 -07002924UPB_API_INLINE upb_Map* upb_Message_GetMutableMap(
2925 upb_Message* msg, const upb_MiniTableField* field) {
2926 return (upb_Map*)upb_Message_GetMap(msg, field);
2927}
2928
Mike Kruskal232ecf42023-01-14 00:09:40 -08002929UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
Eric Salob598b2d2022-12-22 23:14:27 -08002930 upb_Message* msg, const upb_MiniTable* map_entry_mini_table,
2931 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002932 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salob7d54ac2022-12-29 11:59:42 -08002933 const upb_MiniTableField* map_entry_key_field =
2934 &map_entry_mini_table->fields[0];
2935 const upb_MiniTableField* map_entry_value_field =
2936 &map_entry_mini_table->fields[1];
Mike Kruskal232ecf42023-01-14 00:09:40 -08002937 return _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08002938 msg, field,
2939 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)),
2940 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)),
2941 arena);
Eric Salob598b2d2022-12-22 23:14:27 -08002942}
2943
2944// Updates a map entry given an entry message.
2945upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map,
2946 const upb_MiniTable* mini_table,
2947 const upb_MiniTableField* field,
2948 upb_Message* map_entry_message,
2949 upb_Arena* arena);
2950
Mike Kruskal9d435022023-07-11 12:45:07 -07002951// Compares two messages by serializing them and calling memcmp().
2952bool upb_Message_IsExactlyEqual(const upb_Message* m1, const upb_Message* m2,
2953 const upb_MiniTable* layout);
2954
Eric Salo8809a112022-11-21 13:01:06 -08002955#ifdef __cplusplus
2956} /* extern "C" */
2957#endif
2958
2959
2960#endif // UPB_MESSAGE_ACCESSORS_H_
2961
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002962// These functions are only used by generated code.
2963
2964#ifndef UPB_MESSAGE_MAP_GENCODE_UTIL_H_
2965#define UPB_MESSAGE_MAP_GENCODE_UTIL_H_
2966
2967
2968// Must be last.
2969
2970#ifdef __cplusplus
2971extern "C" {
2972#endif
2973
2974// Message map operations, these get the map from the message first.
2975
2976UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
2977 const upb_tabent* ent = (const upb_tabent*)msg;
2978 uint32_t u32len;
2979 upb_StringView k;
2980 k.data = upb_tabstr(ent->key, &u32len);
2981 k.size = u32len;
2982 _upb_map_fromkey(k, key, size);
2983}
2984
2985UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
2986 const upb_tabent* ent = (const upb_tabent*)msg;
2987 upb_value v = {ent->val.val};
2988 _upb_map_fromvalue(v, val, size);
2989}
2990
2991UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
2992 size_t size) {
2993 upb_tabent* ent = (upb_tabent*)msg;
2994 // This is like _upb_map_tovalue() except the entry already exists
2995 // so we can reuse the allocated upb_StringView for string fields.
2996 if (size == UPB_MAPTYPE_STRING) {
2997 upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val;
2998 memcpy(strp, val, sizeof(*strp));
2999 } else {
3000 memcpy(&ent->val.val, val, size);
3001 }
3002}
3003
3004#ifdef __cplusplus
3005} /* extern "C" */
3006#endif
3007
3008
3009#endif /* UPB_MESSAGE_MAP_GENCODE_UTIL_H_ */
3010
Mike Kruskal9d435022023-07-11 12:45:07 -07003011#ifndef UPB_MINI_TABLE_DECODE_H_
3012#define UPB_MINI_TABLE_DECODE_H_
3013
3014
3015#ifndef UPB_MINI_TABLE_SUB_H_
3016#define UPB_MINI_TABLE_SUB_H_
3017
3018
3019typedef union upb_MiniTableSub upb_MiniTableSub;
3020
3021#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
3022
3023// Export the newer headers, for legacy users. New users should include the
3024// more specific headers directly.
3025// IWYU pragma: begin_exports
Mike Kruskal9d435022023-07-11 12:45:07 -07003026#ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3027#define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3028
3029
3030// Must be last.
3031
3032#ifdef __cplusplus
3033extern "C" {
3034#endif
3035
3036// Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor
3037// must be for an enum, not a message.
3038UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data,
3039 size_t len,
3040 upb_Arena* arena,
3041 upb_Status* status);
3042
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00003043// TODO: Deprecated name; update callers.
Mike Kruskal9d435022023-07-11 12:45:07 -07003044UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data,
3045 size_t len,
3046 upb_Arena* arena,
3047 upb_Status* status) {
3048 return upb_MiniDescriptor_BuildEnum(data, len, arena, status);
3049}
3050
3051#ifdef __cplusplus
3052} /* extern "C" */
3053#endif
3054
3055
3056#endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3057
3058// Functions for linking MiniTables together once they are built from a
3059// MiniDescriptor.
3060//
3061// These functions have names like upb_MiniTable_Link() because they operate on
3062// MiniTables. We put them here, rather than in the mini_table/ directory,
3063// because they are only needed when building MiniTables from MiniDescriptors.
3064// The interfaces in mini_table/ assume that MiniTables are immutable.
3065
3066#ifndef UPB_MINI_DESCRIPTOR_LINK_H_
3067#define UPB_MINI_DESCRIPTOR_LINK_H_
3068
3069
3070// Must be last.
3071
3072#ifdef __cplusplus
3073extern "C" {
3074#endif
3075
3076// Links a sub-message field to a MiniTable for that sub-message. If a
3077// sub-message field is not linked, it will be treated as an unknown field
3078// during parsing, and setting the field will not be allowed. It is possible
3079// to link the message field later, at which point it will no longer be treated
3080// as unknown. However there is no synchronization for this operation, which
3081// means parallel mutation requires external synchronization.
3082// Returns success/failure.
3083UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table,
3084 upb_MiniTableField* field,
3085 const upb_MiniTable* sub);
3086
3087// Links an enum field to a MiniTable for that enum.
3088// All enum fields must be linked prior to parsing.
3089// Returns success/failure.
3090UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table,
3091 upb_MiniTableField* field,
3092 const upb_MiniTableEnum* sub);
3093
3094// Returns a list of fields that require linking at runtime, to connect the
3095// MiniTable to its sub-messages and sub-enums. The list of fields will be
3096// written to the `subs` array, which must have been allocated by the caller
3097// and must be large enough to hold a list of all fields in the message.
3098//
3099// The order of the fields returned by this function is significant: it matches
3100// the order expected by upb_MiniTable_Link() below.
3101//
3102// The return value packs the sub-message count and sub-enum count into a single
3103// integer like so:
3104// return (msg_count << 16) | enum_count;
3105UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt,
3106 const upb_MiniTableField** subs);
3107
3108// Links a message to its sub-messages and sub-enums. The caller must pass
3109// arrays of sub-tables and sub-enums, in the same length and order as is
3110// returned by upb_MiniTable_GetSubList() above. However, individual elements
3111// of the sub_tables may be NULL if those sub-messages were tree shaken.
3112//
3113// Returns false if either array is too short, or if any of the tables fails
3114// to link.
3115UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt,
3116 const upb_MiniTable** sub_tables,
3117 size_t sub_table_count,
3118 const upb_MiniTableEnum** sub_enums,
3119 size_t sub_enum_count);
3120
3121#ifdef __cplusplus
3122} /* extern "C" */
3123#endif
3124
3125
3126#endif // UPB_MINI_DESCRIPTOR_LINK_H_
3127// IWYU pragma: end_exports
3128
3129// Must be last.
3130
3131typedef enum {
3132 kUpb_MiniTablePlatform_32Bit,
3133 kUpb_MiniTablePlatform_64Bit,
3134 kUpb_MiniTablePlatform_Native =
3135 UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit),
3136} upb_MiniTablePlatform;
3137
3138#ifdef __cplusplus
3139extern "C" {
3140#endif
3141
3142// Builds a mini table from the data encoded in the buffer [data, len]. If any
3143// errors occur, returns NULL and sets a status message. In the success case,
3144// the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum
3145// fields to link the table to the appropriate sub-tables.
3146upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len,
3147 upb_MiniTablePlatform platform,
3148 upb_Arena* arena, upb_Status* status);
3149
3150UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len,
3151 upb_Arena* arena,
3152 upb_Status* status) {
3153 return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena,
3154 status);
3155}
3156
3157// Initializes a MiniTableExtension buffer that has already been allocated.
3158// This is needed by upb_FileDef and upb_MessageDef, which allocate all of the
3159// extensions together in a single contiguous array.
3160const char* _upb_MiniTableExtension_Init(const char* data, size_t len,
3161 upb_MiniTableExtension* ext,
3162 const upb_MiniTable* extendee,
3163 upb_MiniTableSub sub,
3164 upb_MiniTablePlatform platform,
3165 upb_Status* status);
3166
3167UPB_API_INLINE const char* upb_MiniTableExtension_Init(
3168 const char* data, size_t len, upb_MiniTableExtension* ext,
3169 const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) {
3170 return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub,
3171 kUpb_MiniTablePlatform_Native, status);
3172}
3173
3174UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build(
3175 const char* data, size_t len, const upb_MiniTable* extendee,
3176 upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena,
3177 upb_Status* status);
3178
3179UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
3180 const char* data, size_t len, const upb_MiniTable* extendee,
3181 upb_Arena* arena, upb_Status* status) {
3182 upb_MiniTableSub sub;
3183 sub.submsg = NULL;
3184 return _upb_MiniTableExtension_Build(
3185 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3186}
3187
3188UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
3189 const char* data, size_t len, const upb_MiniTable* extendee,
3190 upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) {
3191 upb_MiniTableSub sub;
3192 sub.submsg = submsg;
3193 return _upb_MiniTableExtension_Build(
3194 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3195}
3196
3197UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum(
3198 const char* data, size_t len, const upb_MiniTable* extendee,
3199 upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) {
3200 upb_MiniTableSub sub;
3201 sub.subenum = subenum;
3202 return _upb_MiniTableExtension_Build(
3203 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3204}
3205
3206// Like upb_MiniTable_Build(), but the user provides a buffer of layout data so
3207// it can be reused from call to call, avoiding repeated realloc()/free().
3208//
3209// The caller owns `*buf` both before and after the call, and must free() it
3210// when it is no longer in use. The function will realloc() `*buf` as
3211// necessary, updating `*size` accordingly.
3212upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
3213 upb_MiniTablePlatform platform,
3214 upb_Arena* arena, void** buf,
3215 size_t* buf_size, upb_Status* status);
3216
3217#ifdef __cplusplus
3218} /* extern "C" */
3219#endif
3220
3221
3222#endif /* UPB_MINI_TABLE_DECODE_H_ */
3223
3224#ifndef UPB_MINI_TABLE_FILE_H_
3225#define UPB_MINI_TABLE_FILE_H_
3226
3227
3228#ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_
3229#define UPB_MINI_TABLE_INTERNAL_FILE_H_
3230
3231
3232// Must be last.
3233
3234struct upb_MiniTableFile {
Sandy Zhange3b09432023-08-07 09:30:02 -07003235 const struct upb_MiniTable** msgs;
3236 const struct upb_MiniTableEnum** enums;
3237 const struct upb_MiniTableExtension** exts;
Mike Kruskal9d435022023-07-11 12:45:07 -07003238 int msg_count;
3239 int enum_count;
3240 int ext_count;
3241};
3242
3243
3244#endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */
3245
3246typedef struct upb_MiniTableFile upb_MiniTableFile;
3247
3248#endif /* UPB_MINI_TABLE_FILE_H_ */
3249
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003250// upb_decode: parsing into a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003251
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003252#ifndef UPB_WIRE_DECODE_H_
3253#define UPB_WIRE_DECODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003254
Protobuf Team Bot743bf922023-09-14 01:12:11 +00003255#include <stddef.h>
3256#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003257
Adam Cozzette7d5592e2023-08-23 12:15:26 -07003258
Joshua Habermand3995ec2022-09-30 16:54:39 -07003259// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003260
3261#ifdef __cplusplus
3262extern "C" {
3263#endif
3264
3265enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07003266 /* If set, strings will alias the input buffer instead of copying into the
3267 * arena. */
3268 kUpb_DecodeOption_AliasString = 1,
3269
3270 /* If set, the parse will return failure if any message is missing any
3271 * required fields when the message data ends. The parse will still continue,
3272 * and the failure will only be reported at the end.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003273 *
Joshua Habermand3995ec2022-09-30 16:54:39 -07003274 * IMPORTANT CAVEATS:
3275 *
3276 * 1. This can throw a false positive failure if an incomplete message is seen
3277 * on the wire but is later completed when the sub-message occurs again.
3278 * For this reason, a second pass is required to verify a failure, to be
3279 * truly robust.
3280 *
3281 * 2. This can return a false success if you are decoding into a message that
3282 * already has some sub-message fields present. If the sub-message does
3283 * not occur in the binary payload, we will never visit it and discover the
3284 * incomplete sub-message. For this reason, this check is only useful for
3285 * implemting ParseFromString() semantics. For MergeFromString(), a
3286 * post-parse validation step will always be necessary. */
3287 kUpb_DecodeOption_CheckRequired = 2,
Jie Luo3560e232023-06-12 00:33:50 -07003288
3289 /* EXPERIMENTAL:
3290 *
3291 * If set, the parser will allow parsing of sub-message fields that were not
3292 * previously linked using upb_MiniTable_SetSubMessage(). The data will be
3293 * parsed into an internal "empty" message type that cannot be accessed
3294 * directly, but can be later promoted into the true message type if the
3295 * sub-message fields are linked at a later time.
3296 *
3297 * Users should set this option if they intend to perform dynamic tree shaking
3298 * and promoting using the interfaces in message/promote.h. If this option is
3299 * enabled, it is important that the resulting messages are only accessed by
3300 * code that is aware of promotion rules:
3301 *
3302 * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented
3303 * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether
3304 * the message uses the internal "empty" type.
3305 *
3306 * 2. Any code *reading* these message pointers must test whether the "empty"
3307 * tag bit is set, using the interfaces in mini_table/types.h. However
3308 * writing of message pointers should always use plain upb_Message*, since
3309 * users are not allowed to create "empty" messages.
3310 *
3311 * 3. It is always safe to test whether a field is present or test the array
3312 * length; these interfaces will reflect that empty messages are present,
3313 * even though their data cannot be accessed without promoting first.
3314 *
3315 * 4. If a message pointer is indeed tagged as empty, the message may not be
3316 * accessed directly, only promoted through the interfaces in
3317 * message/promote.h.
3318 *
3319 * 5. Tagged/empty messages may never be created by the user. They may only
3320 * be created by the parser or the message-copying logic in message/copy.h.
3321 */
3322 kUpb_DecodeOption_ExperimentalAllowUnlinked = 4,
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003323};
3324
Deanna Garciac7d979d2023-04-14 17:22:13 -07003325UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) {
3326 return (uint32_t)depth << 16;
3327}
3328
3329UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) {
3330 return options >> 16;
3331}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003332
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003333// Enforce an upper bound on recursion depth.
3334UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) {
Deanna Garciac7d979d2023-04-14 17:22:13 -07003335 uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003336 if (max_depth > limit) max_depth = limit;
Deanna Garciac7d979d2023-04-14 17:22:13 -07003337 return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003338}
3339
Joshua Habermand3995ec2022-09-30 16:54:39 -07003340typedef enum {
3341 kUpb_DecodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003342 kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
3343 kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed
3344 kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8
3345 kUpb_DecodeStatus_MaxDepthExceeded =
3346 4, // Exceeded upb_DecodeOptions_MaxDepth
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003347
Joshua Habermand3995ec2022-09-30 16:54:39 -07003348 // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise
3349 // succeeded.
3350 kUpb_DecodeStatus_MissingRequired = 5,
Jie Luo3560e232023-06-12 00:33:50 -07003351
3352 // Unlinked sub-message field was present, but
3353 // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list
3354 // of options.
3355 kUpb_DecodeStatus_UnlinkedSubMessage = 6,
Joshua Habermand3995ec2022-09-30 16:54:39 -07003356} upb_DecodeStatus;
3357
Eric Salo10505992022-12-12 12:16:36 -08003358UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size,
3359 upb_Message* msg, const upb_MiniTable* l,
3360 const upb_ExtensionRegistry* extreg,
3361 int options, upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003362
3363#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08003364} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003365#endif
3366
Joshua Habermandd69a482021-05-17 22:40:33 -07003367
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003368#endif /* UPB_WIRE_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07003369
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003370// These are the specialized field parser functions for the fast parser.
3371// Generated tables will refer to these by name.
3372//
3373// The function names are encoded with names like:
3374//
3375// // 123 4
3376// upb_pss_1bt(); // Parse singular string, 1 byte tag.
3377//
3378// In position 1:
3379// - 'p' for parse, most function use this
3380// - 'c' for copy, for when we are copying strings instead of aliasing
3381//
3382// In position 2 (cardinality):
3383// - 's' for singular, with or without hasbit
3384// - 'o' for oneof
3385// - 'r' for non-packed repeated
3386// - 'p' for packed repeated
3387//
3388// In position 3 (type):
3389// - 'b1' for bool
3390// - 'v4' for 4-byte varint
3391// - 'v8' for 8-byte varint
3392// - 'z4' for zig-zag-encoded 4-byte varint
3393// - 'z8' for zig-zag-encoded 8-byte varint
3394// - 'f4' for 4-byte fixed
3395// - 'f8' for 8-byte fixed
3396// - 'm' for sub-message
3397// - 's' for string (validate UTF-8)
3398// - 'b' for bytes
3399//
3400// In position 4 (tag length):
3401// - '1' for one-byte tags (field numbers 1-15)
3402// - '2' for two-byte tags (field numbers 16-2048)
3403
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003404#ifndef UPB_WIRE_DECODE_FAST_H_
3405#define UPB_WIRE_DECODE_FAST_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003406
3407
Joshua Habermand3995ec2022-09-30 16:54:39 -07003408// Must be last.
3409
3410#ifdef __cplusplus
3411extern "C" {
3412#endif
3413
Joshua Habermanf41049a2022-01-21 14:41:25 -08003414struct upb_Decoder;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003415
3416// The fallback, generic parsing function that can handle any field type.
3417// This just uses the regular (non-fast) parser to parse a single field.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003418const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d,
3419 const char* ptr, upb_Message* msg,
3420 intptr_t table, uint64_t hasbits,
3421 uint64_t data);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003422
Joshua Habermanf41049a2022-01-21 14:41:25 -08003423#define UPB_PARSE_PARAMS \
3424 struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003425 uint64_t hasbits, uint64_t data
3426
3427/* primitive fields ***********************************************************/
3428
3429#define F(card, type, valbytes, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003430 const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003431
3432#define TYPES(card, tagbytes) \
3433 F(card, b, 1, tagbytes) \
3434 F(card, v, 4, tagbytes) \
3435 F(card, v, 8, tagbytes) \
3436 F(card, z, 4, tagbytes) \
3437 F(card, z, 8, tagbytes) \
3438 F(card, f, 4, tagbytes) \
3439 F(card, f, 8, tagbytes)
3440
3441#define TAGBYTES(card) \
3442 TYPES(card, 1) \
3443 TYPES(card, 2)
3444
3445TAGBYTES(s)
3446TAGBYTES(o)
3447TAGBYTES(r)
3448TAGBYTES(p)
3449
3450#undef F
3451#undef TYPES
3452#undef TAGBYTES
3453
3454/* string fields **************************************************************/
3455
3456#define F(card, tagbytes, type) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003457 const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
3458 const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003459
3460#define UTF8(card, tagbytes) \
3461 F(card, tagbytes, s) \
3462 F(card, tagbytes, b)
3463
3464#define TAGBYTES(card) \
3465 UTF8(card, 1) \
3466 UTF8(card, 2)
3467
3468TAGBYTES(s)
3469TAGBYTES(o)
3470TAGBYTES(r)
3471
3472#undef F
3473#undef TAGBYTES
3474
3475/* sub-message fields *********************************************************/
3476
3477#define F(card, tagbytes, size_ceil, ceil_arg) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003478 const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003479
3480#define SIZES(card, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003481 F(card, tagbytes, 64, 64) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003482 F(card, tagbytes, 128, 128) \
3483 F(card, tagbytes, 192, 192) \
3484 F(card, tagbytes, 256, 256) \
3485 F(card, tagbytes, max, -1)
3486
3487#define TAGBYTES(card) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003488 SIZES(card, 1) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003489 SIZES(card, 2)
3490
3491TAGBYTES(s)
3492TAGBYTES(o)
3493TAGBYTES(r)
3494
3495#undef TAGBYTES
3496#undef SIZES
3497#undef F
3498
3499#undef UPB_PARSE_PARAMS
3500
Joshua Habermand3995ec2022-09-30 16:54:39 -07003501#ifdef __cplusplus
3502} /* extern "C" */
3503#endif
3504
3505
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003506#endif /* UPB_WIRE_DECODE_FAST_H_ */
Joshua Habermandd69a482021-05-17 22:40:33 -07003507
Eric Salo8809a112022-11-21 13:01:06 -08003508// upb_Encode: parsing from a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003509
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003510#ifndef UPB_WIRE_ENCODE_H_
3511#define UPB_WIRE_ENCODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003512
Protobuf Team Bot743bf922023-09-14 01:12:11 +00003513#include <stddef.h>
3514#include <stdint.h>
3515
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003516
Joshua Habermand3995ec2022-09-30 16:54:39 -07003517// Must be last.
3518
3519#ifdef __cplusplus
3520extern "C" {
3521#endif
3522
3523enum {
3524 /* If set, the results of serializing will be deterministic across all
3525 * instances of this binary. There are no guarantees across different
3526 * binary builds.
3527 *
3528 * If your proto contains maps, the encoder will need to malloc()/free()
3529 * memory during encode. */
3530 kUpb_EncodeOption_Deterministic = 1,
3531
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003532 // When set, unknown fields are not printed.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003533 kUpb_EncodeOption_SkipUnknown = 2,
3534
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003535 // When set, the encode will fail if any required fields are missing.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003536 kUpb_EncodeOption_CheckRequired = 4,
3537};
3538
Joshua Habermand3995ec2022-09-30 16:54:39 -07003539typedef enum {
3540 kUpb_EncodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003541 kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
3542 kUpb_EncodeStatus_MaxDepthExceeded = 2,
Joshua Habermand3995ec2022-09-30 16:54:39 -07003543
3544 // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
3545 kUpb_EncodeStatus_MissingRequired = 3,
3546} upb_EncodeStatus;
3547
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003548UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
3549 return (uint32_t)depth << 16;
3550}
3551
3552UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) {
3553 return options >> 16;
3554}
3555
3556// Enforce an upper bound on recursion depth.
3557UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) {
3558 uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options);
3559 if (max_depth > limit) max_depth = limit;
3560 return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff);
3561}
3562
Jason Lunn67dee292023-07-13 13:15:26 -07003563UPB_API upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l,
3564 int options, upb_Arena* arena, char** buf,
3565 size_t* size);
Joshua Habermand3995ec2022-09-30 16:54:39 -07003566
3567#ifdef __cplusplus
3568} /* extern "C" */
3569#endif
3570
3571
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003572#endif /* UPB_WIRE_ENCODE_H_ */
Mike Kruskal9d435022023-07-11 12:45:07 -07003573// IWYU pragma: end_exports
3574
3575#endif // UPB_GENERATED_CODE_SUPPORT_H_
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00003576/* This file was generated by upb_generator from the input file:
Mike Kruskal9d435022023-07-11 12:45:07 -07003577 *
3578 * google/protobuf/descriptor.proto
3579 *
3580 * Do not edit -- your changes will be discarded when the file is
3581 * regenerated. */
3582
Protobuf Team Botd11eb712023-09-15 00:25:33 +00003583#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
3584#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
3585
3586
3587// Must be last.
3588
3589#ifdef __cplusplus
3590extern "C" {
3591#endif
3592
Protobuf Team Botd14a3362023-10-07 23:51:34 +00003593extern const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init;
3594extern const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init;
3595extern const upb_MiniTable google__protobuf__DescriptorProto_msg_init;
3596extern const upb_MiniTable google__protobuf__DescriptorProto__ExtensionRange_msg_init;
3597extern const upb_MiniTable google__protobuf__DescriptorProto__ReservedRange_msg_init;
3598extern const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init;
3599extern const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init;
3600extern const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init;
3601extern const upb_MiniTable google__protobuf__OneofDescriptorProto_msg_init;
3602extern const upb_MiniTable google__protobuf__EnumDescriptorProto_msg_init;
3603extern const upb_MiniTable google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init;
3604extern const upb_MiniTable google__protobuf__EnumValueDescriptorProto_msg_init;
3605extern const upb_MiniTable google__protobuf__ServiceDescriptorProto_msg_init;
3606extern const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init;
3607extern const upb_MiniTable google__protobuf__FileOptions_msg_init;
3608extern const upb_MiniTable google__protobuf__MessageOptions_msg_init;
3609extern const upb_MiniTable google__protobuf__FieldOptions_msg_init;
3610extern const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init;
3611extern const upb_MiniTable google__protobuf__OneofOptions_msg_init;
3612extern const upb_MiniTable google__protobuf__EnumOptions_msg_init;
3613extern const upb_MiniTable google__protobuf__EnumValueOptions_msg_init;
3614extern const upb_MiniTable google__protobuf__ServiceOptions_msg_init;
3615extern const upb_MiniTable google__protobuf__MethodOptions_msg_init;
3616extern const upb_MiniTable google__protobuf__UninterpretedOption_msg_init;
3617extern const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init;
3618extern const upb_MiniTable google__protobuf__FeatureSet_msg_init;
3619extern const upb_MiniTable google__protobuf__FeatureSetDefaults_msg_init;
3620extern const upb_MiniTable google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init;
3621extern const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init;
3622extern const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init;
3623extern const upb_MiniTable google__protobuf__GeneratedCodeInfo_msg_init;
3624extern const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00003625
3626extern const upb_MiniTableEnum google_protobuf_Edition_enum_init;
3627extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init;
3628extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init;
3629extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init;
3630extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init;
3631extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init;
3632extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init;
Protobuf Team Bot61127952023-09-26 20:07:33 +00003633extern const upb_MiniTableEnum google_protobuf_FeatureSet_Utf8Validation_enum_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00003634extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init;
3635extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init;
3636extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init;
3637extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init;
3638extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init;
3639extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init;
3640extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init;
3641extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init;
3642extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init;
3643extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout;
3644
3645#ifdef __cplusplus
3646} /* extern "C" */
3647#endif
3648
3649
3650#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */
3651
3652#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
3653#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
3654
3655#include <string.h>
3656
3657
3658// Must be last.
3659
3660#ifdef __cplusplus
3661extern "C" {
3662#endif
3663
3664// The maximum number of bytes a single protobuf field can take up in the
3665// wire format. We only want to do one bounds check per field, so the input
3666// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called,
3667// the decoder can read this many bytes without performing another bounds
3668// check. The stream will copy into a patch buffer as necessary to guarantee
3669// this invariant.
3670#define kUpb_EpsCopyInputStream_SlopBytes 16
3671
3672enum {
3673 kUpb_EpsCopyInputStream_NoAliasing = 0,
3674 kUpb_EpsCopyInputStream_OnPatch = 1,
3675 kUpb_EpsCopyInputStream_NoDelta = 2
3676};
3677
3678typedef struct {
3679 const char* end; // Can read up to SlopBytes bytes beyond this.
3680 const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0)
3681 uintptr_t aliasing;
3682 int limit; // Submessage limit relative to end
3683 bool error; // To distinguish between EOF and error.
3684 char patch[kUpb_EpsCopyInputStream_SlopBytes * 2];
3685} upb_EpsCopyInputStream;
3686
3687// Returns true if the stream is in the error state. A stream enters the error
3688// state when the user reads past a limit (caught in IsDone()) or the
3689// ZeroCopyInputStream returns an error.
3690UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) {
3691 return e->error;
3692}
3693
3694typedef const char* upb_EpsCopyInputStream_BufferFlipCallback(
3695 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start);
3696
3697typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc(
3698 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
3699
3700// Initializes a upb_EpsCopyInputStream using the contents of the buffer
3701// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least
3702// kUpb_EpsCopyInputStream_SlopBytes are available to read.
3703UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e,
3704 const char** ptr, size_t size,
3705 bool enable_aliasing) {
3706 if (size <= kUpb_EpsCopyInputStream_SlopBytes) {
3707 memset(&e->patch, 0, 32);
3708 if (size) memcpy(&e->patch, *ptr, size);
3709 e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch
3710 : kUpb_EpsCopyInputStream_NoAliasing;
3711 *ptr = e->patch;
3712 e->end = *ptr + size;
3713 e->limit = 0;
3714 } else {
3715 e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes;
3716 e->limit = kUpb_EpsCopyInputStream_SlopBytes;
3717 e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta
3718 : kUpb_EpsCopyInputStream_NoAliasing;
3719 }
3720 e->limit_ptr = e->end;
3721 e->error = false;
3722}
3723
3724typedef enum {
3725 // The current stream position is at a limit.
3726 kUpb_IsDoneStatus_Done,
3727
3728 // The current stream position is not at a limit.
3729 kUpb_IsDoneStatus_NotDone,
3730
3731 // The current stream position is not at a limit, and the stream needs to
3732 // be flipped to a new buffer before more data can be read.
3733 kUpb_IsDoneStatus_NeedFallback,
3734} upb_IsDoneStatus;
3735
3736// Returns the status of the current stream position. This is a low-level
3737// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible.
3738UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus(
3739 upb_EpsCopyInputStream* e, const char* ptr, int* overrun) {
3740 *overrun = ptr - e->end;
3741 if (UPB_LIKELY(ptr < e->limit_ptr)) {
3742 return kUpb_IsDoneStatus_NotDone;
3743 } else if (UPB_LIKELY(*overrun == e->limit)) {
3744 return kUpb_IsDoneStatus_Done;
3745 } else {
3746 return kUpb_IsDoneStatus_NeedFallback;
3747 }
3748}
3749
3750// Returns true if the stream has hit a limit, either the current delimited
3751// limit or the overall end-of-stream. As a side effect, this function may flip
3752// the pointer to a new buffer if there are less than
3753// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer.
3754//
3755// Postcondition: if the function returns false, there are at least
3756// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr.
3757UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback(
3758 upb_EpsCopyInputStream* e, const char** ptr,
3759 upb_EpsCopyInputStream_IsDoneFallbackFunc* func) {
3760 int overrun;
3761 switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) {
3762 case kUpb_IsDoneStatus_Done:
3763 return true;
3764 case kUpb_IsDoneStatus_NotDone:
3765 return false;
3766 case kUpb_IsDoneStatus_NeedFallback:
3767 *ptr = func(e, *ptr, overrun);
3768 return *ptr == NULL;
3769 }
3770 UPB_UNREACHABLE();
3771}
3772
3773const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback(
3774 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
3775
3776// A simpler version of IsDoneWithCallback() that does not support a buffer flip
3777// callback. Useful in cases where we do not need to insert custom logic at
3778// every buffer flip.
3779//
3780// If this returns true, the user must call upb_EpsCopyInputStream_IsError()
3781// to distinguish between EOF and error.
3782UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e,
3783 const char** ptr) {
3784 return upb_EpsCopyInputStream_IsDoneWithCallback(
3785 e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback);
3786}
3787
3788// Returns the total number of bytes that are safe to read from the current
3789// buffer without reading uninitialized or unallocated memory.
3790//
3791// Note that this check does not respect any semantic limits on the stream,
3792// either limits from PushLimit() or the overall stream end, so some of these
3793// bytes may have unpredictable, nonsense values in them. The guarantee is only
3794// that the bytes are valid to read from the perspective of the C language
3795// (ie. you can read without triggering UBSAN or ASAN).
3796UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable(
3797 upb_EpsCopyInputStream* e, const char* ptr) {
3798 return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes;
3799}
3800
3801// Returns true if the given delimited field size is valid (it does not extend
3802// beyond any previously-pushed limits). `ptr` should point to the beginning
3803// of the field data, after the delimited size.
3804//
3805// Note that this does *not* guarantee that all of the data for this field is in
3806// the current buffer.
3807UPB_INLINE bool upb_EpsCopyInputStream_CheckSize(
3808 const upb_EpsCopyInputStream* e, const char* ptr, int size) {
3809 UPB_ASSERT(size >= 0);
3810 return ptr - e->end + size <= e->limit;
3811}
3812
3813UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable(
3814 upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) {
3815 // This is one extra branch compared to the more normal:
3816 // return (size_t)(end - ptr) < size;
3817 // However it is one less computation if we are just about to use "ptr + len":
3818 // https://godbolt.org/z/35YGPz
3819 // In microbenchmarks this shows a small improvement.
3820 uintptr_t uptr = (uintptr_t)ptr;
3821 uintptr_t uend = (uintptr_t)e->limit_ptr;
3822 uintptr_t res = uptr + (size_t)size;
3823 if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes;
3824 // NOTE: this check depends on having a linear address space. This is not
3825 // technically guaranteed by uintptr_t.
3826 bool ret = res >= uptr && res <= uend;
3827 if (size < 0) UPB_ASSERT(!ret);
3828 return ret;
3829}
3830
3831// Returns true if the given delimited field size is valid (it does not extend
3832// beyond any previously-pushed limited) *and* all of the data for this field is
3833// available to be read in the current buffer.
3834//
3835// If the size is negative, this function will always return false. This
3836// property can be useful in some cases.
3837UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable(
3838 upb_EpsCopyInputStream* e, const char* ptr, int size) {
3839 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false);
3840}
3841
3842// Returns true if the given sub-message size is valid (it does not extend
3843// beyond any previously-pushed limited) *and* all of the data for this
3844// sub-message is available to be parsed in the current buffer.
3845//
3846// This implies that all fields from the sub-message can be parsed from the
3847// current buffer while maintaining the invariant that we always have at least
3848// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of
3849// any individual field start.
3850//
3851// If the size is negative, this function will always return false. This
3852// property can be useful in some cases.
3853UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(
3854 upb_EpsCopyInputStream* e, const char* ptr, int size) {
3855 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true);
3856}
3857
3858// Returns true if aliasing_enabled=true was passed to
3859// upb_EpsCopyInputStream_Init() when this stream was initialized.
3860UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled(
3861 upb_EpsCopyInputStream* e) {
3862 return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing;
3863}
3864
3865// Returns true if aliasing_enabled=true was passed to
3866// upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can
3867// alias into the region [ptr, size] in an input buffer.
3868UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable(
3869 upb_EpsCopyInputStream* e, const char* ptr, size_t size) {
3870 // When EpsCopyInputStream supports streaming, this will need to become a
3871 // runtime check.
3872 return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) &&
3873 e->aliasing >= kUpb_EpsCopyInputStream_NoDelta;
3874}
3875
3876// Returns a pointer into an input buffer that corresponds to the parsing
3877// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may
3878// be different if we are currently parsing out of the patch buffer.
3879//
3880// REQUIRES: Aliasing must be available for the given pointer. If the input is a
3881// flat buffer and aliasing is enabled, then aliasing will always be available.
3882UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr(
3883 upb_EpsCopyInputStream* e, const char* ptr) {
3884 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0));
3885 uintptr_t delta =
3886 e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing;
3887 return (const char*)((uintptr_t)ptr + delta);
3888}
3889
3890// Reads string data from the input, aliasing into the input buffer instead of
3891// copying. The parsing pointer is passed in `*ptr`, and will be updated if
3892// necessary to point to the actual input buffer. Returns the new parsing
3893// pointer, which will be advanced past the string data.
3894//
3895// REQUIRES: Aliasing must be available for this data region (test with
3896// upb_EpsCopyInputStream_AliasingAvailable().
3897UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased(
3898 upb_EpsCopyInputStream* e, const char** ptr, size_t size) {
3899 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size));
3900 const char* ret = *ptr + size;
3901 *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr);
3902 UPB_ASSUME(ret != NULL);
3903 return ret;
3904}
3905
3906// Skips `size` bytes of data from the input and returns a pointer past the end.
3907// Returns NULL on end of stream or error.
3908UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e,
3909 const char* ptr, int size) {
3910 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
3911 return ptr + size;
3912}
3913
3914// Copies `size` bytes of data from the input `ptr` into the buffer `to`, and
3915// returns a pointer past the end. Returns NULL on end of stream or error.
3916UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e,
3917 const char* ptr, void* to,
3918 int size) {
3919 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
3920 memcpy(to, ptr, size);
3921 return ptr + size;
3922}
3923
3924// Reads string data from the stream and advances the pointer accordingly.
3925// If aliasing was enabled when the stream was initialized, then the returned
3926// pointer will point into the input buffer if possible, otherwise new data
3927// will be allocated from arena and copied into. We may be forced to copy even
3928// if aliasing was enabled if the input data spans input buffers.
3929//
3930// Returns NULL if memory allocation failed, or we reached a premature EOF.
3931UPB_INLINE const char* upb_EpsCopyInputStream_ReadString(
3932 upb_EpsCopyInputStream* e, const char** ptr, size_t size,
3933 upb_Arena* arena) {
3934 if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) {
3935 return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size);
3936 } else {
3937 // We need to allocate and copy.
3938 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) {
3939 return NULL;
3940 }
3941 UPB_ASSERT(arena);
3942 char* data = (char*)upb_Arena_Malloc(arena, size);
3943 if (!data) return NULL;
3944 const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size);
3945 *ptr = data;
3946 return ret;
3947 }
3948}
3949
3950UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) {
3951 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
3952}
3953
3954// Pushes a limit onto the stack of limits for the current stream. The limit
3955// will extend for `size` bytes beyond the position in `ptr`. Future calls to
3956// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position
3957// reaches this limit.
3958//
3959// Returns a delta that the caller must store and supply to PopLimit() below.
3960UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e,
3961 const char* ptr, int size) {
3962 int limit = size + (int)(ptr - e->end);
3963 int delta = e->limit - limit;
3964 _upb_EpsCopyInputStream_CheckLimit(e);
3965 UPB_ASSERT(limit <= e->limit);
3966 e->limit = limit;
3967 e->limit_ptr = e->end + UPB_MIN(0, limit);
3968 _upb_EpsCopyInputStream_CheckLimit(e);
3969 return delta;
3970}
3971
3972// Pops the last limit that was pushed on this stream. This may only be called
3973// once IsDone() returns true. The user must pass the delta that was returned
3974// from PushLimit().
3975UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e,
3976 const char* ptr,
3977 int saved_delta) {
3978 UPB_ASSERT(ptr - e->end == e->limit);
3979 _upb_EpsCopyInputStream_CheckLimit(e);
3980 e->limit += saved_delta;
3981 e->limit_ptr = e->end + UPB_MIN(0, e->limit);
3982 _upb_EpsCopyInputStream_CheckLimit(e);
3983}
3984
3985UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline(
3986 upb_EpsCopyInputStream* e, const char* ptr, int overrun,
3987 upb_EpsCopyInputStream_BufferFlipCallback* callback) {
3988 if (overrun < e->limit) {
3989 // Need to copy remaining data into patch buffer.
3990 UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes);
3991 const char* old_end = ptr;
3992 const char* new_start = &e->patch[0] + overrun;
3993 memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0,
3994 kUpb_EpsCopyInputStream_SlopBytes);
3995 memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes);
3996 ptr = new_start;
3997 e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes];
3998 e->limit -= kUpb_EpsCopyInputStream_SlopBytes;
3999 e->limit_ptr = e->end + e->limit;
4000 UPB_ASSERT(ptr < e->limit_ptr);
4001 if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) {
4002 e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start;
4003 }
4004 return callback(e, old_end, new_start);
4005 } else {
4006 UPB_ASSERT(overrun > e->limit);
4007 e->error = true;
4008 return callback(e, NULL, NULL);
4009 }
4010}
4011
4012typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc(
4013 upb_EpsCopyInputStream* e, const char* ptr, void* ctx);
4014
4015// Tries to perform a fast-path handling of the given delimited message data.
4016// If the sub-message beginning at `*ptr` and extending for `len` is short and
4017// fits within this buffer, calls `func` with `ctx` as a parameter, where the
4018// pushing and popping of limits is handled automatically and with lower cost
4019// than the normal PushLimit()/PopLimit() sequence.
4020static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
4021 upb_EpsCopyInputStream* e, const char** ptr, int len,
4022 upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
4023 if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) {
4024 return false;
4025 }
4026
4027 // Fast case: Sub-message is <128 bytes and fits in the current buffer.
4028 // This means we can preserve limit/limit_ptr verbatim.
4029 const char* saved_limit_ptr = e->limit_ptr;
4030 int saved_limit = e->limit;
4031 e->limit_ptr = *ptr + len;
4032 e->limit = e->limit_ptr - e->end;
4033 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4034 *ptr = func(e, *ptr, ctx);
4035 e->limit_ptr = saved_limit_ptr;
4036 e->limit = saved_limit;
4037 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4038 return true;
4039}
4040
4041#ifdef __cplusplus
4042} /* extern "C" */
4043#endif
4044
4045
4046#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4047
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00004048#ifndef UPB_BASE_INTERNAL_LOG2_H_
4049#define UPB_BASE_INTERNAL_LOG2_H_
4050
4051// Must be last.
4052
4053#ifdef __cplusplus
4054extern "C" {
4055#endif
4056
4057UPB_INLINE int upb_Log2Ceiling(int x) {
4058 if (x <= 1) return 0;
4059#ifdef __GNUC__
4060 return 32 - __builtin_clz(x - 1);
4061#else
4062 int lg2 = 0;
4063 while ((1 << lg2) < x) lg2++;
4064 return lg2;
4065#endif
4066}
4067
4068UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
4069
4070#ifdef __cplusplus
4071} /* extern "C" */
4072#endif
4073
4074
4075#endif /* UPB_BASE_INTERNAL_LOG2_H_ */
4076
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004077#ifndef UPB_HASH_INT_TABLE_H_
4078#define UPB_HASH_INT_TABLE_H_
4079
4080
4081// Must be last.
4082
4083typedef struct {
4084 upb_table t; // For entries that don't fit in the array part.
4085 const upb_tabval* array; // Array part of the table. See const note above.
4086 size_t array_size; // Array part size.
4087 size_t array_count; // Array part number of elements.
4088} upb_inttable;
4089
4090#ifdef __cplusplus
4091extern "C" {
4092#endif
4093
4094// Initialize a table. If memory allocation failed, false is returned and
4095// the table is uninitialized.
4096bool upb_inttable_init(upb_inttable* table, upb_Arena* a);
4097
4098// Returns the number of values in the table.
4099size_t upb_inttable_count(const upb_inttable* t);
4100
4101// Inserts the given key into the hashtable with the given value.
4102// The key must not already exist in the hash table.
4103// The value must not be UINTPTR_MAX.
4104//
4105// If a table resize was required but memory allocation failed, false is
4106// returned and the table is unchanged.
4107bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val,
4108 upb_Arena* a);
4109
4110// Looks up key in this table, returning "true" if the key was found.
4111// If v is non-NULL, copies the value for this key into *v.
4112bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v);
4113
4114// Removes an item from the table. Returns true if the remove was successful,
4115// and stores the removed item in *val if non-NULL.
4116bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val);
4117
4118// Updates an existing entry in an inttable.
4119// If the entry does not exist, returns false and does nothing.
4120// Unlike insert/remove, this does not invalidate iterators.
4121bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val);
4122
4123// Optimizes the table for the current set of entries, for both memory use and
4124// lookup time. Client should call this after all entries have been inserted;
4125// inserting more entries is legal, but will likely require a table resize.
4126void upb_inttable_compact(upb_inttable* t, upb_Arena* a);
4127
4128// Iteration over inttable:
4129//
4130// intptr_t iter = UPB_INTTABLE_BEGIN;
4131// uintptr_t key;
4132// upb_value val;
4133// while (upb_inttable_next(t, &key, &val, &iter)) {
4134// // ...
4135// }
4136
4137#define UPB_INTTABLE_BEGIN -1
4138
4139bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val,
4140 intptr_t* iter);
4141void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter);
4142
4143#ifdef __cplusplus
4144} /* extern "C" */
4145#endif
4146
4147
4148#endif /* UPB_HASH_INT_TABLE_H_ */
4149
4150#ifndef UPB_JSON_DECODE_H_
4151#define UPB_JSON_DECODE_H_
4152
4153
4154#ifndef UPB_REFLECTION_DEF_H_
4155#define UPB_REFLECTION_DEF_H_
4156
4157// IWYU pragma: begin_exports
4158
Protobuf Team Bot06310352023-09-26 21:54:58 +00004159// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004160
4161#ifndef UPB_REFLECTION_DEF_POOL_H_
4162#define UPB_REFLECTION_DEF_POOL_H_
4163
4164
Protobuf Team Bot06310352023-09-26 21:54:58 +00004165// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004166
4167// Declarations common to all public def types.
4168
4169#ifndef UPB_REFLECTION_COMMON_H_
4170#define UPB_REFLECTION_COMMON_H_
4171
4172// begin:google_only
4173// #ifndef UPB_BOOTSTRAP_STAGE0
4174// #include "net/proto2/proto/descriptor.upb.h"
4175// #else
4176// #include "google/protobuf/descriptor.upb.h"
4177// #endif
4178// end:google_only
4179
4180// begin:github_only
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00004181/* This file was generated by upb_generator from the input file:
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004182 *
4183 * google/protobuf/descriptor.proto
4184 *
4185 * Do not edit -- your changes will be discarded when the file is
4186 * regenerated. */
4187
Mike Kruskal9d435022023-07-11 12:45:07 -07004188#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
4189#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07004190
Protobuf Team Bot111d6552023-09-15 21:07:08 +00004191
4192
4193// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004194
4195#ifdef __cplusplus
4196extern "C" {
4197#endif
4198
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004199typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
4200typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
4201typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
4202typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
4203typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
4204typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
Mike Kruskal145900f2023-03-27 09:55:52 -07004205typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004206typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
4207typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
4208typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
4209typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
4210typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
4211typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
4212typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
4213typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
4214typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
4215typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004216typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004217typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
4218typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
4219typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
4220typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
4221typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
4222typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
4223typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004224typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet;
Mike Kruskalba964702023-08-22 17:37:48 -07004225typedef struct google_protobuf_FeatureSetDefaults google_protobuf_FeatureSetDefaults;
4226typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004227typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
4228typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
4229typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
4230typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004231
4232typedef enum {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004233 google_protobuf_EDITION_UNKNOWN = 0,
4234 google_protobuf_EDITION_1_TEST_ONLY = 1,
4235 google_protobuf_EDITION_2_TEST_ONLY = 2,
Protobuf Team Bot67038022023-10-04 04:14:37 +00004236 google_protobuf_EDITION_PROTO2 = 998,
4237 google_protobuf_EDITION_PROTO3 = 999,
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004238 google_protobuf_EDITION_2023 = 1000,
4239 google_protobuf_EDITION_99997_TEST_ONLY = 99997,
4240 google_protobuf_EDITION_99998_TEST_ONLY = 99998,
4241 google_protobuf_EDITION_99999_TEST_ONLY = 99999
4242} google_protobuf_Edition;
4243
4244typedef enum {
Protobuf Team Bot469f0272023-04-21 18:12:45 -07004245 google_protobuf_ExtensionRangeOptions_DECLARATION = 0,
4246 google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1
4247} google_protobuf_ExtensionRangeOptions_VerificationState;
4248
4249typedef enum {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004250 google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0,
4251 google_protobuf_FeatureSet_OPEN = 1,
4252 google_protobuf_FeatureSet_CLOSED = 2
4253} google_protobuf_FeatureSet_EnumType;
4254
4255typedef enum {
4256 google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0,
4257 google_protobuf_FeatureSet_EXPLICIT = 1,
4258 google_protobuf_FeatureSet_IMPLICIT = 2,
4259 google_protobuf_FeatureSet_LEGACY_REQUIRED = 3
4260} google_protobuf_FeatureSet_FieldPresence;
4261
4262typedef enum {
4263 google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0,
4264 google_protobuf_FeatureSet_ALLOW = 1,
4265 google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2
4266} google_protobuf_FeatureSet_JsonFormat;
4267
4268typedef enum {
4269 google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0,
4270 google_protobuf_FeatureSet_LENGTH_PREFIXED = 1,
4271 google_protobuf_FeatureSet_DELIMITED = 2
4272} google_protobuf_FeatureSet_MessageEncoding;
4273
4274typedef enum {
4275 google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0,
4276 google_protobuf_FeatureSet_PACKED = 1,
4277 google_protobuf_FeatureSet_EXPANDED = 2
4278} google_protobuf_FeatureSet_RepeatedFieldEncoding;
4279
4280typedef enum {
Protobuf Team Bot61127952023-09-26 20:07:33 +00004281 google_protobuf_FeatureSet_UTF8_VALIDATION_UNKNOWN = 0,
Protobuf Team Bot4b301ad2023-10-14 03:20:44 +00004282 google_protobuf_FeatureSet_NONE = 1,
Protobuf Team Bot61127952023-09-26 20:07:33 +00004283 google_protobuf_FeatureSet_VERIFY = 2
4284} google_protobuf_FeatureSet_Utf8Validation;
4285
4286typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004287 google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
4288 google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
4289 google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
4290} google_protobuf_FieldDescriptorProto_Label;
4291
4292typedef enum {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004293 google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
4294 google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
4295 google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
4296 google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
4297 google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
4298 google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
4299 google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
4300 google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
4301 google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
4302 google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
4303 google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
4304 google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
4305 google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
4306 google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
4307 google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
4308 google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
4309 google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
4310 google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
4311} google_protobuf_FieldDescriptorProto_Type;
4312
4313typedef enum {
4314 google_protobuf_FieldOptions_STRING = 0,
4315 google_protobuf_FieldOptions_CORD = 1,
4316 google_protobuf_FieldOptions_STRING_PIECE = 2
4317} google_protobuf_FieldOptions_CType;
4318
4319typedef enum {
4320 google_protobuf_FieldOptions_JS_NORMAL = 0,
4321 google_protobuf_FieldOptions_JS_STRING = 1,
4322 google_protobuf_FieldOptions_JS_NUMBER = 2
4323} google_protobuf_FieldOptions_JSType;
4324
4325typedef enum {
Adam Cozzette90ff32c2023-01-21 15:04:56 -08004326 google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0,
4327 google_protobuf_FieldOptions_RETENTION_RUNTIME = 1,
4328 google_protobuf_FieldOptions_RETENTION_SOURCE = 2
4329} google_protobuf_FieldOptions_OptionRetention;
4330
4331typedef enum {
4332 google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0,
4333 google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1,
4334 google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2,
4335 google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3,
4336 google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4,
4337 google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5,
4338 google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6,
4339 google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7,
4340 google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8,
4341 google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9
4342} google_protobuf_FieldOptions_OptionTargetType;
4343
4344typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004345 google_protobuf_FileOptions_SPEED = 1,
4346 google_protobuf_FileOptions_CODE_SIZE = 2,
4347 google_protobuf_FileOptions_LITE_RUNTIME = 3
4348} google_protobuf_FileOptions_OptimizeMode;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004349
4350typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004351 google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0,
4352 google_protobuf_GeneratedCodeInfo_Annotation_SET = 1,
4353 google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2
4354} google_protobuf_GeneratedCodeInfo_Annotation_Semantic;
4355
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004356typedef enum {
4357 google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
4358 google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
4359 google_protobuf_MethodOptions_IDEMPOTENT = 2
4360} google_protobuf_MethodOptions_IdempotencyLevel;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004361
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004362
Joshua Habermanf41049a2022-01-21 14:41:25 -08004363
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004364/* google.protobuf.FileDescriptorSet */
4365
Joshua Habermanf41049a2022-01-21 14:41:25 -08004366UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004367 return (google_protobuf_FileDescriptorSet*)_upb_Message_New(&google__protobuf__FileDescriptorSet_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004368}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004369UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) {
4370 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07004371 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004372 if (upb_Decode(buf, size, ret, &google__protobuf__FileDescriptorSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07004373 return NULL;
4374 }
4375 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004376}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004377UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size,
4378 const upb_ExtensionRegistry* extreg,
4379 int options, upb_Arena* arena) {
4380 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
4381 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004382 if (upb_Decode(buf, size, ret, &google__protobuf__FileDescriptorSet_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08004383 kUpb_DecodeStatus_Ok) {
4384 return NULL;
4385 }
4386 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004387}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004388UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004389 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004390 (void)upb_Encode(msg, &google__protobuf__FileDescriptorSet_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004391 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004392}
4393UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options,
4394 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004395 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004396 (void)upb_Encode(msg, &google__protobuf__FileDescriptorSet_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004397 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004398}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004399UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004400 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 -08004401 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004402}
Eric Salob7d54ac2022-12-29 11:59:42 -08004403UPB_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 -07004404 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 -08004405 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4406 if (arr) {
4407 if (size) *size = arr->size;
4408 return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr);
4409 } else {
4410 if (size) *size = 0;
4411 return NULL;
4412 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004413}
Deanna Garciab26afb52023-04-25 13:37:18 -07004414UPB_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 -07004415 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 -07004416 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4417 if (size) {
4418 *size = arr ? arr->size : 0;
4419 }
4420 return arr;
4421}
4422UPB_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 -07004423 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 -07004424 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4425 (upb_Message*)msg, &field, arena);
4426 if (size) {
4427 *size = arr ? arr->size : 0;
4428 }
4429 return arr;
4430}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004431UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) {
4432 size_t size;
4433 google_protobuf_FileDescriptorSet_file(msg, &size);
4434 return size != 0;
4435}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004436
Eric Salob7d54ac2022-12-29 11:59:42 -08004437UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004438 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 -08004439 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4440 if (arr) {
4441 if (size) *size = arr->size;
4442 return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr);
4443 } else {
4444 if (size) *size = 0;
4445 return NULL;
4446 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004447}
Eric Salob7d54ac2022-12-29 11:59:42 -08004448UPB_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 -07004449 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 -07004450 return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004451}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004452UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004453 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 -08004454 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4455 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4456 return NULL;
4457 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004458 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 -08004459 if (!arr || !sub) return NULL;
4460 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004461 return sub;
4462}
4463
4464/* google.protobuf.FileDescriptorProto */
4465
Joshua Habermanf41049a2022-01-21 14:41:25 -08004466UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004467 return (google_protobuf_FileDescriptorProto*)_upb_Message_New(&google__protobuf__FileDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004468}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004469UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
4470 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07004471 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004472 if (upb_Decode(buf, size, ret, &google__protobuf__FileDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07004473 return NULL;
4474 }
4475 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004476}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004477UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size,
4478 const upb_ExtensionRegistry* extreg,
4479 int options, upb_Arena* arena) {
4480 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
4481 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004482 if (upb_Decode(buf, size, ret, &google__protobuf__FileDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08004483 kUpb_DecodeStatus_Ok) {
4484 return NULL;
4485 }
4486 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004487}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004488UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004489 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004490 (void)upb_Encode(msg, &google__protobuf__FileDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004491 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004492}
4493UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options,
4494 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004495 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004496 (void)upb_Encode(msg, &google__protobuf__FileDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004497 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004498}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004499UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004500 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 -08004501 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004502}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004503UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004504 upb_StringView default_val = upb_StringView_FromString("");
4505 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004506 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 -08004507 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004508 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004509}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004510UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004511 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 -08004512 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004513}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004514UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004515 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 -08004516 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004517}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004518UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004519 upb_StringView default_val = upb_StringView_FromString("");
4520 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004521 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 -08004522 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004523 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004524}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004525UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004526 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 -08004527 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004528}
4529UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004530 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 -08004531 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004532}
Eric Salob7d54ac2022-12-29 11:59:42 -08004533UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004534 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 -08004535 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4536 if (arr) {
4537 if (size) *size = arr->size;
4538 return (upb_StringView const*)_upb_array_constptr(arr);
4539 } else {
4540 if (size) *size = 0;
4541 return NULL;
4542 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004543}
Deanna Garciab26afb52023-04-25 13:37:18 -07004544UPB_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 -07004545 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 -07004546 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4547 if (size) {
4548 *size = arr ? arr->size : 0;
4549 }
4550 return arr;
4551}
4552UPB_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 -07004553 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 -07004554 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4555 (upb_Message*)msg, &field, arena);
4556 if (size) {
4557 *size = arr ? arr->size : 0;
4558 }
4559 return arr;
4560}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004561UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) {
4562 size_t size;
4563 google_protobuf_FileDescriptorProto_dependency(msg, &size);
4564 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004565}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004566UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004567 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 -08004568 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004569}
Eric Salob7d54ac2022-12-29 11:59:42 -08004570UPB_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 -07004571 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 -08004572 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4573 if (arr) {
4574 if (size) *size = arr->size;
4575 return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr);
4576 } else {
4577 if (size) *size = 0;
4578 return NULL;
4579 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004580}
Deanna Garciab26afb52023-04-25 13:37:18 -07004581UPB_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 -07004582 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 -07004583 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4584 if (size) {
4585 *size = arr ? arr->size : 0;
4586 }
4587 return arr;
4588}
4589UPB_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 -07004590 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 -07004591 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4592 (upb_Message*)msg, &field, arena);
4593 if (size) {
4594 *size = arr ? arr->size : 0;
4595 }
4596 return arr;
4597}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004598UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) {
4599 size_t size;
4600 google_protobuf_FileDescriptorProto_message_type(msg, &size);
4601 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004602}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004603UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004604 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 -08004605 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004606}
Eric Salob7d54ac2022-12-29 11:59:42 -08004607UPB_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 -07004608 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 -08004609 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4610 if (arr) {
4611 if (size) *size = arr->size;
4612 return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr);
4613 } else {
4614 if (size) *size = 0;
4615 return NULL;
4616 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004617}
Deanna Garciab26afb52023-04-25 13:37:18 -07004618UPB_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 -07004619 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 -07004620 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4621 if (size) {
4622 *size = arr ? arr->size : 0;
4623 }
4624 return arr;
4625}
4626UPB_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 -07004627 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 -07004628 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4629 (upb_Message*)msg, &field, arena);
4630 if (size) {
4631 *size = arr ? arr->size : 0;
4632 }
4633 return arr;
4634}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004635UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) {
4636 size_t size;
4637 google_protobuf_FileDescriptorProto_enum_type(msg, &size);
4638 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004639}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004640UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004641 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 -08004642 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004643}
Eric Salob7d54ac2022-12-29 11:59:42 -08004644UPB_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 -07004645 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 -08004646 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4647 if (arr) {
4648 if (size) *size = arr->size;
4649 return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr);
4650 } else {
4651 if (size) *size = 0;
4652 return NULL;
4653 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004654}
Deanna Garciab26afb52023-04-25 13:37:18 -07004655UPB_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 -07004656 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 -07004657 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4658 if (size) {
4659 *size = arr ? arr->size : 0;
4660 }
4661 return arr;
4662}
4663UPB_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 -07004664 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 -07004665 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4666 (upb_Message*)msg, &field, arena);
4667 if (size) {
4668 *size = arr ? arr->size : 0;
4669 }
4670 return arr;
4671}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004672UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) {
4673 size_t size;
4674 google_protobuf_FileDescriptorProto_service(msg, &size);
4675 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004676}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004677UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004678 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 -08004679 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004680}
Eric Salob7d54ac2022-12-29 11:59:42 -08004681UPB_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 -07004682 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 -08004683 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4684 if (arr) {
4685 if (size) *size = arr->size;
4686 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
4687 } else {
4688 if (size) *size = 0;
4689 return NULL;
4690 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004691}
Deanna Garciab26afb52023-04-25 13:37:18 -07004692UPB_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 -07004693 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 -07004694 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4695 if (size) {
4696 *size = arr ? arr->size : 0;
4697 }
4698 return arr;
4699}
4700UPB_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 -07004701 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 -07004702 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4703 (upb_Message*)msg, &field, arena);
4704 if (size) {
4705 *size = arr ? arr->size : 0;
4706 }
4707 return arr;
4708}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004709UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) {
4710 size_t size;
4711 google_protobuf_FileDescriptorProto_extension(msg, &size);
4712 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004713}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004714UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004715 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 -08004716 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004717}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004718UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004719 const google_protobuf_FileOptions* default_val = NULL;
4720 const google_protobuf_FileOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004721 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 -08004722 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004723 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004724}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004725UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004726 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 -08004727 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004728}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004729UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004730 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 -08004731 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004732}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004733UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004734 const google_protobuf_SourceCodeInfo* default_val = NULL;
4735 const google_protobuf_SourceCodeInfo* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004736 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 -08004737 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004738 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004739}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004740UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004741 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 -08004742 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004743}
4744UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004745 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 -08004746 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08004747}
Eric Salob7d54ac2022-12-29 11:59:42 -08004748UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004749 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 -08004750 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4751 if (arr) {
4752 if (size) *size = arr->size;
4753 return (int32_t const*)_upb_array_constptr(arr);
4754 } else {
4755 if (size) *size = 0;
4756 return NULL;
4757 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004758}
Deanna Garciab26afb52023-04-25 13:37:18 -07004759UPB_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 -07004760 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 -07004761 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4762 if (size) {
4763 *size = arr ? arr->size : 0;
4764 }
4765 return arr;
4766}
4767UPB_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 -07004768 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 -07004769 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4770 (upb_Message*)msg, &field, arena);
4771 if (size) {
4772 *size = arr ? arr->size : 0;
4773 }
4774 return arr;
4775}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004776UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) {
4777 size_t size;
4778 google_protobuf_FileDescriptorProto_public_dependency(msg, &size);
4779 return size != 0;
4780}
4781UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004782 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 -08004783 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004784}
Eric Salob7d54ac2022-12-29 11:59:42 -08004785UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004786 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 -08004787 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4788 if (arr) {
4789 if (size) *size = arr->size;
4790 return (int32_t const*)_upb_array_constptr(arr);
4791 } else {
4792 if (size) *size = 0;
4793 return NULL;
4794 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004795}
Deanna Garciab26afb52023-04-25 13:37:18 -07004796UPB_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 -07004797 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 -07004798 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4799 if (size) {
4800 *size = arr ? arr->size : 0;
4801 }
4802 return arr;
4803}
4804UPB_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 -07004805 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 -07004806 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4807 (upb_Message*)msg, &field, arena);
4808 if (size) {
4809 *size = arr ? arr->size : 0;
4810 }
4811 return arr;
4812}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004813UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) {
4814 size_t size;
4815 google_protobuf_FileDescriptorProto_weak_dependency(msg, &size);
4816 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004817}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004818UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004819 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 -08004820 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004821}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004822UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004823 upb_StringView default_val = upb_StringView_FromString("");
4824 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004825 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 -08004826 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004827 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004828}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004829UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004830 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 -08004831 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004832}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004833UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00004834 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004835 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004836}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00004837UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) {
4838 int32_t default_val = 0;
4839 int32_t ret;
4840 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004841 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004842 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004843}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004844UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00004845 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004846 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004847}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004848
Joshua Habermanf41049a2022-01-21 14:41:25 -08004849UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004850 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 -08004851 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004852}
4853UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004854 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 -08004855 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004856}
4857UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004858 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 -08004859 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4860 if (arr) {
4861 if (size) *size = arr->size;
4862 return (upb_StringView*)_upb_array_ptr(arr);
4863 } else {
4864 if (size) *size = 0;
4865 return NULL;
4866 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004867}
Eric Salob7d54ac2022-12-29 11:59:42 -08004868UPB_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 -07004869 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 -07004870 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004871}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004872UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004873 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 -08004874 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4875 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4876 return false;
4877 }
4878 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
4879 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004880}
Eric Salob7d54ac2022-12-29 11:59:42 -08004881UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004882 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 -08004883 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4884 if (arr) {
4885 if (size) *size = arr->size;
4886 return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr);
4887 } else {
4888 if (size) *size = 0;
4889 return NULL;
4890 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004891}
Eric Salob7d54ac2022-12-29 11:59:42 -08004892UPB_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 -07004893 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 -07004894 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004895}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004896UPB_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 -07004897 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 -08004898 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4899 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4900 return NULL;
4901 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004902 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 -08004903 if (!arr || !sub) return NULL;
4904 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004905 return sub;
4906}
Eric Salob7d54ac2022-12-29 11:59:42 -08004907UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004908 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 -08004909 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4910 if (arr) {
4911 if (size) *size = arr->size;
4912 return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr);
4913 } else {
4914 if (size) *size = 0;
4915 return NULL;
4916 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004917}
Eric Salob7d54ac2022-12-29 11:59:42 -08004918UPB_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 -07004919 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 -07004920 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004921}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004922UPB_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 -07004923 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 -08004924 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4925 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4926 return NULL;
4927 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004928 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 -08004929 if (!arr || !sub) return NULL;
4930 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004931 return sub;
4932}
Eric Salob7d54ac2022-12-29 11:59:42 -08004933UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004934 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 -08004935 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4936 if (arr) {
4937 if (size) *size = arr->size;
4938 return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr);
4939 } else {
4940 if (size) *size = 0;
4941 return NULL;
4942 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004943}
Eric Salob7d54ac2022-12-29 11:59:42 -08004944UPB_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 -07004945 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 -07004946 return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004947}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004948UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004949 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 -08004950 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4951 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4952 return NULL;
4953 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004954 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 -08004955 if (!arr || !sub) return NULL;
4956 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004957 return sub;
4958}
Eric Salob7d54ac2022-12-29 11:59:42 -08004959UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004960 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 -08004961 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4962 if (arr) {
4963 if (size) *size = arr->size;
4964 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
4965 } else {
4966 if (size) *size = 0;
4967 return NULL;
4968 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004969}
Eric Salob7d54ac2022-12-29 11:59:42 -08004970UPB_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 -07004971 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 -07004972 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004973}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004974UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004975 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 -08004976 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4977 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4978 return NULL;
4979 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004980 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 -08004981 if (!arr || !sub) return NULL;
4982 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004983 return sub;
4984}
4985UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07004986 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 -08004987 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004988}
4989UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004990 struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
4991 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004992 sub = (struct google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08004993 if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004994 }
4995 return sub;
4996}
4997UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
Jie Luo3560e232023-06-12 00:33:50 -07004998 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 -08004999 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005000}
5001UPB_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 -08005002 struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
5003 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005004 sub = (struct google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005005 if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005006 }
5007 return sub;
5008}
Eric Salob7d54ac2022-12-29 11:59:42 -08005009UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005010 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 -08005011 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5012 if (arr) {
5013 if (size) *size = arr->size;
5014 return (int32_t*)_upb_array_ptr(arr);
5015 } else {
5016 if (size) *size = 0;
5017 return NULL;
5018 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005019}
Eric Salob7d54ac2022-12-29 11:59:42 -08005020UPB_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 -07005021 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 -07005022 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005023}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005024UPB_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 -07005025 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 -08005026 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5027 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5028 return false;
5029 }
5030 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5031 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005032}
Eric Salob7d54ac2022-12-29 11:59:42 -08005033UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005034 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 -08005035 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5036 if (arr) {
5037 if (size) *size = arr->size;
5038 return (int32_t*)_upb_array_ptr(arr);
5039 } else {
5040 if (size) *size = 0;
5041 return NULL;
5042 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005043}
Eric Salob7d54ac2022-12-29 11:59:42 -08005044UPB_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 -07005045 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 -07005046 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005047}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005048UPB_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 -07005049 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 -08005050 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5051 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5052 return false;
5053 }
5054 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5055 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005056}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005057UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00005058 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 -08005059 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005060}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00005061UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) {
5062 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005063 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005064}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005065
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005066/* google.protobuf.DescriptorProto */
5067
Joshua Habermanf41049a2022-01-21 14:41:25 -08005068UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005069 return (google_protobuf_DescriptorProto*)_upb_Message_New(&google__protobuf__DescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005070}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005071UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5072 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005073 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005074 if (upb_Decode(buf, size, ret, &google__protobuf__DescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005075 return NULL;
5076 }
5077 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005078}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005079UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size,
5080 const upb_ExtensionRegistry* extreg,
5081 int options, upb_Arena* arena) {
5082 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
5083 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005084 if (upb_Decode(buf, size, ret, &google__protobuf__DescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005085 kUpb_DecodeStatus_Ok) {
5086 return NULL;
5087 }
5088 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005089}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005090UPB_INLINE char* google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005091 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005092 (void)upb_Encode(msg, &google__protobuf__DescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005093 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005094}
5095UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options,
5096 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005097 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005098 (void)upb_Encode(msg, &google__protobuf__DescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005099 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005100}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005101UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005102 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 -08005103 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005104}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005105UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005106 upb_StringView default_val = upb_StringView_FromString("");
5107 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005108 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 -08005109 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005110 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005111}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005112UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005113 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 -08005114 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005115}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005116UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005117 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 -08005118 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005119}
Eric Salob7d54ac2022-12-29 11:59:42 -08005120UPB_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 -07005121 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 -08005122 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5123 if (arr) {
5124 if (size) *size = arr->size;
5125 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
5126 } else {
5127 if (size) *size = 0;
5128 return NULL;
5129 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005130}
Deanna Garciab26afb52023-04-25 13:37:18 -07005131UPB_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 -07005132 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 -07005133 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5134 if (size) {
5135 *size = arr ? arr->size : 0;
5136 }
5137 return arr;
5138}
5139UPB_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 -07005140 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 -07005141 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5142 (upb_Message*)msg, &field, arena);
5143 if (size) {
5144 *size = arr ? arr->size : 0;
5145 }
5146 return arr;
5147}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005148UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) {
5149 size_t size;
5150 google_protobuf_DescriptorProto_field(msg, &size);
5151 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005152}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005153UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005154 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 -08005155 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005156}
Eric Salob7d54ac2022-12-29 11:59:42 -08005157UPB_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 -07005158 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 -08005159 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5160 if (arr) {
5161 if (size) *size = arr->size;
5162 return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr);
5163 } else {
5164 if (size) *size = 0;
5165 return NULL;
5166 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005167}
Deanna Garciab26afb52023-04-25 13:37:18 -07005168UPB_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 -07005169 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 -07005170 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5171 if (size) {
5172 *size = arr ? arr->size : 0;
5173 }
5174 return arr;
5175}
5176UPB_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 -07005177 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 -07005178 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5179 (upb_Message*)msg, &field, arena);
5180 if (size) {
5181 *size = arr ? arr->size : 0;
5182 }
5183 return arr;
5184}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005185UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) {
5186 size_t size;
5187 google_protobuf_DescriptorProto_nested_type(msg, &size);
5188 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005189}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005190UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005191 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 -08005192 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005193}
Eric Salob7d54ac2022-12-29 11:59:42 -08005194UPB_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 -07005195 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 -08005196 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5197 if (arr) {
5198 if (size) *size = arr->size;
5199 return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr);
5200 } else {
5201 if (size) *size = 0;
5202 return NULL;
5203 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005204}
Deanna Garciab26afb52023-04-25 13:37:18 -07005205UPB_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 -07005206 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 -07005207 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5208 if (size) {
5209 *size = arr ? arr->size : 0;
5210 }
5211 return arr;
5212}
5213UPB_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 -07005214 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 -07005215 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5216 (upb_Message*)msg, &field, arena);
5217 if (size) {
5218 *size = arr ? arr->size : 0;
5219 }
5220 return arr;
5221}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005222UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) {
5223 size_t size;
5224 google_protobuf_DescriptorProto_enum_type(msg, &size);
5225 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005226}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005227UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005228 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 -08005229 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005230}
Eric Salob7d54ac2022-12-29 11:59:42 -08005231UPB_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 -07005232 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 -08005233 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5234 if (arr) {
5235 if (size) *size = arr->size;
5236 return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr);
5237 } else {
5238 if (size) *size = 0;
5239 return NULL;
5240 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005241}
Deanna Garciab26afb52023-04-25 13:37:18 -07005242UPB_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 -07005243 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 -07005244 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5245 if (size) {
5246 *size = arr ? arr->size : 0;
5247 }
5248 return arr;
5249}
5250UPB_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 -07005251 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 -07005252 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5253 (upb_Message*)msg, &field, arena);
5254 if (size) {
5255 *size = arr ? arr->size : 0;
5256 }
5257 return arr;
5258}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005259UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) {
5260 size_t size;
5261 google_protobuf_DescriptorProto_extension_range(msg, &size);
5262 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005263}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005264UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005265 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 -08005266 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005267}
Eric Salob7d54ac2022-12-29 11:59:42 -08005268UPB_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 -07005269 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 -08005270 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5271 if (arr) {
5272 if (size) *size = arr->size;
5273 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
5274 } else {
5275 if (size) *size = 0;
5276 return NULL;
5277 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005278}
Deanna Garciab26afb52023-04-25 13:37:18 -07005279UPB_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 -07005280 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 -07005281 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5282 if (size) {
5283 *size = arr ? arr->size : 0;
5284 }
5285 return arr;
5286}
5287UPB_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 -07005288 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 -07005289 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5290 (upb_Message*)msg, &field, arena);
5291 if (size) {
5292 *size = arr ? arr->size : 0;
5293 }
5294 return arr;
5295}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005296UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) {
5297 size_t size;
5298 google_protobuf_DescriptorProto_extension(msg, &size);
5299 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005300}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005301UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005302 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 -08005303 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005304}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005305UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005306 const google_protobuf_MessageOptions* default_val = NULL;
5307 const google_protobuf_MessageOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07005308 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 -08005309 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005310 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005311}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005312UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005313 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 -08005314 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005315}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005316UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005317 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 -08005318 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005319}
Eric Salob7d54ac2022-12-29 11:59:42 -08005320UPB_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 -07005321 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 -08005322 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5323 if (arr) {
5324 if (size) *size = arr->size;
5325 return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr);
5326 } else {
5327 if (size) *size = 0;
5328 return NULL;
5329 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005330}
Deanna Garciab26afb52023-04-25 13:37:18 -07005331UPB_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 -07005332 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 -07005333 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5334 if (size) {
5335 *size = arr ? arr->size : 0;
5336 }
5337 return arr;
5338}
5339UPB_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 -07005340 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 -07005341 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5342 (upb_Message*)msg, &field, arena);
5343 if (size) {
5344 *size = arr ? arr->size : 0;
5345 }
5346 return arr;
5347}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005348UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) {
5349 size_t size;
5350 google_protobuf_DescriptorProto_oneof_decl(msg, &size);
5351 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005352}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005353UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005354 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 -08005355 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005356}
Eric Salob7d54ac2022-12-29 11:59:42 -08005357UPB_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 -07005358 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 -08005359 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5360 if (arr) {
5361 if (size) *size = arr->size;
5362 return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr);
5363 } else {
5364 if (size) *size = 0;
5365 return NULL;
5366 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005367}
Deanna Garciab26afb52023-04-25 13:37:18 -07005368UPB_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 -07005369 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 -07005370 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5371 if (size) {
5372 *size = arr ? arr->size : 0;
5373 }
5374 return arr;
5375}
5376UPB_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 -07005377 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 -07005378 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5379 (upb_Message*)msg, &field, arena);
5380 if (size) {
5381 *size = arr ? arr->size : 0;
5382 }
5383 return arr;
5384}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005385UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) {
5386 size_t size;
5387 google_protobuf_DescriptorProto_reserved_range(msg, &size);
5388 return size != 0;
5389}
5390UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005391 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 -08005392 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005393}
Eric Salob7d54ac2022-12-29 11:59:42 -08005394UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005395 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 -08005396 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5397 if (arr) {
5398 if (size) *size = arr->size;
5399 return (upb_StringView const*)_upb_array_constptr(arr);
5400 } else {
5401 if (size) *size = 0;
5402 return NULL;
5403 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005404}
Deanna Garciab26afb52023-04-25 13:37:18 -07005405UPB_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 -07005406 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 -07005407 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5408 if (size) {
5409 *size = arr ? arr->size : 0;
5410 }
5411 return arr;
5412}
5413UPB_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 -07005414 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 -07005415 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5416 (upb_Message*)msg, &field, arena);
5417 if (size) {
5418 *size = arr ? arr->size : 0;
5419 }
5420 return arr;
5421}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005422UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) {
5423 size_t size;
5424 google_protobuf_DescriptorProto_reserved_name(msg, &size);
5425 return size != 0;
5426}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005427
Joshua Habermanf41049a2022-01-21 14:41:25 -08005428UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005429 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 -08005430 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005431}
5432UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005433 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 -08005434 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5435 if (arr) {
5436 if (size) *size = arr->size;
5437 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5438 } else {
5439 if (size) *size = 0;
5440 return NULL;
5441 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005442}
Eric Salob7d54ac2022-12-29 11:59:42 -08005443UPB_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 -07005444 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 -07005445 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005446}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005447UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005448 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 -08005449 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5450 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5451 return NULL;
5452 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005453 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 -08005454 if (!arr || !sub) return NULL;
5455 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005456 return sub;
5457}
Eric Salob7d54ac2022-12-29 11:59:42 -08005458UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005459 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 -08005460 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5461 if (arr) {
5462 if (size) *size = arr->size;
5463 return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr);
5464 } else {
5465 if (size) *size = 0;
5466 return NULL;
5467 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005468}
Eric Salob7d54ac2022-12-29 11:59:42 -08005469UPB_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 -07005470 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 -07005471 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005472}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005473UPB_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 -07005474 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 -08005475 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5476 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5477 return NULL;
5478 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005479 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 -08005480 if (!arr || !sub) return NULL;
5481 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005482 return sub;
5483}
Eric Salob7d54ac2022-12-29 11:59:42 -08005484UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005485 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 -08005486 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5487 if (arr) {
5488 if (size) *size = arr->size;
5489 return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr);
5490 } else {
5491 if (size) *size = 0;
5492 return NULL;
5493 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005494}
Eric Salob7d54ac2022-12-29 11:59:42 -08005495UPB_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 -07005496 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 -07005497 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005498}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005499UPB_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 -07005500 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 -08005501 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5502 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5503 return NULL;
5504 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005505 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 -08005506 if (!arr || !sub) return NULL;
5507 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005508 return sub;
5509}
Eric Salob7d54ac2022-12-29 11:59:42 -08005510UPB_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 -07005511 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 -08005512 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5513 if (arr) {
5514 if (size) *size = arr->size;
5515 return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr);
5516 } else {
5517 if (size) *size = 0;
5518 return NULL;
5519 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005520}
Eric Salob7d54ac2022-12-29 11:59:42 -08005521UPB_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 -07005522 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 -07005523 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005524}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005525UPB_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 -07005526 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 -08005527 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5528 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5529 return NULL;
5530 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005531 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 -08005532 if (!arr || !sub) return NULL;
5533 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005534 return sub;
5535}
Eric Salob7d54ac2022-12-29 11:59:42 -08005536UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005537 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 -08005538 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5539 if (arr) {
5540 if (size) *size = arr->size;
5541 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5542 } else {
5543 if (size) *size = 0;
5544 return NULL;
5545 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005546}
Eric Salob7d54ac2022-12-29 11:59:42 -08005547UPB_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 -07005548 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 -07005549 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005550}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005551UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005552 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 -08005553 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5554 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5555 return NULL;
5556 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005557 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 -08005558 if (!arr || !sub) return NULL;
5559 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005560 return sub;
5561}
5562UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005563 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 -08005564 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005565}
5566UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005567 struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
5568 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005569 sub = (struct google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005570 if (sub) google_protobuf_DescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005571 }
5572 return sub;
5573}
Eric Salob7d54ac2022-12-29 11:59:42 -08005574UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005575 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 -08005576 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5577 if (arr) {
5578 if (size) *size = arr->size;
5579 return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr);
5580 } else {
5581 if (size) *size = 0;
5582 return NULL;
5583 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005584}
Eric Salob7d54ac2022-12-29 11:59:42 -08005585UPB_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 -07005586 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 -07005587 return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005588}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005589UPB_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 -07005590 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 -08005591 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5592 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5593 return NULL;
5594 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005595 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 -08005596 if (!arr || !sub) return NULL;
5597 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005598 return sub;
5599}
Eric Salob7d54ac2022-12-29 11:59:42 -08005600UPB_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 -07005601 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 -08005602 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5603 if (arr) {
5604 if (size) *size = arr->size;
5605 return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr);
5606 } else {
5607 if (size) *size = 0;
5608 return NULL;
5609 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005610}
Eric Salob7d54ac2022-12-29 11:59:42 -08005611UPB_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 -07005612 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 -07005613 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005614}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005615UPB_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 -07005616 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 -08005617 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5618 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5619 return NULL;
5620 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005621 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 -08005622 if (!arr || !sub) return NULL;
5623 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005624 return sub;
5625}
Eric Salob7d54ac2022-12-29 11:59:42 -08005626UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005627 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 -08005628 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5629 if (arr) {
5630 if (size) *size = arr->size;
5631 return (upb_StringView*)_upb_array_ptr(arr);
5632 } else {
5633 if (size) *size = 0;
5634 return NULL;
5635 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005636}
Eric Salob7d54ac2022-12-29 11:59:42 -08005637UPB_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 -07005638 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 -07005639 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005640}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005641UPB_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 -07005642 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 -08005643 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5644 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5645 return false;
5646 }
5647 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5648 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005649}
5650
5651/* google.protobuf.DescriptorProto.ExtensionRange */
5652
Joshua Habermanf41049a2022-01-21 14:41:25 -08005653UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005654 return (google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ExtensionRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005655}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005656UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) {
5657 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005658 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005659 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 -07005660 return NULL;
5661 }
5662 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005663}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005664UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size,
5665 const upb_ExtensionRegistry* extreg,
5666 int options, upb_Arena* arena) {
5667 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
5668 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005669 if (upb_Decode(buf, size, ret, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005670 kUpb_DecodeStatus_Ok) {
5671 return NULL;
5672 }
5673 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005674}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005675UPB_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 -07005676 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005677 (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005678 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005679}
5680UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options,
5681 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005682 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005683 (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005684 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005685}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005686UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005687 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 -08005688 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005689}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005690UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005691 int32_t default_val = (int32_t)0;
5692 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005693 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 -08005694 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005695 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005696}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005697UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005698 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 -08005699 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005700}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005701UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005702 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 -08005703 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005704}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005705UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005706 int32_t default_val = (int32_t)0;
5707 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005708 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 -08005709 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005710 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005711}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005712UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005713 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 -08005714 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005715}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005716UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005717 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 -08005718 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005719}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005720UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005721 const google_protobuf_ExtensionRangeOptions* default_val = NULL;
5722 const google_protobuf_ExtensionRangeOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07005723 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 -08005724 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005725 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005726}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005727UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005728 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 -08005729 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005730}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005731
5732UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005733 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 -08005734 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005735}
5736UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005737 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 -08005738 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005739}
5740UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005741 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 -08005742 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005743}
5744UPB_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 -08005745 struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
5746 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005747 sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005748 if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005749 }
5750 return sub;
5751}
5752
5753/* google.protobuf.DescriptorProto.ReservedRange */
5754
Joshua Habermanf41049a2022-01-21 14:41:25 -08005755UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005756 return (google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005757}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005758UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
5759 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005760 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005761 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 -07005762 return NULL;
5763 }
5764 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005765}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005766UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size,
5767 const upb_ExtensionRegistry* extreg,
5768 int options, upb_Arena* arena) {
5769 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
5770 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005771 if (upb_Decode(buf, size, ret, &google__protobuf__DescriptorProto__ReservedRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005772 kUpb_DecodeStatus_Ok) {
5773 return NULL;
5774 }
5775 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005776}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005777UPB_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 -07005778 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005779 (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005780 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005781}
5782UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options,
5783 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005784 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005785 (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005786 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005787}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005788UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005789 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 -08005790 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005791}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005792UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005793 int32_t default_val = (int32_t)0;
5794 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005795 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 -08005796 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005797 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005798}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005799UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005800 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 -08005801 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005802}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005803UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005804 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 -08005805 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005806}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005807UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005808 int32_t default_val = (int32_t)0;
5809 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005810 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 -08005811 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005812 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005813}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005814UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005815 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 -08005816 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005817}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005818
5819UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005820 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 -08005821 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005822}
5823UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005824 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 -08005825 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005826}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005827
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005828/* google.protobuf.ExtensionRangeOptions */
5829
Joshua Habermanf41049a2022-01-21 14:41:25 -08005830UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005831 return (google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005832}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005833UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
5834 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005835 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005836 if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005837 return NULL;
5838 }
5839 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005840}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005841UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size,
5842 const upb_ExtensionRegistry* extreg,
5843 int options, upb_Arena* arena) {
5844 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
5845 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005846 if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005847 kUpb_DecodeStatus_Ok) {
5848 return NULL;
5849 }
5850 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005851}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005852UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005853 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005854 (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005855 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005856}
5857UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options,
5858 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005859 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005860 (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005861 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005862}
Mike Kruskal145900f2023-03-27 09:55:52 -07005863UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005864 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 -07005865 _upb_Message_ClearNonExtensionField(msg, &field);
5866}
5867UPB_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 -07005868 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 -07005869 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5870 if (arr) {
5871 if (size) *size = arr->size;
5872 return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr);
5873 } else {
5874 if (size) *size = 0;
5875 return NULL;
5876 }
5877}
Deanna Garciab26afb52023-04-25 13:37:18 -07005878UPB_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 -07005879 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 -07005880 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5881 if (size) {
5882 *size = arr ? arr->size : 0;
5883 }
5884 return arr;
5885}
5886UPB_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 -07005887 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 -07005888 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5889 (upb_Message*)msg, &field, arena);
5890 if (size) {
5891 *size = arr ? arr->size : 0;
5892 }
5893 return arr;
5894}
Mike Kruskal145900f2023-03-27 09:55:52 -07005895UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) {
5896 size_t size;
5897 google_protobuf_ExtensionRangeOptions_declaration(msg, &size);
5898 return size != 0;
5899}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005900UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005901 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 -07005902 _upb_Message_ClearNonExtensionField(msg, &field);
5903}
5904UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) {
5905 int32_t default_val = 1;
5906 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005907 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 -07005908 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5909 return ret;
5910}
5911UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005912 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5913 return _upb_Message_HasNonExtensionField(msg, &field);
5914}
5915UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) {
5916 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)};
5917 _upb_Message_ClearNonExtensionField(msg, &field);
5918}
5919UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) {
5920 const google_protobuf_FeatureSet* default_val = NULL;
5921 const google_protobuf_FeatureSet* ret;
5922 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)};
5923 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5924 return ret;
5925}
5926UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) {
5927 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 -07005928 return _upb_Message_HasNonExtensionField(msg, &field);
5929}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005930UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005931 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 -08005932 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005933}
Eric Salob7d54ac2022-12-29 11:59:42 -08005934UPB_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 -07005935 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 -08005936 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5937 if (arr) {
5938 if (size) *size = arr->size;
5939 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
5940 } else {
5941 if (size) *size = 0;
5942 return NULL;
5943 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005944}
Deanna Garciab26afb52023-04-25 13:37:18 -07005945UPB_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 -07005946 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 -07005947 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5948 if (size) {
5949 *size = arr ? arr->size : 0;
5950 }
5951 return arr;
5952}
5953UPB_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 -07005954 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 -07005955 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5956 (upb_Message*)msg, &field, arena);
5957 if (size) {
5958 *size = arr ? arr->size : 0;
5959 }
5960 return arr;
5961}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005962UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) {
5963 size_t size;
5964 google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size);
5965 return size != 0;
5966}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005967
Mike Kruskal145900f2023-03-27 09:55:52 -07005968UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_mutable_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005969 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 -07005970 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5971 if (arr) {
5972 if (size) *size = arr->size;
5973 return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr);
5974 } else {
5975 if (size) *size = 0;
5976 return NULL;
5977 }
5978}
5979UPB_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 -07005980 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 -07005981 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07005982}
5983UPB_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 -07005984 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 -07005985 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5986 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5987 return NULL;
5988 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005989 struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07005990 if (!arr || !sub) return NULL;
5991 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
5992 return sub;
5993}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005994UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005995 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 -07005996 _upb_Message_SetNonExtensionField(msg, &field, &value);
5997}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005998UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) {
5999 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)};
6000 _upb_Message_SetNonExtensionField(msg, &field, &value);
6001}
6002UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
6003 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg);
6004 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006005 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006006 if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub);
6007 }
6008 return sub;
6009}
Eric Salob7d54ac2022-12-29 11:59:42 -08006010UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006011 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 -08006012 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6013 if (arr) {
6014 if (size) *size = arr->size;
6015 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
6016 } else {
6017 if (size) *size = 0;
6018 return NULL;
6019 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006020}
Eric Salob7d54ac2022-12-29 11:59:42 -08006021UPB_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 -07006022 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 -07006023 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006024}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006025UPB_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 -07006026 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 -08006027 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6028 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6029 return NULL;
6030 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006031 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 -08006032 if (!arr || !sub) return NULL;
6033 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006034 return sub;
6035}
6036
Mike Kruskal145900f2023-03-27 09:55:52 -07006037/* google.protobuf.ExtensionRangeOptions.Declaration */
6038
6039UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006040 return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006041}
6042UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) {
6043 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6044 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006045 if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006046 return NULL;
6047 }
6048 return ret;
6049}
6050UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size,
6051 const upb_ExtensionRegistry* extreg,
6052 int options, upb_Arena* arena) {
6053 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6054 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006055 if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, extreg, options, arena) !=
Mike Kruskal145900f2023-03-27 09:55:52 -07006056 kUpb_DecodeStatus_Ok) {
6057 return NULL;
6058 }
6059 return ret;
6060}
6061UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) {
6062 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006063 (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, 0, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006064 return ptr;
6065}
6066UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options,
6067 upb_Arena* arena, size_t* len) {
6068 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006069 (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, options, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006070 return ptr;
6071}
6072UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006073 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 -07006074 _upb_Message_ClearNonExtensionField(msg, &field);
6075}
6076UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6077 int32_t default_val = (int32_t)0;
6078 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006079 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 -07006080 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6081 return ret;
6082}
6083UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006084 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 -07006085 return _upb_Message_HasNonExtensionField(msg, &field);
6086}
6087UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006088 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 -07006089 _upb_Message_ClearNonExtensionField(msg, &field);
6090}
6091UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6092 upb_StringView default_val = upb_StringView_FromString("");
6093 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006094 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 -07006095 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6096 return ret;
6097}
6098UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006099 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 -07006100 return _upb_Message_HasNonExtensionField(msg, &field);
6101}
6102UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006103 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 -07006104 _upb_Message_ClearNonExtensionField(msg, &field);
6105}
6106UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6107 upb_StringView default_val = upb_StringView_FromString("");
6108 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006109 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 -07006110 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6111 return ret;
6112}
6113UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006114 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 -07006115 return _upb_Message_HasNonExtensionField(msg, &field);
6116}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006117UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006118 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 -07006119 _upb_Message_ClearNonExtensionField(msg, &field);
6120}
6121UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6122 bool default_val = false;
6123 bool ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07006124 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 -07006125 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6126 return ret;
6127}
6128UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006129 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 -07006130 return _upb_Message_HasNonExtensionField(msg, &field);
6131}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006132UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006133 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 -07006134 _upb_Message_ClearNonExtensionField(msg, &field);
6135}
6136UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6137 bool default_val = false;
6138 bool ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07006139 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 -07006140 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6141 return ret;
6142}
6143UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006144 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 -07006145 return _upb_Message_HasNonExtensionField(msg, &field);
6146}
Mike Kruskal145900f2023-03-27 09:55:52 -07006147
6148UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006149 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 -07006150 _upb_Message_SetNonExtensionField(msg, &field, &value);
6151}
6152UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006153 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 -07006154 _upb_Message_SetNonExtensionField(msg, &field, &value);
6155}
6156UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006157 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 -07006158 _upb_Message_SetNonExtensionField(msg, &field, &value);
6159}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006160UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006161 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 -07006162 _upb_Message_SetNonExtensionField(msg, &field, &value);
6163}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006164UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006165 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 -07006166 _upb_Message_SetNonExtensionField(msg, &field, &value);
6167}
Mike Kruskal145900f2023-03-27 09:55:52 -07006168
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006169/* google.protobuf.FieldDescriptorProto */
6170
Joshua Habermanf41049a2022-01-21 14:41:25 -08006171UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006172 return (google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google__protobuf__FieldDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006173}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006174UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6175 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006176 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006177 if (upb_Decode(buf, size, ret, &google__protobuf__FieldDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006178 return NULL;
6179 }
6180 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006181}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006182UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size,
6183 const upb_ExtensionRegistry* extreg,
6184 int options, upb_Arena* arena) {
6185 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
6186 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006187 if (upb_Decode(buf, size, ret, &google__protobuf__FieldDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006188 kUpb_DecodeStatus_Ok) {
6189 return NULL;
6190 }
6191 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006192}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006193UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006194 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006195 (void)upb_Encode(msg, &google__protobuf__FieldDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006196 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006197}
6198UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options,
6199 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006200 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006201 (void)upb_Encode(msg, &google__protobuf__FieldDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006202 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006203}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006204UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006205 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 -08006206 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006207}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006208UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006209 upb_StringView default_val = upb_StringView_FromString("");
6210 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006211 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 -08006212 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006213 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006214}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006215UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006216 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 -08006217 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006218}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006219UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006220 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 -08006221 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006222}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006223UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006224 upb_StringView default_val = upb_StringView_FromString("");
6225 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006226 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 -08006227 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006228 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006229}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006230UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006231 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 -08006232 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006233}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006234UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006235 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 -08006236 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006237}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006238UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006239 int32_t default_val = (int32_t)0;
6240 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006241 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 -08006242 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006243 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006244}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006245UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006246 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 -08006247 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006248}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006249UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006250 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 -08006251 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006252}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006253UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006254 int32_t default_val = 1;
6255 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006256 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 -08006257 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006258 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006259}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006260UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006261 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 -08006262 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006263}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006264UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006265 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 -08006266 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006267}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006268UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006269 int32_t default_val = 1;
6270 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006271 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 -08006272 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006273 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006274}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006275UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006276 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 -08006277 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006278}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006279UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006280 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 -08006281 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006282}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006283UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006284 upb_StringView default_val = upb_StringView_FromString("");
6285 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006286 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 -08006287 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006288 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006289}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006290UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006291 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 -08006292 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006293}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006294UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006295 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 -08006296 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006297}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006298UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006299 upb_StringView default_val = upb_StringView_FromString("");
6300 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006301 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 -08006302 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006303 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006304}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006305UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006306 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 -08006307 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006308}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006309UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006310 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 -08006311 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006312}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006313UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006314 const google_protobuf_FieldOptions* default_val = NULL;
6315 const google_protobuf_FieldOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006316 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 -08006317 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006318 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006319}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006320UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006321 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 -08006322 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006323}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006324UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006325 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 -08006326 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006327}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006328UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006329 int32_t default_val = (int32_t)0;
6330 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006331 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 -08006332 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006333 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006334}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006335UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006336 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 -08006337 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006338}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006339UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006340 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 -08006341 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006342}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006343UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006344 upb_StringView default_val = upb_StringView_FromString("");
6345 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006346 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 -08006347 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006348 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006349}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006350UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006351 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 -08006352 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006353}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006354UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006355 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 -08006356 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006357}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006358UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006359 bool default_val = false;
6360 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07006361 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 -08006362 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006363 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006364}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006365UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006366 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 -08006367 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006368}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006369
6370UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006371 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 -08006372 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006373}
6374UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006375 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 -08006376 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006377}
6378UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006379 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 -08006380 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006381}
6382UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006383 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 -08006384 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006385}
6386UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006387 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 -08006388 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006389}
6390UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006391 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 -08006392 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006393}
6394UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006395 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 -08006396 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006397}
6398UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006399 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 -08006400 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006401}
6402UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006403 struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
6404 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006405 sub = (struct google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006406 if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006407 }
6408 return sub;
6409}
6410UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006411 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 -08006412 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006413}
6414UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006415 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 -08006416 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006417}
6418UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07006419 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 -08006420 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006421}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006422
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006423/* google.protobuf.OneofDescriptorProto */
6424
Joshua Habermanf41049a2022-01-21 14:41:25 -08006425UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006426 return (google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google__protobuf__OneofDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006427}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006428UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6429 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006430 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006431 if (upb_Decode(buf, size, ret, &google__protobuf__OneofDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006432 return NULL;
6433 }
6434 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006435}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006436UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size,
6437 const upb_ExtensionRegistry* extreg,
6438 int options, upb_Arena* arena) {
6439 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
6440 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006441 if (upb_Decode(buf, size, ret, &google__protobuf__OneofDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006442 kUpb_DecodeStatus_Ok) {
6443 return NULL;
6444 }
6445 return ret;
6446}
6447UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006448 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006449 (void)upb_Encode(msg, &google__protobuf__OneofDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006450 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006451}
6452UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options,
6453 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006454 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006455 (void)upb_Encode(msg, &google__protobuf__OneofDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006456 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006457}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006458UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006459 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 -08006460 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006461}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006462UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006463 upb_StringView default_val = upb_StringView_FromString("");
6464 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006465 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 -08006466 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006467 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006468}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006469UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006470 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 -08006471 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006472}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006473UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006474 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 -08006475 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006476}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006477UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006478 const google_protobuf_OneofOptions* default_val = NULL;
6479 const google_protobuf_OneofOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006480 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 -08006481 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006482 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006483}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006484UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006485 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 -08006486 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006487}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006488
Joshua Habermanf41049a2022-01-21 14:41:25 -08006489UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006490 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 -08006491 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006492}
6493UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006494 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 -08006495 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006496}
6497UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006498 struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
6499 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006500 sub = (struct google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006501 if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006502 }
6503 return sub;
6504}
6505
6506/* google.protobuf.EnumDescriptorProto */
6507
Joshua Habermanf41049a2022-01-21 14:41:25 -08006508UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006509 return (google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google__protobuf__EnumDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006510}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006511UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6512 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006513 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006514 if (upb_Decode(buf, size, ret, &google__protobuf__EnumDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006515 return NULL;
6516 }
6517 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006518}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006519UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size,
6520 const upb_ExtensionRegistry* extreg,
6521 int options, upb_Arena* arena) {
6522 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
6523 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006524 if (upb_Decode(buf, size, ret, &google__protobuf__EnumDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006525 kUpb_DecodeStatus_Ok) {
6526 return NULL;
6527 }
6528 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006529}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006530UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006531 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006532 (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006533 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006534}
6535UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options,
6536 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006537 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006538 (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006539 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006540}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006541UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006542 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 -08006543 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006544}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006545UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006546 upb_StringView default_val = upb_StringView_FromString("");
6547 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006548 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 -08006549 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006550 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006551}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006552UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006553 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 -08006554 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006555}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006556UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006557 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 -08006558 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006559}
Eric Salob7d54ac2022-12-29 11:59:42 -08006560UPB_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 -07006561 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 -08006562 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6563 if (arr) {
6564 if (size) *size = arr->size;
6565 return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr);
6566 } else {
6567 if (size) *size = 0;
6568 return NULL;
6569 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006570}
Deanna Garciab26afb52023-04-25 13:37:18 -07006571UPB_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 -07006572 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 -07006573 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6574 if (size) {
6575 *size = arr ? arr->size : 0;
6576 }
6577 return arr;
6578}
6579UPB_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 -07006580 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 -07006581 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6582 (upb_Message*)msg, &field, arena);
6583 if (size) {
6584 *size = arr ? arr->size : 0;
6585 }
6586 return arr;
6587}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006588UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) {
6589 size_t size;
6590 google_protobuf_EnumDescriptorProto_value(msg, &size);
6591 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006592}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006593UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006594 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 -08006595 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006596}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006597UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006598 const google_protobuf_EnumOptions* default_val = NULL;
6599 const google_protobuf_EnumOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006600 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 -08006601 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006602 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006603}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006604UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006605 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 -08006606 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006607}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006608UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006609 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 -08006610 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006611}
Eric Salob7d54ac2022-12-29 11:59:42 -08006612UPB_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 -07006613 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 -08006614 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6615 if (arr) {
6616 if (size) *size = arr->size;
6617 return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr);
6618 } else {
6619 if (size) *size = 0;
6620 return NULL;
6621 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006622}
Deanna Garciab26afb52023-04-25 13:37:18 -07006623UPB_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 -07006624 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 -07006625 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6626 if (size) {
6627 *size = arr ? arr->size : 0;
6628 }
6629 return arr;
6630}
6631UPB_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 -07006632 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 -07006633 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6634 (upb_Message*)msg, &field, arena);
6635 if (size) {
6636 *size = arr ? arr->size : 0;
6637 }
6638 return arr;
6639}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006640UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) {
6641 size_t size;
6642 google_protobuf_EnumDescriptorProto_reserved_range(msg, &size);
6643 return size != 0;
6644}
6645UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006646 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 -08006647 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006648}
Eric Salob7d54ac2022-12-29 11:59:42 -08006649UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006650 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 -08006651 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6652 if (arr) {
6653 if (size) *size = arr->size;
6654 return (upb_StringView const*)_upb_array_constptr(arr);
6655 } else {
6656 if (size) *size = 0;
6657 return NULL;
6658 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006659}
Deanna Garciab26afb52023-04-25 13:37:18 -07006660UPB_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 -07006661 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 -07006662 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6663 if (size) {
6664 *size = arr ? arr->size : 0;
6665 }
6666 return arr;
6667}
6668UPB_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 -07006669 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 -07006670 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6671 (upb_Message*)msg, &field, arena);
6672 if (size) {
6673 *size = arr ? arr->size : 0;
6674 }
6675 return arr;
6676}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006677UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) {
6678 size_t size;
6679 google_protobuf_EnumDescriptorProto_reserved_name(msg, &size);
6680 return size != 0;
6681}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006682
Joshua Habermanf41049a2022-01-21 14:41:25 -08006683UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006684 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 -08006685 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006686}
6687UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006688 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 -08006689 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6690 if (arr) {
6691 if (size) *size = arr->size;
6692 return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr);
6693 } else {
6694 if (size) *size = 0;
6695 return NULL;
6696 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006697}
Eric Salob7d54ac2022-12-29 11:59:42 -08006698UPB_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 -07006699 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 -07006700 return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006701}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006702UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006703 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 -08006704 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6705 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6706 return NULL;
6707 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006708 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 -08006709 if (!arr || !sub) return NULL;
6710 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006711 return sub;
6712}
6713UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006714 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 -08006715 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006716}
6717UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006718 struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
6719 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006720 sub = (struct google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006721 if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006722 }
6723 return sub;
6724}
Eric Salob7d54ac2022-12-29 11:59:42 -08006725UPB_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 -07006726 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 -08006727 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6728 if (arr) {
6729 if (size) *size = arr->size;
6730 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr);
6731 } else {
6732 if (size) *size = 0;
6733 return NULL;
6734 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006735}
Eric Salob7d54ac2022-12-29 11:59:42 -08006736UPB_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 -07006737 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 -07006738 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006739}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006740UPB_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 -07006741 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 -08006742 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6743 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6744 return NULL;
6745 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006746 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 -08006747 if (!arr || !sub) return NULL;
6748 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006749 return sub;
6750}
Eric Salob7d54ac2022-12-29 11:59:42 -08006751UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006752 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 -08006753 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6754 if (arr) {
6755 if (size) *size = arr->size;
6756 return (upb_StringView*)_upb_array_ptr(arr);
6757 } else {
6758 if (size) *size = 0;
6759 return NULL;
6760 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006761}
Eric Salob7d54ac2022-12-29 11:59:42 -08006762UPB_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 -07006763 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 -07006764 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006765}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006766UPB_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 -07006767 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 -08006768 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6769 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6770 return false;
6771 }
6772 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
6773 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006774}
6775
6776/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
6777
Joshua Habermanf41049a2022-01-21 14:41:25 -08006778UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006779 return (google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006780}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006781UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6782 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006783 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006784 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 -07006785 return NULL;
6786 }
6787 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006788}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006789UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size,
6790 const upb_ExtensionRegistry* extreg,
6791 int options, upb_Arena* arena) {
6792 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
6793 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006794 if (upb_Decode(buf, size, ret, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006795 kUpb_DecodeStatus_Ok) {
6796 return NULL;
6797 }
6798 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006799}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006800UPB_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 -07006801 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006802 (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006803 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006804}
6805UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options,
6806 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006807 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006808 (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006809 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006810}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006811UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006812 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 -08006813 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006814}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006815UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006816 int32_t default_val = (int32_t)0;
6817 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006818 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 -08006819 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006820 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006821}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006822UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006823 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 -08006824 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006825}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006826UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006827 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 -08006828 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006829}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006830UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006831 int32_t default_val = (int32_t)0;
6832 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006833 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 -08006834 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006835 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006836}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006837UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006838 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 -08006839 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006840}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006841
6842UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006843 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 -08006844 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006845}
6846UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006847 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 -08006848 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006849}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006850
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006851/* google.protobuf.EnumValueDescriptorProto */
6852
Joshua Habermanf41049a2022-01-21 14:41:25 -08006853UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006854 return (google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google__protobuf__EnumValueDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006855}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006856UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6857 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006858 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006859 if (upb_Decode(buf, size, ret, &google__protobuf__EnumValueDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006860 return NULL;
6861 }
6862 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006863}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006864UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size,
6865 const upb_ExtensionRegistry* extreg,
6866 int options, upb_Arena* arena) {
6867 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
6868 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006869 if (upb_Decode(buf, size, ret, &google__protobuf__EnumValueDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006870 kUpb_DecodeStatus_Ok) {
6871 return NULL;
6872 }
6873 return ret;
6874}
6875UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006876 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006877 (void)upb_Encode(msg, &google__protobuf__EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006878 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006879}
6880UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options,
6881 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006882 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006883 (void)upb_Encode(msg, &google__protobuf__EnumValueDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006884 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006885}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006886UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006887 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 -08006888 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006889}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006890UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006891 upb_StringView default_val = upb_StringView_FromString("");
6892 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006893 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 -08006894 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006895 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006896}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006897UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006898 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 -08006899 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006900}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006901UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006902 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 -08006903 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006904}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006905UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006906 int32_t default_val = (int32_t)0;
6907 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006908 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 -08006909 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006910 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006911}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006912UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006913 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 -08006914 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006915}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006916UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006917 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 -08006918 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006919}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006920UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006921 const google_protobuf_EnumValueOptions* default_val = NULL;
6922 const google_protobuf_EnumValueOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006923 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 -08006924 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006925 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006926}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006927UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006928 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 -08006929 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006930}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006931
Joshua Habermanf41049a2022-01-21 14:41:25 -08006932UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006933 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 -08006934 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006935}
6936UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006937 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 -08006938 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006939}
6940UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006941 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 -08006942 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006943}
6944UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006945 struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
6946 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006947 sub = (struct google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006948 if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006949 }
6950 return sub;
6951}
6952
6953/* google.protobuf.ServiceDescriptorProto */
6954
Joshua Habermanf41049a2022-01-21 14:41:25 -08006955UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006956 return (google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google__protobuf__ServiceDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006957}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006958UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6959 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006960 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006961 if (upb_Decode(buf, size, ret, &google__protobuf__ServiceDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006962 return NULL;
6963 }
6964 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006965}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006966UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size,
6967 const upb_ExtensionRegistry* extreg,
6968 int options, upb_Arena* arena) {
6969 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
6970 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006971 if (upb_Decode(buf, size, ret, &google__protobuf__ServiceDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006972 kUpb_DecodeStatus_Ok) {
6973 return NULL;
6974 }
6975 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006976}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006977UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006978 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006979 (void)upb_Encode(msg, &google__protobuf__ServiceDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006980 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006981}
6982UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options,
6983 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006984 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006985 (void)upb_Encode(msg, &google__protobuf__ServiceDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006986 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006987}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006988UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006989 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 -08006990 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006991}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006992UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006993 upb_StringView default_val = upb_StringView_FromString("");
6994 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006995 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 -08006996 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006997 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006998}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006999UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007000 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 -08007001 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007002}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007003UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007004 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 -08007005 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007006}
Eric Salob7d54ac2022-12-29 11:59:42 -08007007UPB_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 -07007008 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 -08007009 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7010 if (arr) {
7011 if (size) *size = arr->size;
7012 return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr);
7013 } else {
7014 if (size) *size = 0;
7015 return NULL;
7016 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007017}
Deanna Garciab26afb52023-04-25 13:37:18 -07007018UPB_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 -07007019 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 -07007020 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7021 if (size) {
7022 *size = arr ? arr->size : 0;
7023 }
7024 return arr;
7025}
7026UPB_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 -07007027 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 -07007028 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7029 (upb_Message*)msg, &field, arena);
7030 if (size) {
7031 *size = arr ? arr->size : 0;
7032 }
7033 return arr;
7034}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007035UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) {
7036 size_t size;
7037 google_protobuf_ServiceDescriptorProto_method(msg, &size);
7038 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007039}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007040UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007041 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 -08007042 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007043}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007044UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007045 const google_protobuf_ServiceOptions* default_val = NULL;
7046 const google_protobuf_ServiceOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07007047 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 -08007048 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007049 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007050}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007051UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007052 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 -08007053 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007054}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007055
Joshua Habermanf41049a2022-01-21 14:41:25 -08007056UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007057 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 -08007058 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007059}
7060UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07007061 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 -08007062 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7063 if (arr) {
7064 if (size) *size = arr->size;
7065 return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr);
7066 } else {
7067 if (size) *size = 0;
7068 return NULL;
7069 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007070}
Eric Salob7d54ac2022-12-29 11:59:42 -08007071UPB_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 -07007072 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 -07007073 return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007074}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007075UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07007076 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 -08007077 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7078 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7079 return NULL;
7080 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007081 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 -08007082 if (!arr || !sub) return NULL;
7083 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007084 return sub;
7085}
7086UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07007087 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 -08007088 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007089}
7090UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007091 struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
7092 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007093 sub = (struct google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007094 if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007095 }
7096 return sub;
7097}
7098
7099/* google.protobuf.MethodDescriptorProto */
7100
Joshua Habermanf41049a2022-01-21 14:41:25 -08007101UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007102 return (google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google__protobuf__MethodDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007103}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007104UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7105 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007106 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007107 if (upb_Decode(buf, size, ret, &google__protobuf__MethodDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007108 return NULL;
7109 }
7110 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007111}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007112UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size,
7113 const upb_ExtensionRegistry* extreg,
7114 int options, upb_Arena* arena) {
7115 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
7116 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007117 if (upb_Decode(buf, size, ret, &google__protobuf__MethodDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007118 kUpb_DecodeStatus_Ok) {
7119 return NULL;
7120 }
7121 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007122}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007123UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007124 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007125 (void)upb_Encode(msg, &google__protobuf__MethodDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007126 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007127}
7128UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options,
7129 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007130 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007131 (void)upb_Encode(msg, &google__protobuf__MethodDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007132 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007133}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007134UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007135 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 -08007136 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007137}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007138UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007139 upb_StringView default_val = upb_StringView_FromString("");
7140 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007141 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 -08007142 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007143 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007144}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007145UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007146 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 -08007147 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007148}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007149UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007150 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 -08007151 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007152}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007153UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007154 upb_StringView default_val = upb_StringView_FromString("");
7155 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007156 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 -08007157 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007158 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007159}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007160UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007161 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 -08007162 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007163}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007164UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007165 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 -08007166 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007167}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007168UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007169 upb_StringView default_val = upb_StringView_FromString("");
7170 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007171 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 -08007172 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007173 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007174}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007175UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007176 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 -08007177 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007178}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007179UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007180 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 -08007181 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007182}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007183UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007184 const google_protobuf_MethodOptions* default_val = NULL;
7185 const google_protobuf_MethodOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07007186 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 -08007187 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007188 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007189}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007190UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007191 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 -08007192 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007193}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007194UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007195 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 -08007196 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007197}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007198UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007199 bool default_val = false;
7200 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007201 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 -08007202 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007203 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007204}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007205UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007206 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 -08007207 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007208}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007209UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007210 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 -08007211 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007212}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007213UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007214 bool default_val = false;
7215 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007216 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 -08007217 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007218 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007219}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007220UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007221 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 -08007222 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007223}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007224
Joshua Habermanf41049a2022-01-21 14:41:25 -08007225UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007226 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 -08007227 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007228}
7229UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007230 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 -08007231 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007232}
7233UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007234 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 -08007235 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007236}
7237UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07007238 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 -08007239 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007240}
7241UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007242 struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
7243 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007244 sub = (struct google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007245 if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007246 }
7247 return sub;
7248}
7249UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007250 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 -08007251 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007252}
7253UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007254 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 -08007255 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007256}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007257
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007258/* google.protobuf.FileOptions */
7259
Joshua Habermanf41049a2022-01-21 14:41:25 -08007260UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007261 return (google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007262}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007263UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7264 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007265 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007266 if (upb_Decode(buf, size, ret, &google__protobuf__FileOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007267 return NULL;
7268 }
7269 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007270}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007271UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size,
7272 const upb_ExtensionRegistry* extreg,
7273 int options, upb_Arena* arena) {
7274 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
7275 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007276 if (upb_Decode(buf, size, ret, &google__protobuf__FileOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007277 kUpb_DecodeStatus_Ok) {
7278 return NULL;
7279 }
7280 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007281}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007282UPB_INLINE char* google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007283 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007284 (void)upb_Encode(msg, &google__protobuf__FileOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007285 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007286}
7287UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options,
7288 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007289 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007290 (void)upb_Encode(msg, &google__protobuf__FileOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007291 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007292}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007293UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007294 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 -08007295 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007296}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007297UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007298 upb_StringView default_val = upb_StringView_FromString("");
7299 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007300 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 -08007301 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007302 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007303}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007304UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007305 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 -08007306 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007307}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007308UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007309 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 -08007310 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007311}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007312UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007313 upb_StringView default_val = upb_StringView_FromString("");
7314 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007315 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 -08007316 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007317 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007318}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007319UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007320 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 -08007321 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007322}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007323UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007324 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 -08007325 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007326}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007327UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007328 int32_t default_val = 1;
7329 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007330 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 -08007331 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007332 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007333}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007334UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007335 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 -08007336 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007337}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007338UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007339 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 -08007340 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007341}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007342UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007343 bool default_val = false;
7344 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007345 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 -08007346 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007347 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007348}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007349UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007350 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 -08007351 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007352}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007353UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007354 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 -08007355 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007356}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007357UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007358 upb_StringView default_val = upb_StringView_FromString("");
7359 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007360 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 -08007361 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007362 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007363}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007364UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007365 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 -08007366 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007367}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007368UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007369 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 -08007370 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007371}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007372UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007373 bool default_val = false;
7374 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007375 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 -08007376 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007377 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007378}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007379UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007380 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 -08007381 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007382}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007383UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007384 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 -08007385 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007386}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007387UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007388 bool default_val = false;
7389 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007390 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 -08007391 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007392 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007393}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007394UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007395 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 -08007396 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007397}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007398UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007399 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 -08007400 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007401}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007402UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007403 bool default_val = false;
7404 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007405 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 -08007406 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007407 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007408}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007409UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007410 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 -08007411 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007412}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007413UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007414 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 -08007415 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007416}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007417UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007418 bool default_val = false;
7419 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007420 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 -08007421 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007422 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007423}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007424UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007425 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 -08007426 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007427}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007428UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007429 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 -08007430 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007431}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007432UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007433 bool default_val = false;
7434 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007435 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 -08007436 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007437 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007438}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007439UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007440 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 -08007441 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007442}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007443UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007444 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 -08007445 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007446}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007447UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007448 bool default_val = false;
7449 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007450 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 -08007451 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007452 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007453}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007454UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007455 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 -08007456 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007457}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007458UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007459 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 -08007460 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007461}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007462UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007463 bool default_val = true;
7464 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007465 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 -08007466 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007467 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007468}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007469UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007470 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 -08007471 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007472}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007473UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007474 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 -08007475 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007476}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007477UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007478 upb_StringView default_val = upb_StringView_FromString("");
7479 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007480 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 -08007481 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007482 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007483}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007484UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007485 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 -08007486 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007487}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007488UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007489 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 -08007490 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007491}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007492UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007493 upb_StringView default_val = upb_StringView_FromString("");
7494 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007495 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 -08007496 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007497 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007498}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007499UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007500 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 -08007501 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007502}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007503UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007504 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 -08007505 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007506}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007507UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007508 upb_StringView default_val = upb_StringView_FromString("");
7509 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007510 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 -08007511 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007512 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007513}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007514UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007515 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 -08007516 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007517}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007518UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007519 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 -08007520 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007521}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007522UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007523 upb_StringView default_val = upb_StringView_FromString("");
7524 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007525 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 -08007526 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007527 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007528}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007529UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007530 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 -08007531 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007532}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007533UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007534 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 -08007535 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007536}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007537UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007538 upb_StringView default_val = upb_StringView_FromString("");
7539 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007540 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 -08007541 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007542 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007543}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007544UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007545 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 -08007546 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007547}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007548UPB_INLINE void google_protobuf_FileOptions_clear_php_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007549 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 -08007550 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007551}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007552UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007553 bool default_val = false;
7554 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007555 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 -08007556 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007557 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007558}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007559UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007560 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 -08007561 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007562}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007563UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007564 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 -08007565 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007566}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007567UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007568 upb_StringView default_val = upb_StringView_FromString("");
7569 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007570 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 -08007571 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007572 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007573}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007574UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007575 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 -08007576 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007577}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007578UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007579 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 -08007580 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007581}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007582UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007583 upb_StringView default_val = upb_StringView_FromString("");
7584 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007585 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 -08007586 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007587 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007588}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007589UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007590 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)};
7591 return _upb_Message_HasNonExtensionField(msg, &field);
7592}
7593UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) {
7594 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)};
7595 _upb_Message_ClearNonExtensionField(msg, &field);
7596}
7597UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) {
7598 const google_protobuf_FeatureSet* default_val = NULL;
7599 const google_protobuf_FeatureSet* ret;
7600 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)};
7601 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7602 return ret;
7603}
7604UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) {
7605 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 -08007606 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007607}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007608UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007609 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 -08007610 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007611}
Eric Salob7d54ac2022-12-29 11:59:42 -08007612UPB_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 -07007613 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 -08007614 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7615 if (arr) {
7616 if (size) *size = arr->size;
7617 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
7618 } else {
7619 if (size) *size = 0;
7620 return NULL;
7621 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007622}
Deanna Garciab26afb52023-04-25 13:37:18 -07007623UPB_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 -07007624 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 -07007625 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7626 if (size) {
7627 *size = arr ? arr->size : 0;
7628 }
7629 return arr;
7630}
7631UPB_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 -07007632 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 -07007633 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7634 (upb_Message*)msg, &field, arena);
7635 if (size) {
7636 *size = arr ? arr->size : 0;
7637 }
7638 return arr;
7639}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007640UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) {
7641 size_t size;
7642 google_protobuf_FileOptions_uninterpreted_option(msg, &size);
7643 return size != 0;
7644}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007645
Joshua Habermanf41049a2022-01-21 14:41:25 -08007646UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007647 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 -08007648 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007649}
7650UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007651 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 -08007652 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007653}
7654UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007655 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 -08007656 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007657}
7658UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007659 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 -08007660 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007661}
7662UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007663 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 -08007664 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007665}
7666UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007667 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 -08007668 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007669}
7670UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007671 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 -08007672 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007673}
7674UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007675 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 -08007676 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007677}
7678UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007679 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 -08007680 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007681}
7682UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007683 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 -08007684 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007685}
7686UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007687 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 -08007688 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007689}
7690UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007691 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 -08007692 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007693}
7694UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007695 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 -08007696 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007697}
7698UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007699 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 -08007700 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007701}
7702UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007703 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 -08007704 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007705}
7706UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007707 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 -08007708 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007709}
7710UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007711 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 -08007712 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007713}
7714UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007715 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 -08007716 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007717}
7718UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007719 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 -08007720 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007721}
7722UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007723 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 -08007724 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007725}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007726UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) {
7727 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)};
7728 _upb_Message_SetNonExtensionField(msg, &field, &value);
7729}
7730UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) {
7731 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg);
7732 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007733 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007734 if (sub) google_protobuf_FileOptions_set_features(msg, sub);
7735 }
7736 return sub;
7737}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007738UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007739 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 -08007740 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7741 if (arr) {
7742 if (size) *size = arr->size;
7743 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
7744 } else {
7745 if (size) *size = 0;
7746 return NULL;
7747 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007748}
Eric Salob7d54ac2022-12-29 11:59:42 -08007749UPB_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 -07007750 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 -07007751 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007752}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007753UPB_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 -07007754 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 -08007755 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7756 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7757 return NULL;
7758 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007759 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 -08007760 if (!arr || !sub) return NULL;
7761 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007762 return sub;
7763}
7764
7765/* google.protobuf.MessageOptions */
7766
Joshua Habermanf41049a2022-01-21 14:41:25 -08007767UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007768 return (google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007769}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007770UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7771 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007772 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007773 if (upb_Decode(buf, size, ret, &google__protobuf__MessageOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007774 return NULL;
7775 }
7776 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007777}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007778UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size,
7779 const upb_ExtensionRegistry* extreg,
7780 int options, upb_Arena* arena) {
7781 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
7782 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007783 if (upb_Decode(buf, size, ret, &google__protobuf__MessageOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007784 kUpb_DecodeStatus_Ok) {
7785 return NULL;
7786 }
7787 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007788}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007789UPB_INLINE char* google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007790 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007791 (void)upb_Encode(msg, &google__protobuf__MessageOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007792 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007793}
7794UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options,
7795 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007796 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007797 (void)upb_Encode(msg, &google__protobuf__MessageOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007798 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007799}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007800UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007801 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 -08007802 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007803}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007804UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007805 bool default_val = false;
7806 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007807 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 -08007808 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007809 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007810}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007811UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007812 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 -08007813 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007814}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007815UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007816 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 -08007817 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007818}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007819UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007820 bool default_val = false;
7821 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007822 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 -08007823 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007824 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007825}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007826UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007827 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 -08007828 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007829}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007830UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007831 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 -08007832 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007833}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007834UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007835 bool default_val = false;
7836 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007837 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 -08007838 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007839 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007840}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007841UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007842 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 -08007843 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007844}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007845UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007846 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 -08007847 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007848}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007849UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007850 bool default_val = false;
7851 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007852 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 -08007853 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007854 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007855}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007856UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007857 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 -08007858 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007859}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007860UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007861 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 -08007862 _upb_Message_ClearNonExtensionField(msg, &field);
7863}
7864UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
7865 bool default_val = false;
7866 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007867 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 -08007868 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7869 return ret;
7870}
7871UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007872 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 -08007873 return _upb_Message_HasNonExtensionField(msg, &field);
7874}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007875UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) {
7876 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)};
7877 _upb_Message_ClearNonExtensionField(msg, &field);
7878}
7879UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) {
7880 const google_protobuf_FeatureSet* default_val = NULL;
7881 const google_protobuf_FeatureSet* ret;
7882 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)};
7883 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7884 return ret;
7885}
7886UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) {
7887 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)};
7888 return _upb_Message_HasNonExtensionField(msg, &field);
7889}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007890UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007891 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 -08007892 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007893}
Eric Salob7d54ac2022-12-29 11:59:42 -08007894UPB_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 -07007895 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 -08007896 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7897 if (arr) {
7898 if (size) *size = arr->size;
7899 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
7900 } else {
7901 if (size) *size = 0;
7902 return NULL;
7903 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007904}
Deanna Garciab26afb52023-04-25 13:37:18 -07007905UPB_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 -07007906 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 -07007907 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7908 if (size) {
7909 *size = arr ? arr->size : 0;
7910 }
7911 return arr;
7912}
7913UPB_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 -07007914 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 -07007915 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7916 (upb_Message*)msg, &field, arena);
7917 if (size) {
7918 *size = arr ? arr->size : 0;
7919 }
7920 return arr;
7921}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007922UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) {
7923 size_t size;
7924 google_protobuf_MessageOptions_uninterpreted_option(msg, &size);
7925 return size != 0;
7926}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007927
7928UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007929 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 -08007930 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007931}
7932UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007933 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 -08007934 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007935}
7936UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007937 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 -08007938 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007939}
7940UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007941 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 -08007942 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007943}
7944UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007945 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 -08007946 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007947}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007948UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) {
7949 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)};
7950 _upb_Message_SetNonExtensionField(msg, &field, &value);
7951}
7952UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
7953 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg);
7954 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007955 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007956 if (sub) google_protobuf_MessageOptions_set_features(msg, sub);
7957 }
7958 return sub;
7959}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007960UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007961 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 -08007962 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7963 if (arr) {
7964 if (size) *size = arr->size;
7965 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
7966 } else {
7967 if (size) *size = 0;
7968 return NULL;
7969 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007970}
Eric Salob7d54ac2022-12-29 11:59:42 -08007971UPB_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 -07007972 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 -07007973 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007974}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007975UPB_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 -07007976 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 -08007977 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7978 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7979 return NULL;
7980 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007981 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 -08007982 if (!arr || !sub) return NULL;
7983 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007984 return sub;
7985}
7986
7987/* google.protobuf.FieldOptions */
7988
Joshua Habermanf41049a2022-01-21 14:41:25 -08007989UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007990 return (google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007991}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007992UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7993 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007994 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007995 if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007996 return NULL;
7997 }
7998 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007999}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008000UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size,
8001 const upb_ExtensionRegistry* extreg,
8002 int options, upb_Arena* arena) {
8003 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
8004 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008005 if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008006 kUpb_DecodeStatus_Ok) {
8007 return NULL;
8008 }
8009 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008010}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008011UPB_INLINE char* google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008012 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008013 (void)upb_Encode(msg, &google__protobuf__FieldOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008014 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008015}
8016UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options,
8017 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008018 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008019 (void)upb_Encode(msg, &google__protobuf__FieldOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008020 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008021}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008022UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008023 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 -08008024 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008025}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008026UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008027 int32_t default_val = 0;
8028 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008029 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 -08008030 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008031 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008032}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008033UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008034 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 -08008035 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008036}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008037UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008038 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 -08008039 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008040}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008041UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008042 bool default_val = false;
8043 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008044 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 -08008045 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008046 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008047}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008048UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008049 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 -08008050 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008051}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008052UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008053 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 -08008054 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008055}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008056UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008057 bool default_val = false;
8058 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008059 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 -08008060 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008061 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008062}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008063UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008064 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 -08008065 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008066}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008067UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008068 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 -08008069 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008070}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008071UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008072 bool default_val = false;
8073 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008074 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 -08008075 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008076 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008077}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008078UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008079 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 -08008080 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008081}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008082UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008083 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 -08008084 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008085}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008086UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008087 int32_t default_val = 0;
8088 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008089 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 -08008090 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008091 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008092}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008093UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008094 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 -08008095 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008096}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008097UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008098 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 -08008099 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008100}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008101UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008102 bool default_val = false;
8103 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008104 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 -08008105 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008106 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008107}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008108UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008109 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 -08008110 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008111}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008112UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008113 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 -08008114 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008115}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008116UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008117 bool default_val = false;
8118 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008119 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 -08008120 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008121 return ret;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008122}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008123UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008124 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 -08008125 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008126}
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008127UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008128 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 -08008129 _upb_Message_ClearNonExtensionField(msg, &field);
8130}
8131UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) {
8132 bool default_val = false;
8133 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008134 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 -08008135 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8136 return ret;
8137}
8138UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008139 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 -08008140 return _upb_Message_HasNonExtensionField(msg, &field);
8141}
Adam Cozzette5a568372023-01-24 20:35:59 -08008142UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008143 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 -08008144 _upb_Message_ClearNonExtensionField(msg, &field);
8145}
8146UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) {
8147 int32_t default_val = 0;
8148 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008149 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 -08008150 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8151 return ret;
8152}
8153UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008154 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 -08008155 return _upb_Message_HasNonExtensionField(msg, &field);
8156}
Mike Kruskal0c121392023-03-18 00:05:41 -07008157UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008158 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 -08008159 _upb_Message_ClearNonExtensionField(msg, &field);
8160}
Mike Kruskal0c121392023-03-18 00:05:41 -07008161UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008162 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 -07008163 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8164 if (arr) {
8165 if (size) *size = arr->size;
8166 return (int32_t const*)_upb_array_constptr(arr);
8167 } else {
8168 if (size) *size = 0;
8169 return NULL;
8170 }
Adam Cozzette5a568372023-01-24 20:35:59 -08008171}
Deanna Garciab26afb52023-04-25 13:37:18 -07008172UPB_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 -07008173 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 -07008174 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8175 if (size) {
8176 *size = arr ? arr->size : 0;
8177 }
8178 return arr;
8179}
8180UPB_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 -07008181 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 -07008182 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8183 (upb_Message*)msg, &field, arena);
8184 if (size) {
8185 *size = arr ? arr->size : 0;
8186 }
8187 return arr;
8188}
Mike Kruskal0c121392023-03-18 00:05:41 -07008189UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) {
8190 size_t size;
8191 google_protobuf_FieldOptions_targets(msg, &size);
8192 return size != 0;
Adam Cozzette5a568372023-01-24 20:35:59 -08008193}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008194UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008195 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 -07008196 _upb_Message_ClearNonExtensionField(msg, &field);
8197}
8198UPB_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 -07008199 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 -07008200 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8201 if (arr) {
8202 if (size) *size = arr->size;
8203 return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr);
8204 } else {
8205 if (size) *size = 0;
8206 return NULL;
8207 }
8208}
8209UPB_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 -07008210 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 -07008211 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8212 if (size) {
8213 *size = arr ? arr->size : 0;
8214 }
8215 return arr;
8216}
8217UPB_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 -07008218 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 -07008219 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8220 (upb_Message*)msg, &field, arena);
8221 if (size) {
8222 *size = arr ? arr->size : 0;
8223 }
8224 return arr;
8225}
8226UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) {
8227 size_t size;
8228 google_protobuf_FieldOptions_edition_defaults(msg, &size);
8229 return size != 0;
8230}
8231UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008232 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 -07008233 _upb_Message_ClearNonExtensionField(msg, &field);
8234}
8235UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) {
8236 const google_protobuf_FeatureSet* default_val = NULL;
8237 const google_protobuf_FeatureSet* ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07008238 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 -07008239 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8240 return ret;
8241}
8242UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008243 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 -07008244 return _upb_Message_HasNonExtensionField(msg, &field);
8245}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008246UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008247 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 -08008248 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008249}
Eric Salob7d54ac2022-12-29 11:59:42 -08008250UPB_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 -07008251 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 -08008252 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8253 if (arr) {
8254 if (size) *size = arr->size;
8255 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8256 } else {
8257 if (size) *size = 0;
8258 return NULL;
8259 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008260}
Deanna Garciab26afb52023-04-25 13:37:18 -07008261UPB_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 -07008262 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 -07008263 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8264 if (size) {
8265 *size = arr ? arr->size : 0;
8266 }
8267 return arr;
8268}
8269UPB_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 -07008270 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 -07008271 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8272 (upb_Message*)msg, &field, arena);
8273 if (size) {
8274 *size = arr ? arr->size : 0;
8275 }
8276 return arr;
8277}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008278UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) {
8279 size_t size;
8280 google_protobuf_FieldOptions_uninterpreted_option(msg, &size);
8281 return size != 0;
8282}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008283
8284UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008285 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 -08008286 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008287}
8288UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008289 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 -08008290 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008291}
8292UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008293 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 -08008294 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008295}
8296UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008297 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 -08008298 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008299}
8300UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008301 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 -08008302 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008303}
8304UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008305 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 -08008306 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008307}
8308UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008309 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 -08008310 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008311}
8312UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008313 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 -08008314 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008315}
Adam Cozzette5a568372023-01-24 20:35:59 -08008316UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008317 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 -08008318 _upb_Message_SetNonExtensionField(msg, &field, &value);
8319}
Mike Kruskal0c121392023-03-18 00:05:41 -07008320UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008321 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 -07008322 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8323 if (arr) {
8324 if (size) *size = arr->size;
8325 return (int32_t*)_upb_array_ptr(arr);
8326 } else {
8327 if (size) *size = 0;
8328 return NULL;
8329 }
8330}
8331UPB_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 -07008332 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 -07008333 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Mike Kruskal0c121392023-03-18 00:05:41 -07008334}
8335UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008336 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 -07008337 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8338 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8339 return false;
8340 }
8341 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
8342 return true;
Adam Cozzette5a568372023-01-24 20:35:59 -08008343}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008344UPB_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 -07008345 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 -07008346 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8347 if (arr) {
8348 if (size) *size = arr->size;
8349 return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr);
8350 } else {
8351 if (size) *size = 0;
8352 return NULL;
8353 }
8354}
8355UPB_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 -07008356 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 -07008357 return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
8358}
8359UPB_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 -07008360 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 -07008361 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8362 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8363 return NULL;
8364 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008365 struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008366 if (!arr || !sub) return NULL;
8367 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
8368 return sub;
8369}
8370UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008371 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 -07008372 _upb_Message_SetNonExtensionField(msg, &field, &value);
8373}
8374UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
8375 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg);
8376 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008377 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008378 if (sub) google_protobuf_FieldOptions_set_features(msg, sub);
8379 }
8380 return sub;
8381}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008382UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008383 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 -08008384 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8385 if (arr) {
8386 if (size) *size = arr->size;
8387 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8388 } else {
8389 if (size) *size = 0;
8390 return NULL;
8391 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008392}
Eric Salob7d54ac2022-12-29 11:59:42 -08008393UPB_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 -07008394 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 -07008395 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008396}
8397UPB_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 -07008398 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 -08008399 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8400 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8401 return NULL;
8402 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008403 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 -08008404 if (!arr || !sub) return NULL;
8405 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008406 return sub;
8407}
8408
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008409/* google.protobuf.FieldOptions.EditionDefault */
8410
8411UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008412 return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008413}
8414UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
8415 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
8416 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008417 if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions__EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008418 return NULL;
8419 }
8420 return ret;
8421}
8422UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size,
8423 const upb_ExtensionRegistry* extreg,
8424 int options, upb_Arena* arena) {
8425 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
8426 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008427 if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions__EditionDefault_msg_init, extreg, options, arena) !=
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008428 kUpb_DecodeStatus_Ok) {
8429 return NULL;
8430 }
8431 return ret;
8432}
8433UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) {
8434 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008435 (void)upb_Encode(msg, &google__protobuf__FieldOptions__EditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008436 return ptr;
8437}
8438UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options,
8439 upb_Arena* arena, size_t* len) {
8440 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008441 (void)upb_Encode(msg, &google__protobuf__FieldOptions__EditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008442 return ptr;
8443}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008444UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008445 const upb_MiniTableField field = {2, 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 -07008446 _upb_Message_ClearNonExtensionField(msg, &field);
8447}
8448UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
8449 upb_StringView default_val = upb_StringView_FromString("");
8450 upb_StringView ret;
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008451 const upb_MiniTableField field = {2, 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 -07008452 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8453 return ret;
8454}
8455UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008456 const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008457 return _upb_Message_HasNonExtensionField(msg, &field);
8458}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008459UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) {
8460 const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008461 _upb_Message_ClearNonExtensionField(msg, &field);
8462}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008463UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008464 int32_t default_val = 0;
8465 int32_t ret;
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008466 const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008467 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8468 return ret;
8469}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008470UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
8471 const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008472 return _upb_Message_HasNonExtensionField(msg, &field);
8473}
8474
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008475UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008476 const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008477 _upb_Message_SetNonExtensionField(msg, &field, &value);
8478}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008479UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) {
8480 const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008481 _upb_Message_SetNonExtensionField(msg, &field, &value);
8482}
8483
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008484/* google.protobuf.OneofOptions */
8485
Joshua Habermanf41049a2022-01-21 14:41:25 -08008486UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008487 return (google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008488}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008489UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8490 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008491 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008492 if (upb_Decode(buf, size, ret, &google__protobuf__OneofOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008493 return NULL;
8494 }
8495 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008496}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008497UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size,
8498 const upb_ExtensionRegistry* extreg,
8499 int options, upb_Arena* arena) {
8500 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
8501 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008502 if (upb_Decode(buf, size, ret, &google__protobuf__OneofOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008503 kUpb_DecodeStatus_Ok) {
8504 return NULL;
8505 }
8506 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008507}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008508UPB_INLINE char* google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008509 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008510 (void)upb_Encode(msg, &google__protobuf__OneofOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008511 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008512}
8513UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options,
8514 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008515 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008516 (void)upb_Encode(msg, &google__protobuf__OneofOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008517 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008518}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008519UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) {
8520 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)};
8521 _upb_Message_ClearNonExtensionField(msg, &field);
8522}
8523UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) {
8524 const google_protobuf_FeatureSet* default_val = NULL;
8525 const google_protobuf_FeatureSet* ret;
8526 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)};
8527 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8528 return ret;
8529}
8530UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) {
8531 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)};
8532 return _upb_Message_HasNonExtensionField(msg, &field);
8533}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008534UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008535 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 -08008536 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008537}
Eric Salob7d54ac2022-12-29 11:59:42 -08008538UPB_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 -07008539 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 -08008540 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8541 if (arr) {
8542 if (size) *size = arr->size;
8543 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8544 } else {
8545 if (size) *size = 0;
8546 return NULL;
8547 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008548}
Deanna Garciab26afb52023-04-25 13:37:18 -07008549UPB_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 -07008550 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 -07008551 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8552 if (size) {
8553 *size = arr ? arr->size : 0;
8554 }
8555 return arr;
8556}
8557UPB_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 -07008558 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 -07008559 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8560 (upb_Message*)msg, &field, arena);
8561 if (size) {
8562 *size = arr ? arr->size : 0;
8563 }
8564 return arr;
8565}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008566UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) {
8567 size_t size;
8568 google_protobuf_OneofOptions_uninterpreted_option(msg, &size);
8569 return size != 0;
8570}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008571
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008572UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) {
8573 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)};
8574 _upb_Message_SetNonExtensionField(msg, &field, &value);
8575}
8576UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
8577 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg);
8578 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008579 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008580 if (sub) google_protobuf_OneofOptions_set_features(msg, sub);
8581 }
8582 return sub;
8583}
Eric Salob7d54ac2022-12-29 11:59:42 -08008584UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008585 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 -08008586 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8587 if (arr) {
8588 if (size) *size = arr->size;
8589 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8590 } else {
8591 if (size) *size = 0;
8592 return NULL;
8593 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008594}
Eric Salob7d54ac2022-12-29 11:59:42 -08008595UPB_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 -07008596 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 -07008597 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008598}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008599UPB_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 -07008600 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 -08008601 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8602 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8603 return NULL;
8604 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008605 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 -08008606 if (!arr || !sub) return NULL;
8607 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008608 return sub;
8609}
8610
8611/* google.protobuf.EnumOptions */
8612
Joshua Habermanf41049a2022-01-21 14:41:25 -08008613UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008614 return (google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008615}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008616UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8617 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008618 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008619 if (upb_Decode(buf, size, ret, &google__protobuf__EnumOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008620 return NULL;
8621 }
8622 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008623}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008624UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size,
8625 const upb_ExtensionRegistry* extreg,
8626 int options, upb_Arena* arena) {
8627 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
8628 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008629 if (upb_Decode(buf, size, ret, &google__protobuf__EnumOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008630 kUpb_DecodeStatus_Ok) {
8631 return NULL;
8632 }
8633 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008634}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008635UPB_INLINE char* google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008636 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008637 (void)upb_Encode(msg, &google__protobuf__EnumOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008638 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008639}
8640UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options,
8641 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008642 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008643 (void)upb_Encode(msg, &google__protobuf__EnumOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008644 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008645}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008646UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008647 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 -08008648 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008649}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008650UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008651 bool default_val = false;
8652 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008653 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 -08008654 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008655 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008656}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008657UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008658 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 -08008659 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008660}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008661UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008662 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 -08008663 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008664}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008665UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008666 bool default_val = false;
8667 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008668 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 -08008669 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008670 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008671}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008672UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008673 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 -08008674 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008675}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008676UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008677 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 -08008678 _upb_Message_ClearNonExtensionField(msg, &field);
8679}
8680UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
8681 bool default_val = false;
8682 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008683 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 -08008684 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8685 return ret;
8686}
8687UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008688 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 -08008689 return _upb_Message_HasNonExtensionField(msg, &field);
8690}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008691UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) {
8692 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)};
8693 _upb_Message_ClearNonExtensionField(msg, &field);
8694}
8695UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) {
8696 const google_protobuf_FeatureSet* default_val = NULL;
8697 const google_protobuf_FeatureSet* ret;
8698 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)};
8699 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8700 return ret;
8701}
8702UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) {
8703 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)};
8704 return _upb_Message_HasNonExtensionField(msg, &field);
8705}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008706UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008707 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 -08008708 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008709}
Eric Salob7d54ac2022-12-29 11:59:42 -08008710UPB_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 -07008711 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 -08008712 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8713 if (arr) {
8714 if (size) *size = arr->size;
8715 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8716 } else {
8717 if (size) *size = 0;
8718 return NULL;
8719 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008720}
Deanna Garciab26afb52023-04-25 13:37:18 -07008721UPB_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 -07008722 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 -07008723 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8724 if (size) {
8725 *size = arr ? arr->size : 0;
8726 }
8727 return arr;
8728}
8729UPB_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 -07008730 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 -07008731 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8732 (upb_Message*)msg, &field, arena);
8733 if (size) {
8734 *size = arr ? arr->size : 0;
8735 }
8736 return arr;
8737}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008738UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) {
8739 size_t size;
8740 google_protobuf_EnumOptions_uninterpreted_option(msg, &size);
8741 return size != 0;
8742}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008743
8744UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008745 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 -08008746 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008747}
8748UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008749 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 -08008750 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008751}
8752UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008753 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 -08008754 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008755}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008756UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) {
8757 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)};
8758 _upb_Message_SetNonExtensionField(msg, &field, &value);
8759}
8760UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
8761 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg);
8762 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008763 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008764 if (sub) google_protobuf_EnumOptions_set_features(msg, sub);
8765 }
8766 return sub;
8767}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008768UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008769 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 -08008770 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8771 if (arr) {
8772 if (size) *size = arr->size;
8773 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8774 } else {
8775 if (size) *size = 0;
8776 return NULL;
8777 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008778}
Eric Salob7d54ac2022-12-29 11:59:42 -08008779UPB_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 -07008780 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 -07008781 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008782}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008783UPB_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 -07008784 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 -08008785 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8786 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8787 return NULL;
8788 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008789 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 -08008790 if (!arr || !sub) return NULL;
8791 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008792 return sub;
8793}
8794
8795/* google.protobuf.EnumValueOptions */
8796
Joshua Habermanf41049a2022-01-21 14:41:25 -08008797UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008798 return (google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008799}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008800UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8801 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008802 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008803 if (upb_Decode(buf, size, ret, &google__protobuf__EnumValueOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008804 return NULL;
8805 }
8806 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008807}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008808UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size,
8809 const upb_ExtensionRegistry* extreg,
8810 int options, upb_Arena* arena) {
8811 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
8812 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008813 if (upb_Decode(buf, size, ret, &google__protobuf__EnumValueOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008814 kUpb_DecodeStatus_Ok) {
8815 return NULL;
8816 }
8817 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008818}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008819UPB_INLINE char* google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008820 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008821 (void)upb_Encode(msg, &google__protobuf__EnumValueOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008822 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008823}
8824UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options,
8825 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008826 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008827 (void)upb_Encode(msg, &google__protobuf__EnumValueOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008828 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008829}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008830UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008831 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 -08008832 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008833}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008834UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008835 bool default_val = false;
8836 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008837 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 -08008838 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008839 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008840}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008841UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008842 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 -08008843 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008844}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008845UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) {
8846 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)};
8847 _upb_Message_ClearNonExtensionField(msg, &field);
8848}
8849UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) {
8850 const google_protobuf_FeatureSet* default_val = NULL;
8851 const google_protobuf_FeatureSet* ret;
8852 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)};
8853 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8854 return ret;
8855}
8856UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) {
8857 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)};
8858 return _upb_Message_HasNonExtensionField(msg, &field);
8859}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008860UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008861 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 -07008862 _upb_Message_ClearNonExtensionField(msg, &field);
8863}
8864UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) {
8865 bool default_val = false;
8866 bool ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008867 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 -07008868 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8869 return ret;
8870}
8871UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008872 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 -07008873 return _upb_Message_HasNonExtensionField(msg, &field);
8874}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008875UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008876 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 -08008877 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008878}
Eric Salob7d54ac2022-12-29 11:59:42 -08008879UPB_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 -07008880 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 -08008881 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8882 if (arr) {
8883 if (size) *size = arr->size;
8884 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8885 } else {
8886 if (size) *size = 0;
8887 return NULL;
8888 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008889}
Deanna Garciab26afb52023-04-25 13:37:18 -07008890UPB_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 -07008891 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 -07008892 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8893 if (size) {
8894 *size = arr ? arr->size : 0;
8895 }
8896 return arr;
8897}
8898UPB_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 -07008899 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 -07008900 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8901 (upb_Message*)msg, &field, arena);
8902 if (size) {
8903 *size = arr ? arr->size : 0;
8904 }
8905 return arr;
8906}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008907UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) {
8908 size_t size;
8909 google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size);
8910 return size != 0;
8911}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008912
8913UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008914 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 -08008915 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008916}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008917UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) {
8918 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)};
8919 _upb_Message_SetNonExtensionField(msg, &field, &value);
8920}
8921UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
8922 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg);
8923 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008924 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008925 if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub);
8926 }
8927 return sub;
8928}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008929UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008930 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 -07008931 _upb_Message_SetNonExtensionField(msg, &field, &value);
8932}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008933UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008934 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 -08008935 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8936 if (arr) {
8937 if (size) *size = arr->size;
8938 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8939 } else {
8940 if (size) *size = 0;
8941 return NULL;
8942 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008943}
Eric Salob7d54ac2022-12-29 11:59:42 -08008944UPB_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 -07008945 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 -07008946 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008947}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008948UPB_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 -07008949 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 -08008950 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8951 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8952 return NULL;
8953 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008954 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 -08008955 if (!arr || !sub) return NULL;
8956 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008957 return sub;
8958}
8959
8960/* google.protobuf.ServiceOptions */
8961
Joshua Habermanf41049a2022-01-21 14:41:25 -08008962UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008963 return (google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008964}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008965UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8966 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008967 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008968 if (upb_Decode(buf, size, ret, &google__protobuf__ServiceOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008969 return NULL;
8970 }
8971 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008972}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008973UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size,
8974 const upb_ExtensionRegistry* extreg,
8975 int options, upb_Arena* arena) {
8976 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
8977 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008978 if (upb_Decode(buf, size, ret, &google__protobuf__ServiceOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008979 kUpb_DecodeStatus_Ok) {
8980 return NULL;
8981 }
8982 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008983}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008984UPB_INLINE char* google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008985 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008986 (void)upb_Encode(msg, &google__protobuf__ServiceOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008987 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008988}
8989UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options,
8990 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008991 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008992 (void)upb_Encode(msg, &google__protobuf__ServiceOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008993 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008994}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008995UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008996 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 -08008997 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008998}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008999UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009000 bool default_val = false;
9001 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009002 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 -08009003 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009004 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009005}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009006UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009007 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 -08009008 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009009}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009010UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) {
9011 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)};
9012 _upb_Message_ClearNonExtensionField(msg, &field);
9013}
9014UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) {
9015 const google_protobuf_FeatureSet* default_val = NULL;
9016 const google_protobuf_FeatureSet* ret;
9017 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)};
9018 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9019 return ret;
9020}
9021UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) {
9022 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)};
9023 return _upb_Message_HasNonExtensionField(msg, &field);
9024}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009025UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009026 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 -08009027 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009028}
Eric Salob7d54ac2022-12-29 11:59:42 -08009029UPB_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 -07009030 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 -08009031 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9032 if (arr) {
9033 if (size) *size = arr->size;
9034 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
9035 } else {
9036 if (size) *size = 0;
9037 return NULL;
9038 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009039}
Deanna Garciab26afb52023-04-25 13:37:18 -07009040UPB_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 -07009041 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 -07009042 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9043 if (size) {
9044 *size = arr ? arr->size : 0;
9045 }
9046 return arr;
9047}
9048UPB_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 -07009049 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 -07009050 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9051 (upb_Message*)msg, &field, arena);
9052 if (size) {
9053 *size = arr ? arr->size : 0;
9054 }
9055 return arr;
9056}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009057UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) {
9058 size_t size;
9059 google_protobuf_ServiceOptions_uninterpreted_option(msg, &size);
9060 return size != 0;
9061}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009062
9063UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009064 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 -08009065 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009066}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009067UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) {
9068 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)};
9069 _upb_Message_SetNonExtensionField(msg, &field, &value);
9070}
9071UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
9072 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg);
9073 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009074 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009075 if (sub) google_protobuf_ServiceOptions_set_features(msg, sub);
9076 }
9077 return sub;
9078}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009079UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009080 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 -08009081 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9082 if (arr) {
9083 if (size) *size = arr->size;
9084 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
9085 } else {
9086 if (size) *size = 0;
9087 return NULL;
9088 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009089}
Eric Salob7d54ac2022-12-29 11:59:42 -08009090UPB_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 -07009091 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 -07009092 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009093}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009094UPB_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 -07009095 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 -08009096 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9097 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9098 return NULL;
9099 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009100 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 -08009101 if (!arr || !sub) return NULL;
9102 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009103 return sub;
9104}
9105
9106/* google.protobuf.MethodOptions */
9107
Joshua Habermanf41049a2022-01-21 14:41:25 -08009108UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009109 return (google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009110}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009111UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9112 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009113 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009114 if (upb_Decode(buf, size, ret, &google__protobuf__MethodOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009115 return NULL;
9116 }
9117 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009118}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009119UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size,
9120 const upb_ExtensionRegistry* extreg,
9121 int options, upb_Arena* arena) {
9122 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
9123 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009124 if (upb_Decode(buf, size, ret, &google__protobuf__MethodOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009125 kUpb_DecodeStatus_Ok) {
9126 return NULL;
9127 }
9128 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009129}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009130UPB_INLINE char* google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009131 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009132 (void)upb_Encode(msg, &google__protobuf__MethodOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009133 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009134}
9135UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options,
9136 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009137 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009138 (void)upb_Encode(msg, &google__protobuf__MethodOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009139 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009140}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009141UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009142 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 -08009143 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009144}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009145UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009146 bool default_val = false;
9147 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009148 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 -08009149 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009150 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009151}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009152UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009153 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 -08009154 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009155}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009156UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009157 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 -08009158 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009159}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009160UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009161 int32_t default_val = 0;
9162 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009163 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 -08009164 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009165 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009166}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009167UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009168 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9169 return _upb_Message_HasNonExtensionField(msg, &field);
9170}
9171UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) {
9172 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)};
9173 _upb_Message_ClearNonExtensionField(msg, &field);
9174}
9175UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) {
9176 const google_protobuf_FeatureSet* default_val = NULL;
9177 const google_protobuf_FeatureSet* ret;
9178 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)};
9179 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9180 return ret;
9181}
9182UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) {
9183 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 -08009184 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009185}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009186UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009187 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 -08009188 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009189}
Eric Salob7d54ac2022-12-29 11:59:42 -08009190UPB_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 -07009191 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 -08009192 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9193 if (arr) {
9194 if (size) *size = arr->size;
9195 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
9196 } else {
9197 if (size) *size = 0;
9198 return NULL;
9199 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009200}
Deanna Garciab26afb52023-04-25 13:37:18 -07009201UPB_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 -07009202 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 -07009203 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9204 if (size) {
9205 *size = arr ? arr->size : 0;
9206 }
9207 return arr;
9208}
9209UPB_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 -07009210 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 -07009211 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9212 (upb_Message*)msg, &field, arena);
9213 if (size) {
9214 *size = arr ? arr->size : 0;
9215 }
9216 return arr;
9217}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009218UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) {
9219 size_t size;
9220 google_protobuf_MethodOptions_uninterpreted_option(msg, &size);
9221 return size != 0;
9222}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009223
9224UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009225 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 -08009226 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009227}
9228UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009229 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 -08009230 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009231}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009232UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) {
9233 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)};
9234 _upb_Message_SetNonExtensionField(msg, &field, &value);
9235}
9236UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
9237 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg);
9238 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009239 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009240 if (sub) google_protobuf_MethodOptions_set_features(msg, sub);
9241 }
9242 return sub;
9243}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009244UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009245 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 -08009246 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9247 if (arr) {
9248 if (size) *size = arr->size;
9249 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
9250 } else {
9251 if (size) *size = 0;
9252 return NULL;
9253 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009254}
Eric Salob7d54ac2022-12-29 11:59:42 -08009255UPB_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 -07009256 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 -07009257 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009258}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009259UPB_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 -07009260 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 -08009261 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9262 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9263 return NULL;
9264 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009265 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 -08009266 if (!arr || !sub) return NULL;
9267 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009268 return sub;
9269}
9270
9271/* google.protobuf.UninterpretedOption */
9272
Joshua Habermanf41049a2022-01-21 14:41:25 -08009273UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009274 return (google_protobuf_UninterpretedOption*)_upb_Message_New(&google__protobuf__UninterpretedOption_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009275}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009276UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) {
9277 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009278 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009279 if (upb_Decode(buf, size, ret, &google__protobuf__UninterpretedOption_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009280 return NULL;
9281 }
9282 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009283}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009284UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size,
9285 const upb_ExtensionRegistry* extreg,
9286 int options, upb_Arena* arena) {
9287 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
9288 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009289 if (upb_Decode(buf, size, ret, &google__protobuf__UninterpretedOption_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009290 kUpb_DecodeStatus_Ok) {
9291 return NULL;
9292 }
9293 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009294}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009295UPB_INLINE char* google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009296 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009297 (void)upb_Encode(msg, &google__protobuf__UninterpretedOption_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009298 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009299}
9300UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options,
9301 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009302 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009303 (void)upb_Encode(msg, &google__protobuf__UninterpretedOption_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009304 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009305}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009306UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009307 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 -08009308 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009309}
Eric Salob7d54ac2022-12-29 11:59:42 -08009310UPB_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 -07009311 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 -08009312 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9313 if (arr) {
9314 if (size) *size = arr->size;
9315 return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr);
9316 } else {
9317 if (size) *size = 0;
9318 return NULL;
9319 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009320}
Deanna Garciab26afb52023-04-25 13:37:18 -07009321UPB_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 -07009322 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 -07009323 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9324 if (size) {
9325 *size = arr ? arr->size : 0;
9326 }
9327 return arr;
9328}
9329UPB_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 -07009330 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 -07009331 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9332 (upb_Message*)msg, &field, arena);
9333 if (size) {
9334 *size = arr ? arr->size : 0;
9335 }
9336 return arr;
9337}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009338UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) {
9339 size_t size;
9340 google_protobuf_UninterpretedOption_name(msg, &size);
9341 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009342}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009343UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009344 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 -08009345 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009346}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009347UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009348 upb_StringView default_val = upb_StringView_FromString("");
9349 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009350 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 -08009351 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009352 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009353}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009354UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009355 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 -08009356 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009357}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009358UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009359 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 -08009360 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009361}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009362UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009363 uint64_t default_val = (uint64_t)0ull;
9364 uint64_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07009365 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 -08009366 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009367 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009368}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009369UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009370 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 -08009371 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009372}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009373UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009374 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 -08009375 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009376}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009377UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009378 int64_t default_val = (int64_t)0ll;
9379 int64_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07009380 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 -08009381 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009382 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009383}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009384UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009385 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 -08009386 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009387}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009388UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009389 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 -08009390 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009391}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009392UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009393 double default_val = 0;
9394 double ret;
Jie Luo3560e232023-06-12 00:33:50 -07009395 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 -08009396 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009397 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009398}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009399UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009400 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 -08009401 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009402}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009403UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009404 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 -08009405 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009406}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009407UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009408 upb_StringView default_val = upb_StringView_FromString("");
9409 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009410 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 -08009411 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009412 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009413}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009414UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009415 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 -08009416 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009417}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009418UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009419 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 -08009420 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009421}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009422UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009423 upb_StringView default_val = upb_StringView_FromString("");
9424 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009425 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 -08009426 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009427 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009428}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009429UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009430 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 -08009431 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009432}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009433
Eric Salob7d54ac2022-12-29 11:59:42 -08009434UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009435 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 -08009436 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9437 if (arr) {
9438 if (size) *size = arr->size;
9439 return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr);
9440 } else {
9441 if (size) *size = 0;
9442 return NULL;
9443 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009444}
Eric Salob7d54ac2022-12-29 11:59:42 -08009445UPB_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 -07009446 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 -07009447 return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009448}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009449UPB_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 -07009450 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 -08009451 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9452 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9453 return NULL;
9454 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009455 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 -08009456 if (!arr || !sub) return NULL;
9457 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009458 return sub;
9459}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009460UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009461 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 -08009462 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009463}
9464UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07009465 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 -08009466 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009467}
9468UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07009469 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 -08009470 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009471}
9472UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
Jie Luo3560e232023-06-12 00:33:50 -07009473 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 -08009474 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009475}
9476UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009477 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 -08009478 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009479}
9480UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009481 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 -08009482 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009483}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009484
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009485/* google.protobuf.UninterpretedOption.NamePart */
9486
Joshua Habermanf41049a2022-01-21 14:41:25 -08009487UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009488 return (google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google__protobuf__UninterpretedOption__NamePart_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009489}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009490UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) {
9491 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009492 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009493 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 -07009494 return NULL;
9495 }
9496 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009497}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009498UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size,
9499 const upb_ExtensionRegistry* extreg,
9500 int options, upb_Arena* arena) {
9501 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
9502 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009503 if (upb_Decode(buf, size, ret, &google__protobuf__UninterpretedOption__NamePart_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009504 kUpb_DecodeStatus_Ok) {
9505 return NULL;
9506 }
9507 return ret;
9508}
9509UPB_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 -07009510 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009511 (void)upb_Encode(msg, &google__protobuf__UninterpretedOption__NamePart_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009512 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009513}
9514UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options,
9515 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009516 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009517 (void)upb_Encode(msg, &google__protobuf__UninterpretedOption__NamePart_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009518 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009519}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009520UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009521 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 -08009522 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009523}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009524UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009525 upb_StringView default_val = upb_StringView_FromString("");
9526 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009527 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 -08009528 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009529 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009530}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009531UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009532 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 -08009533 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009534}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009535UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009536 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 -08009537 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009538}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009539UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009540 bool default_val = false;
9541 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009542 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 -08009543 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009544 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009545}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009546UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009547 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 -08009548 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009549}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009550
Joshua Habermanf41049a2022-01-21 14:41:25 -08009551UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009552 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 -08009553 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009554}
9555UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009556 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 -08009557 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009558}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009559
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009560/* google.protobuf.FeatureSet */
9561
9562UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009563 return (google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009564}
9565UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) {
9566 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
9567 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009568 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009569 return NULL;
9570 }
9571 return ret;
9572}
9573UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size,
9574 const upb_ExtensionRegistry* extreg,
9575 int options, upb_Arena* arena) {
9576 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
9577 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009578 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSet_msg_init, extreg, options, arena) !=
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009579 kUpb_DecodeStatus_Ok) {
9580 return NULL;
9581 }
9582 return ret;
9583}
9584UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) {
9585 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009586 (void)upb_Encode(msg, &google__protobuf__FeatureSet_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009587 return ptr;
9588}
9589UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options,
9590 upb_Arena* arena, size_t* len) {
9591 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009592 (void)upb_Encode(msg, &google__protobuf__FeatureSet_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009593 return ptr;
9594}
9595UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009596 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 -07009597 _upb_Message_ClearNonExtensionField(msg, &field);
9598}
9599UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) {
9600 int32_t default_val = 0;
9601 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009602 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 -07009603 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9604 return ret;
9605}
9606UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009607 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 -07009608 return _upb_Message_HasNonExtensionField(msg, &field);
9609}
9610UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009611 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 -07009612 _upb_Message_ClearNonExtensionField(msg, &field);
9613}
9614UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) {
9615 int32_t default_val = 0;
9616 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009617 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 -07009618 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9619 return ret;
9620}
9621UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009622 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 -07009623 return _upb_Message_HasNonExtensionField(msg, &field);
9624}
9625UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009626 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 -07009627 _upb_Message_ClearNonExtensionField(msg, &field);
9628}
9629UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
9630 int32_t default_val = 0;
9631 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009632 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 -07009633 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9634 return ret;
9635}
9636UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009637 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 -07009638 return _upb_Message_HasNonExtensionField(msg, &field);
9639}
Protobuf Team Bot61127952023-09-26 20:07:33 +00009640UPB_INLINE void google_protobuf_FeatureSet_clear_utf8_validation(google_protobuf_FeatureSet* msg) {
9641 const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9642 _upb_Message_ClearNonExtensionField(msg, &field);
9643}
9644UPB_INLINE int32_t google_protobuf_FeatureSet_utf8_validation(const google_protobuf_FeatureSet* msg) {
9645 int32_t default_val = 0;
9646 int32_t ret;
9647 const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9648 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9649 return ret;
9650}
9651UPB_INLINE bool google_protobuf_FeatureSet_has_utf8_validation(const google_protobuf_FeatureSet* msg) {
9652 const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9653 return _upb_Message_HasNonExtensionField(msg, &field);
9654}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009655UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009656 const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009657 _upb_Message_ClearNonExtensionField(msg, &field);
9658}
9659UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) {
9660 int32_t default_val = 0;
9661 int32_t ret;
Protobuf Team Bot61127952023-09-26 20:07:33 +00009662 const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009663 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9664 return ret;
9665}
9666UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009667 const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009668 return _upb_Message_HasNonExtensionField(msg, &field);
9669}
9670UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009671 const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009672 _upb_Message_ClearNonExtensionField(msg, &field);
9673}
9674UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) {
9675 int32_t default_val = 0;
9676 int32_t ret;
Protobuf Team Bot61127952023-09-26 20:07:33 +00009677 const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009678 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9679 return ret;
9680}
9681UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009682 const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009683 return _upb_Message_HasNonExtensionField(msg, &field);
9684}
9685
9686UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009687 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 -07009688 _upb_Message_SetNonExtensionField(msg, &field, &value);
9689}
9690UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009691 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 -07009692 _upb_Message_SetNonExtensionField(msg, &field, &value);
9693}
9694UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009695 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 -07009696 _upb_Message_SetNonExtensionField(msg, &field, &value);
9697}
Protobuf Team Bot61127952023-09-26 20:07:33 +00009698UPB_INLINE void google_protobuf_FeatureSet_set_utf8_validation(google_protobuf_FeatureSet *msg, int32_t value) {
9699 const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9700 _upb_Message_SetNonExtensionField(msg, &field, &value);
9701}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009702UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009703 const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009704 _upb_Message_SetNonExtensionField(msg, &field, &value);
9705}
9706UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009707 const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009708 _upb_Message_SetNonExtensionField(msg, &field, &value);
9709}
9710
Mike Kruskalba964702023-08-22 17:37:48 -07009711/* google.protobuf.FeatureSetDefaults */
9712
9713UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009714 return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google__protobuf__FeatureSetDefaults_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -07009715}
9716UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) {
9717 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
9718 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009719 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -07009720 return NULL;
9721 }
9722 return ret;
9723}
9724UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size,
9725 const upb_ExtensionRegistry* extreg,
9726 int options, upb_Arena* arena) {
9727 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
9728 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009729 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults_msg_init, extreg, options, arena) !=
Mike Kruskalba964702023-08-22 17:37:48 -07009730 kUpb_DecodeStatus_Ok) {
9731 return NULL;
9732 }
9733 return ret;
9734}
9735UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) {
9736 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009737 (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -07009738 return ptr;
9739}
9740UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options,
9741 upb_Arena* arena, size_t* len) {
9742 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009743 (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -07009744 return ptr;
9745}
9746UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_defaults(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009747 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 -07009748 _upb_Message_ClearNonExtensionField(msg, &field);
9749}
9750UPB_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 +00009751 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 -07009752 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9753 if (arr) {
9754 if (size) *size = arr->size;
9755 return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)_upb_array_constptr(arr);
9756 } else {
9757 if (size) *size = 0;
9758 return NULL;
9759 }
9760}
9761UPB_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 +00009762 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 -07009763 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9764 if (size) {
9765 *size = arr ? arr->size : 0;
9766 }
9767 return arr;
9768}
9769UPB_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 +00009770 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 -07009771 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9772 (upb_Message*)msg, &field, arena);
9773 if (size) {
9774 *size = arr ? arr->size : 0;
9775 }
9776 return arr;
9777}
9778UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_defaults(const google_protobuf_FeatureSetDefaults* msg) {
9779 size_t size;
9780 google_protobuf_FeatureSetDefaults_defaults(msg, &size);
9781 return size != 0;
9782}
9783UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009784 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009785 _upb_Message_ClearNonExtensionField(msg, &field);
9786}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009787UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
9788 int32_t default_val = 0;
9789 int32_t ret;
9790 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009791 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9792 return ret;
9793}
9794UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009795 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009796 return _upb_Message_HasNonExtensionField(msg, &field);
9797}
9798UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009799 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009800 _upb_Message_ClearNonExtensionField(msg, &field);
9801}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009802UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
9803 int32_t default_val = 0;
9804 int32_t ret;
9805 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009806 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9807 return ret;
9808}
9809UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009810 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009811 return _upb_Message_HasNonExtensionField(msg, &field);
9812}
9813
9814UPB_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 +00009815 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 -07009816 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9817 if (arr) {
9818 if (size) *size = arr->size;
9819 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)_upb_array_ptr(arr);
9820 } else {
9821 if (size) *size = 0;
9822 return NULL;
9823 }
9824}
9825UPB_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 +00009826 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 -07009827 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
9828}
9829UPB_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 +00009830 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 -07009831 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9832 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9833 return NULL;
9834 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009835 struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* sub = (struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -07009836 if (!arr || !sub) return NULL;
9837 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
9838 return sub;
9839}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009840UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
9841 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009842 _upb_Message_SetNonExtensionField(msg, &field, &value);
9843}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009844UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
9845 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009846 _upb_Message_SetNonExtensionField(msg, &field, &value);
9847}
9848
9849/* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */
9850
9851UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009852 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -07009853}
9854UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
9855 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
9856 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009857 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -07009858 return NULL;
9859 }
9860 return ret;
9861}
9862UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size,
9863 const upb_ExtensionRegistry* extreg,
9864 int options, upb_Arena* arena) {
9865 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
9866 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009867 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, extreg, options, arena) !=
Mike Kruskalba964702023-08-22 17:37:48 -07009868 kUpb_DecodeStatus_Ok) {
9869 return NULL;
9870 }
9871 return ret;
9872}
9873UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) {
9874 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009875 (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -07009876 return ptr;
9877}
9878UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options,
9879 upb_Arena* arena, size_t* len) {
9880 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009881 (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -07009882 return ptr;
9883}
Mike Kruskalba964702023-08-22 17:37:48 -07009884UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009885 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009886 _upb_Message_ClearNonExtensionField(msg, &field);
9887}
9888UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9889 const google_protobuf_FeatureSet* default_val = NULL;
9890 const google_protobuf_FeatureSet* ret;
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009891 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009892 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9893 return ret;
9894}
9895UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009896 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009897 return _upb_Message_HasNonExtensionField(msg, &field);
9898}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009899UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9900 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009901 _upb_Message_ClearNonExtensionField(msg, &field);
9902}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009903UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009904 int32_t default_val = 0;
9905 int32_t ret;
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009906 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009907 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9908 return ret;
9909}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009910UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9911 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009912 return _upb_Message_HasNonExtensionField(msg, &field);
9913}
Mike Kruskalba964702023-08-22 17:37:48 -07009914
Mike Kruskalba964702023-08-22 17:37:48 -07009915UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009916 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009917 _upb_Message_SetNonExtensionField(msg, &field, &value);
9918}
9919UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
9920 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg);
9921 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009922 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -07009923 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub);
9924 }
9925 return sub;
9926}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009927UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
9928 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009929 _upb_Message_SetNonExtensionField(msg, &field, &value);
9930}
Mike Kruskalba964702023-08-22 17:37:48 -07009931
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009932/* google.protobuf.SourceCodeInfo */
9933
Joshua Habermanf41049a2022-01-21 14:41:25 -08009934UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009935 return (google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009936}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009937UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
9938 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009939 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009940 if (upb_Decode(buf, size, ret, &google__protobuf__SourceCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009941 return NULL;
9942 }
9943 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009944}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009945UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size,
9946 const upb_ExtensionRegistry* extreg,
9947 int options, upb_Arena* arena) {
9948 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
9949 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009950 if (upb_Decode(buf, size, ret, &google__protobuf__SourceCodeInfo_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009951 kUpb_DecodeStatus_Ok) {
9952 return NULL;
9953 }
9954 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009955}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009956UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009957 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009958 (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009959 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009960}
9961UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options,
9962 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009963 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009964 (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009965 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009966}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009967UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009968 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 -08009969 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009970}
Eric Salob7d54ac2022-12-29 11:59:42 -08009971UPB_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 -07009972 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 -08009973 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9974 if (arr) {
9975 if (size) *size = arr->size;
9976 return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr);
9977 } else {
9978 if (size) *size = 0;
9979 return NULL;
9980 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009981}
Deanna Garciab26afb52023-04-25 13:37:18 -07009982UPB_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 -07009983 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 -07009984 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9985 if (size) {
9986 *size = arr ? arr->size : 0;
9987 }
9988 return arr;
9989}
9990UPB_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 -07009991 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 -07009992 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9993 (upb_Message*)msg, &field, arena);
9994 if (size) {
9995 *size = arr ? arr->size : 0;
9996 }
9997 return arr;
9998}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009999UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) {
10000 size_t size;
10001 google_protobuf_SourceCodeInfo_location(msg, &size);
10002 return size != 0;
10003}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010004
Eric Salob7d54ac2022-12-29 11:59:42 -080010005UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010006 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 -080010007 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10008 if (arr) {
10009 if (size) *size = arr->size;
10010 return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr);
10011 } else {
10012 if (size) *size = 0;
10013 return NULL;
10014 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010015}
Eric Salob7d54ac2022-12-29 11:59:42 -080010016UPB_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 -070010017 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 -070010018 return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010019}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010020UPB_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 -070010021 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 -080010022 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10023 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10024 return NULL;
10025 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010026 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 -080010027 if (!arr || !sub) return NULL;
10028 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010029 return sub;
10030}
10031
10032/* google.protobuf.SourceCodeInfo.Location */
10033
Joshua Habermanf41049a2022-01-21 14:41:25 -080010034UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010035 return (google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google__protobuf__SourceCodeInfo__Location_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010036}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010037UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) {
10038 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010039 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010040 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 -070010041 return NULL;
10042 }
10043 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010044}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010045UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size,
10046 const upb_ExtensionRegistry* extreg,
10047 int options, upb_Arena* arena) {
10048 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
10049 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010050 if (upb_Decode(buf, size, ret, &google__protobuf__SourceCodeInfo__Location_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010051 kUpb_DecodeStatus_Ok) {
10052 return NULL;
10053 }
10054 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010055}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010056UPB_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 -070010057 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010058 (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo__Location_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010059 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010060}
10061UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options,
10062 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010063 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010064 (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo__Location_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010065 return ptr;
10066}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010067UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010068 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 -080010069 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010070}
Eric Salob7d54ac2022-12-29 11:59:42 -080010071UPB_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 -070010072 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 -080010073 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10074 if (arr) {
10075 if (size) *size = arr->size;
10076 return (int32_t const*)_upb_array_constptr(arr);
10077 } else {
10078 if (size) *size = 0;
10079 return NULL;
10080 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070010081}
Deanna Garciab26afb52023-04-25 13:37:18 -070010082UPB_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 -070010083 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 -070010084 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10085 if (size) {
10086 *size = arr ? arr->size : 0;
10087 }
10088 return arr;
10089}
10090UPB_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 -070010091 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 -070010092 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10093 (upb_Message*)msg, &field, arena);
10094 if (size) {
10095 *size = arr ? arr->size : 0;
10096 }
10097 return arr;
10098}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010099UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) {
10100 size_t size;
10101 google_protobuf_SourceCodeInfo_Location_path(msg, &size);
10102 return size != 0;
10103}
10104UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010105 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 -080010106 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010107}
Eric Salob7d54ac2022-12-29 11:59:42 -080010108UPB_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 -070010109 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 -080010110 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10111 if (arr) {
10112 if (size) *size = arr->size;
10113 return (int32_t const*)_upb_array_constptr(arr);
10114 } else {
10115 if (size) *size = 0;
10116 return NULL;
10117 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010118}
Deanna Garciab26afb52023-04-25 13:37:18 -070010119UPB_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 -070010120 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 -070010121 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10122 if (size) {
10123 *size = arr ? arr->size : 0;
10124 }
10125 return arr;
10126}
10127UPB_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 -070010128 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 -070010129 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10130 (upb_Message*)msg, &field, arena);
10131 if (size) {
10132 *size = arr ? arr->size : 0;
10133 }
10134 return arr;
10135}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010136UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) {
10137 size_t size;
10138 google_protobuf_SourceCodeInfo_Location_span(msg, &size);
10139 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010140}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010141UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010142 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 -080010143 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010144}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010145UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010146 upb_StringView default_val = upb_StringView_FromString("");
10147 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010148 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 -080010149 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010150 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010151}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010152UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010153 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 -080010154 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010155}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010156UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010157 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 -080010158 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010159}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010160UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010161 upb_StringView default_val = upb_StringView_FromString("");
10162 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010163 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 -080010164 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010165 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010166}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010167UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010168 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 -080010169 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010170}
10171UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010172 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 -080010173 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010174}
Eric Salob7d54ac2022-12-29 11:59:42 -080010175UPB_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 -070010176 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 -080010177 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10178 if (arr) {
10179 if (size) *size = arr->size;
10180 return (upb_StringView const*)_upb_array_constptr(arr);
10181 } else {
10182 if (size) *size = 0;
10183 return NULL;
10184 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010185}
Deanna Garciab26afb52023-04-25 13:37:18 -070010186UPB_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 -070010187 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 -070010188 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10189 if (size) {
10190 *size = arr ? arr->size : 0;
10191 }
10192 return arr;
10193}
10194UPB_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 -070010195 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 -070010196 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10197 (upb_Message*)msg, &field, arena);
10198 if (size) {
10199 *size = arr ? arr->size : 0;
10200 }
10201 return arr;
10202}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010203UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
10204 size_t size;
10205 google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size);
10206 return size != 0;
10207}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010208
Eric Salob7d54ac2022-12-29 11:59:42 -080010209UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010210 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 -080010211 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10212 if (arr) {
10213 if (size) *size = arr->size;
10214 return (int32_t*)_upb_array_ptr(arr);
10215 } else {
10216 if (size) *size = 0;
10217 return NULL;
10218 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010219}
Eric Salob7d54ac2022-12-29 11:59:42 -080010220UPB_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 -070010221 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 -070010222 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010223}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010224UPB_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 -070010225 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 -080010226 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10227 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10228 return false;
10229 }
10230 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10231 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010232}
Eric Salob7d54ac2022-12-29 11:59:42 -080010233UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010234 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 -080010235 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10236 if (arr) {
10237 if (size) *size = arr->size;
10238 return (int32_t*)_upb_array_ptr(arr);
10239 } else {
10240 if (size) *size = 0;
10241 return NULL;
10242 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010243}
Eric Salob7d54ac2022-12-29 11:59:42 -080010244UPB_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 -070010245 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 -070010246 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010247}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010248UPB_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 -070010249 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 -080010250 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10251 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10252 return false;
10253 }
10254 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10255 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010256}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010257UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010258 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 -080010259 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010260}
10261UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010262 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 -080010263 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010264}
10265UPB_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 -070010266 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 -080010267 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10268 if (arr) {
10269 if (size) *size = arr->size;
10270 return (upb_StringView*)_upb_array_ptr(arr);
10271 } else {
10272 if (size) *size = 0;
10273 return NULL;
10274 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010275}
Eric Salob7d54ac2022-12-29 11:59:42 -080010276UPB_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 -070010277 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 -070010278 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010279}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010280UPB_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 -070010281 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 -080010282 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10283 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10284 return false;
10285 }
10286 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10287 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010288}
10289
10290/* google.protobuf.GeneratedCodeInfo */
10291
Joshua Habermanf41049a2022-01-21 14:41:25 -080010292UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010293 return (google_protobuf_GeneratedCodeInfo*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010294}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010295UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
10296 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010297 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010298 if (upb_Decode(buf, size, ret, &google__protobuf__GeneratedCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010299 return NULL;
10300 }
10301 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010302}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010303UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size,
10304 const upb_ExtensionRegistry* extreg,
10305 int options, upb_Arena* arena) {
10306 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
10307 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010308 if (upb_Decode(buf, size, ret, &google__protobuf__GeneratedCodeInfo_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010309 kUpb_DecodeStatus_Ok) {
10310 return NULL;
10311 }
10312 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010313}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010314UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010315 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010316 (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010317 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010318}
10319UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options,
10320 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010321 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010322 (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010323 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010324}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010325UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010326 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 -080010327 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010328}
Eric Salob7d54ac2022-12-29 11:59:42 -080010329UPB_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 -070010330 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 -080010331 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10332 if (arr) {
10333 if (size) *size = arr->size;
10334 return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr);
10335 } else {
10336 if (size) *size = 0;
10337 return NULL;
10338 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010339}
Deanna Garciab26afb52023-04-25 13:37:18 -070010340UPB_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 -070010341 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 -070010342 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10343 if (size) {
10344 *size = arr ? arr->size : 0;
10345 }
10346 return arr;
10347}
10348UPB_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 -070010349 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 -070010350 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10351 (upb_Message*)msg, &field, arena);
10352 if (size) {
10353 *size = arr ? arr->size : 0;
10354 }
10355 return arr;
10356}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010357UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) {
10358 size_t size;
10359 google_protobuf_GeneratedCodeInfo_annotation(msg, &size);
10360 return size != 0;
10361}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010362
Eric Salob7d54ac2022-12-29 11:59:42 -080010363UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010364 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 -080010365 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10366 if (arr) {
10367 if (size) *size = arr->size;
10368 return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr);
10369 } else {
10370 if (size) *size = 0;
10371 return NULL;
10372 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010373}
Eric Salob7d54ac2022-12-29 11:59:42 -080010374UPB_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 -070010375 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 -070010376 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010377}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010378UPB_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 -070010379 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 -080010380 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10381 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10382 return NULL;
10383 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010384 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 -080010385 if (!arr || !sub) return NULL;
10386 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010387 return sub;
10388}
10389
10390/* google.protobuf.GeneratedCodeInfo.Annotation */
10391
Joshua Habermanf41049a2022-01-21 14:41:25 -080010392UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010393 return (google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo__Annotation_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010394}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010395UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) {
10396 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010397 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010398 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 -070010399 return NULL;
10400 }
10401 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010402}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010403UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size,
10404 const upb_ExtensionRegistry* extreg,
10405 int options, upb_Arena* arena) {
10406 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
10407 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010408 if (upb_Decode(buf, size, ret, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010409 kUpb_DecodeStatus_Ok) {
10410 return NULL;
10411 }
10412 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010413}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010414UPB_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 -070010415 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010416 (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010417 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010418}
10419UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options,
10420 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010421 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010422 (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010423 return ptr;
10424}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010425UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010426 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 -080010427 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010428}
Eric Salob7d54ac2022-12-29 11:59:42 -080010429UPB_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 -070010430 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 -080010431 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10432 if (arr) {
10433 if (size) *size = arr->size;
10434 return (int32_t const*)_upb_array_constptr(arr);
10435 } else {
10436 if (size) *size = 0;
10437 return NULL;
10438 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010439}
Deanna Garciab26afb52023-04-25 13:37:18 -070010440UPB_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 -070010441 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 -070010442 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10443 if (size) {
10444 *size = arr ? arr->size : 0;
10445 }
10446 return arr;
10447}
10448UPB_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 -070010449 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 -070010450 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10451 (upb_Message*)msg, &field, arena);
10452 if (size) {
10453 *size = arr ? arr->size : 0;
10454 }
10455 return arr;
10456}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010457UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
10458 size_t size;
10459 google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size);
10460 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010461}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010462UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010463 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 -080010464 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010465}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010466UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010467 upb_StringView default_val = upb_StringView_FromString("");
10468 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010469 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 -080010470 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010471 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010472}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010473UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010474 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 -080010475 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010476}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010477UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010478 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 -080010479 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010480}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010481UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010482 int32_t default_val = (int32_t)0;
10483 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010484 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 -080010485 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010486 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010487}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010488UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010489 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 -080010490 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010491}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010492UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010493 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 -080010494 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010495}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010496UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010497 int32_t default_val = (int32_t)0;
10498 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010499 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 -080010500 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010501 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010502}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010503UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010504 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 -080010505 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010506}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010507UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010508 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 -080010509 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010510}
10511UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010512 int32_t default_val = 0;
10513 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010514 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 -080010515 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010516 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010517}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010518UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010519 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 -080010520 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010521}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010522
Eric Salob7d54ac2022-12-29 11:59:42 -080010523UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010524 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 -080010525 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10526 if (arr) {
10527 if (size) *size = arr->size;
10528 return (int32_t*)_upb_array_ptr(arr);
10529 } else {
10530 if (size) *size = 0;
10531 return NULL;
10532 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010533}
Eric Salob7d54ac2022-12-29 11:59:42 -080010534UPB_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 -070010535 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 -070010536 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010537}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010538UPB_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 -070010539 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 -080010540 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10541 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10542 return false;
10543 }
10544 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10545 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010546}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010547UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010548 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 -080010549 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010550}
10551UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010552 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 -080010553 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010554}
10555UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010556 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 -080010557 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010558}
10559UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010560 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 -080010561 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010562}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010563
Joshua Habermanf41049a2022-01-21 14:41:25 -080010564/* Max size 32 is google.protobuf.FileOptions */
10565/* Max size 64 is google.protobuf.FileOptions */
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010566#define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200)
Joshua Habermanf41049a2022-01-21 14:41:25 -080010567
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010568#ifdef __cplusplus
10569} /* extern "C" */
10570#endif
10571
10572
10573#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
Mike Kruskal232ecf42023-01-14 00:09:40 -080010574// end:github_only
Eric Salo8809a112022-11-21 13:01:06 -080010575
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000010576typedef enum {
10577 kUpb_Syntax_Proto2 = 2,
10578 kUpb_Syntax_Proto3 = 3,
10579 kUpb_Syntax_Editions = 99
10580} upb_Syntax;
Eric Salo8809a112022-11-21 13:01:06 -080010581
10582// Forward declarations for circular references.
10583typedef struct upb_DefPool upb_DefPool;
10584typedef struct upb_EnumDef upb_EnumDef;
10585typedef struct upb_EnumReservedRange upb_EnumReservedRange;
10586typedef struct upb_EnumValueDef upb_EnumValueDef;
10587typedef struct upb_ExtensionRange upb_ExtensionRange;
10588typedef struct upb_FieldDef upb_FieldDef;
10589typedef struct upb_FileDef upb_FileDef;
10590typedef struct upb_MessageDef upb_MessageDef;
10591typedef struct upb_MessageReservedRange upb_MessageReservedRange;
10592typedef struct upb_MethodDef upb_MethodDef;
10593typedef struct upb_OneofDef upb_OneofDef;
10594typedef struct upb_ServiceDef upb_ServiceDef;
10595
10596// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
10597
10598typedef struct upb_DefBuilder upb_DefBuilder;
10599
10600#endif /* UPB_REFLECTION_COMMON_H_ */
10601
10602#ifndef UPB_REFLECTION_DEF_TYPE_H_
10603#define UPB_REFLECTION_DEF_TYPE_H_
10604
10605
10606// Must be last.
10607
10608// Inside a symtab we store tagged pointers to specific def types.
10609typedef enum {
10610 UPB_DEFTYPE_MASK = 7,
10611
10612 // Only inside symtab table.
10613 UPB_DEFTYPE_EXT = 0,
10614 UPB_DEFTYPE_MSG = 1,
10615 UPB_DEFTYPE_ENUM = 2,
10616 UPB_DEFTYPE_ENUMVAL = 3,
10617 UPB_DEFTYPE_SERVICE = 4,
10618
10619 // Only inside message table.
10620 UPB_DEFTYPE_FIELD = 0,
10621 UPB_DEFTYPE_ONEOF = 1,
Eric Salo8809a112022-11-21 13:01:06 -080010622} upb_deftype_t;
10623
10624#ifdef __cplusplus
10625extern "C" {
10626#endif
10627
10628// Our 3-bit pointer tagging requires all pointers to be multiples of 8.
10629// The arena will always yield 8-byte-aligned addresses, however we put
10630// the defs into arrays. For each element in the array to be 8-byte-aligned,
10631// the sizes of each def type must also be a multiple of 8.
10632//
10633// If any of these asserts fail, we need to add or remove padding on 32-bit
10634// machines (64-bit machines will have 8-byte alignment already due to
10635// pointers, which all of these structs have).
10636UPB_INLINE void _upb_DefType_CheckPadding(size_t size) {
10637 UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0);
10638}
10639
10640upb_deftype_t _upb_DefType_Type(upb_value v);
10641
10642upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type);
10643
10644const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type);
10645
10646#ifdef __cplusplus
10647} /* extern "C" */
10648#endif
10649
10650
10651#endif /* UPB_REFLECTION_DEF_TYPE_H_ */
10652
10653// Must be last.
10654
10655#ifdef __cplusplus
10656extern "C" {
10657#endif
10658
Jason Lunn67dee292023-07-13 13:15:26 -070010659UPB_API void upb_DefPool_Free(upb_DefPool* s);
Eric Salo8809a112022-11-21 13:01:06 -080010660
Jason Lunn67dee292023-07-13 13:15:26 -070010661UPB_API upb_DefPool* upb_DefPool_New(void);
Eric Salo8809a112022-11-21 13:01:06 -080010662
Jason Lunn67dee292023-07-13 13:15:26 -070010663UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName(
10664 const upb_DefPool* s, const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080010665
10666const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize(
10667 const upb_DefPool* s, const char* sym, size_t len);
10668
Jason Lunn67dee292023-07-13 13:15:26 -070010669UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s,
10670 const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080010671
10672const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s,
10673 const char* sym);
10674
10675const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s,
10676 const char* name);
10677
10678const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s,
10679 const char* name,
10680 size_t len);
10681
10682const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable(
10683 const upb_DefPool* s, const upb_MiniTableExtension* ext);
10684
10685const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s,
10686 const char* sym);
10687
10688const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize(
10689 const upb_DefPool* s, const char* name, size_t size);
10690
10691const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
10692 const upb_MessageDef* m,
10693 int32_t fieldnum);
10694
10695const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s,
10696 const char* name);
10697
10698const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
10699 const upb_DefPool* s, const char* name, size_t size);
10700
10701const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s,
10702 const char* name);
10703
Jason Lunn67dee292023-07-13 13:15:26 -070010704UPB_API const upb_FileDef* upb_DefPool_AddFile(
10705 upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto,
10706 upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080010707
10708const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry(
10709 const upb_DefPool* s);
10710
10711const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s,
10712 const upb_MessageDef* m,
10713 size_t* count);
10714
10715#ifdef __cplusplus
10716} /* extern "C" */
10717#endif
10718
10719
10720#endif /* UPB_REFLECTION_DEF_POOL_H_ */
10721
Protobuf Team Bot06310352023-09-26 21:54:58 +000010722// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010723
10724#ifndef UPB_REFLECTION_ENUM_DEF_H_
10725#define UPB_REFLECTION_ENUM_DEF_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -070010726
10727
10728// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010729
10730#ifdef __cplusplus
10731extern "C" {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010732#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010733
Eric Salo8809a112022-11-21 13:01:06 -080010734bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num);
10735const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e);
10736int32_t upb_EnumDef_Default(const upb_EnumDef* e);
Jason Lunn67dee292023-07-13 13:15:26 -070010737UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010738const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
10739 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070010740UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080010741 const upb_EnumDef* e, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070010742UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
10743 const upb_EnumDef* e, int32_t num);
10744UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010745bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
10746bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
10747
10748// Creates a mini descriptor string for an enum, returns true on success.
10749bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
10750 upb_StringView* out);
10751
10752const char* upb_EnumDef_Name(const upb_EnumDef* e);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010753const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010754
10755upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i);
10756int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e);
10757
10758const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e,
10759 int i);
10760int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e);
10761
Jason Lunn67dee292023-07-13 13:15:26 -070010762UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i);
10763UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010764
10765#ifdef __cplusplus
10766} /* extern "C" */
10767#endif
10768
10769
10770#endif /* UPB_REFLECTION_ENUM_DEF_H_ */
10771
Protobuf Team Bot06310352023-09-26 21:54:58 +000010772// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010773
10774#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_
10775#define UPB_REFLECTION_ENUM_VALUE_DEF_H_
10776
10777
10778// Must be last.
10779
10780#ifdef __cplusplus
10781extern "C" {
10782#endif
10783
10784const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v);
10785const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v);
10786bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v);
10787uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v);
Jason Lunn67dee292023-07-13 13:15:26 -070010788UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v);
10789UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010790const UPB_DESC(EnumValueOptions) *
10791 upb_EnumValueDef_Options(const upb_EnumValueDef* v);
Eric Salo8809a112022-11-21 13:01:06 -080010792
10793#ifdef __cplusplus
10794} /* extern "C" */
10795#endif
10796
10797
10798#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */
10799
Protobuf Team Bot06310352023-09-26 21:54:58 +000010800// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010801
10802#ifndef UPB_REFLECTION_EXTENSION_RANGE_H_
10803#define UPB_REFLECTION_EXTENSION_RANGE_H_
10804
10805
10806// Must be last.
10807
10808#ifdef __cplusplus
10809extern "C" {
10810#endif
10811
10812int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r);
10813int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r);
10814
10815bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010816const UPB_DESC(ExtensionRangeOptions) *
10817 upb_ExtensionRange_Options(const upb_ExtensionRange* r);
Eric Salo8809a112022-11-21 13:01:06 -080010818
10819#ifdef __cplusplus
10820} /* extern "C" */
10821#endif
10822
10823
10824#endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */
10825
Protobuf Team Bot06310352023-09-26 21:54:58 +000010826// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010827
10828#ifndef UPB_REFLECTION_FIELD_DEF_H_
10829#define UPB_REFLECTION_FIELD_DEF_H_
10830
10831
10832// Must be last.
10833
10834// Maximum field number allowed for FieldDefs.
10835// This is an inherent limit of the protobuf wire format.
10836#define kUpb_MaxFieldNumber ((1 << 29) - 1)
10837
10838#ifdef __cplusplus
10839extern "C" {
10840#endif
10841
10842const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010843UPB_API const upb_MessageDef* upb_FieldDef_ContainingType(
10844 const upb_FieldDef* f);
10845UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f);
10846UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f);
10847UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010848const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010849UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010850const char* upb_FieldDef_FullName(const upb_FieldDef* f);
10851bool upb_FieldDef_HasDefault(const upb_FieldDef* f);
10852bool upb_FieldDef_HasJsonName(const upb_FieldDef* f);
10853bool upb_FieldDef_HasOptions(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010854UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010855bool upb_FieldDef_HasSubDef(const upb_FieldDef* f);
10856uint32_t upb_FieldDef_Index(const upb_FieldDef* f);
10857bool upb_FieldDef_IsExtension(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010858UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010859bool upb_FieldDef_IsOptional(const upb_FieldDef* f);
10860bool upb_FieldDef_IsPacked(const upb_FieldDef* f);
10861bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010862UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010863bool upb_FieldDef_IsRequired(const upb_FieldDef* f);
10864bool upb_FieldDef_IsString(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010865UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
10866UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
10867UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
10868UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
Protobuf Team Botb58bd402023-09-19 15:42:34 +000010869bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010870
10871// Creates a mini descriptor string for a field, returns true on success.
10872bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a,
10873 upb_StringView* out);
10874
10875const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010876UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f);
10877UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010878const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010879UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof(
10880 const upb_FieldDef* f);
10881UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010882
10883#ifdef __cplusplus
10884} /* extern "C" */
10885#endif
10886
10887
10888#endif /* UPB_REFLECTION_FIELD_DEF_H_ */
10889
Protobuf Team Bot06310352023-09-26 21:54:58 +000010890// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010891
10892#ifndef UPB_REFLECTION_FILE_DEF_H_
10893#define UPB_REFLECTION_FILE_DEF_H_
10894
10895
10896// Must be last.
10897
10898#ifdef __cplusplus
10899extern "C" {
10900#endif
10901
10902const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i);
10903int upb_FileDef_DependencyCount(const upb_FileDef* f);
10904bool upb_FileDef_HasOptions(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010905UPB_API const char* upb_FileDef_Name(const upb_FileDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010906const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010907const char* upb_FileDef_Package(const upb_FileDef* f);
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000010908UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010909UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010910
10911const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i);
10912int upb_FileDef_PublicDependencyCount(const upb_FileDef* f);
10913
10914const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i);
10915int upb_FileDef_ServiceCount(const upb_FileDef* f);
10916
Jason Lunn67dee292023-07-13 13:15:26 -070010917UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010918
10919const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i);
10920int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f);
10921
10922const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i);
10923int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f);
10924
10925const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i);
10926int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f);
10927
10928const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i);
10929int upb_FileDef_WeakDependencyCount(const upb_FileDef* f);
10930
10931#ifdef __cplusplus
10932} /* extern "C" */
10933#endif
10934
10935
10936#endif /* UPB_REFLECTION_FILE_DEF_H_ */
10937
Protobuf Team Bot06310352023-09-26 21:54:58 +000010938// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010939
10940#ifndef UPB_REFLECTION_MESSAGE_DEF_H_
10941#define UPB_REFLECTION_MESSAGE_DEF_H_
10942
10943
10944// Must be last.
10945
10946// Well-known field tag numbers for map-entry messages.
10947#define kUpb_MapEntry_KeyFieldNumber 1
10948#define kUpb_MapEntry_ValueFieldNumber 2
10949
10950// Well-known field tag numbers for Any messages.
10951#define kUpb_Any_TypeFieldNumber 1
10952#define kUpb_Any_ValueFieldNumber 2
10953
10954// Well-known field tag numbers for duration messages.
10955#define kUpb_Duration_SecondsFieldNumber 1
10956#define kUpb_Duration_NanosFieldNumber 2
10957
10958// Well-known field tag numbers for timestamp messages.
10959#define kUpb_Timestamp_SecondsFieldNumber 1
10960#define kUpb_Timestamp_NanosFieldNumber 2
10961
10962// All the different kind of well known type messages. For simplicity of check,
10963// number wrappers and string wrappers are grouped together. Make sure the
10964// order and number of these groups are not changed.
10965typedef enum {
10966 kUpb_WellKnown_Unspecified,
10967 kUpb_WellKnown_Any,
10968 kUpb_WellKnown_FieldMask,
10969 kUpb_WellKnown_Duration,
10970 kUpb_WellKnown_Timestamp,
10971
10972 // number wrappers
10973 kUpb_WellKnown_DoubleValue,
10974 kUpb_WellKnown_FloatValue,
10975 kUpb_WellKnown_Int64Value,
10976 kUpb_WellKnown_UInt64Value,
10977 kUpb_WellKnown_Int32Value,
10978 kUpb_WellKnown_UInt32Value,
10979
10980 // string wrappers
10981 kUpb_WellKnown_StringValue,
10982 kUpb_WellKnown_BytesValue,
10983 kUpb_WellKnown_BoolValue,
10984 kUpb_WellKnown_Value,
10985 kUpb_WellKnown_ListValue,
10986 kUpb_WellKnown_Struct,
10987} upb_WellKnown;
10988
10989#ifdef __cplusplus
10990extern "C" {
10991#endif
10992
10993const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m);
10994
10995const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m,
10996 int i);
10997int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m);
10998
Jason Lunn67dee292023-07-13 13:15:26 -070010999UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m,
11000 int i);
11001UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011002
Jason Lunn67dee292023-07-13 13:15:26 -070011003UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011004
11005// Returns a field by either JSON name or regular proto name.
11006const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
11007 const upb_MessageDef* m, const char* name, size_t size);
11008UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName(
11009 const upb_MessageDef* m, const char* name) {
11010 return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name));
11011}
11012
11013// Lookup of either field or oneof by name. Returns whether either was found.
11014// If the return is true, then the found def will be set, and the non-found
11015// one set to NULL.
Jason Lunn67dee292023-07-13 13:15:26 -070011016UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
11017 const char* name, size_t size,
11018 const upb_FieldDef** f,
11019 const upb_OneofDef** o);
Eric Salo8809a112022-11-21 13:01:06 -080011020UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m,
11021 const char* name,
11022 const upb_FieldDef** f,
11023 const upb_OneofDef** o) {
11024 return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o);
11025}
11026
11027const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m,
11028 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011029UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011030 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011031UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber(
11032 const upb_MessageDef* m, uint32_t i);
Eric Salo8809a112022-11-21 13:01:06 -080011033const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m,
11034 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011035UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011036 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011037UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011038bool upb_MessageDef_HasOptions(const upb_MessageDef* m);
11039bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m);
11040bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m);
11041
11042// Creates a mini descriptor string for a message, returns true on success.
11043bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a,
11044 upb_StringView* out);
11045
Jason Lunn67dee292023-07-13 13:15:26 -070011046UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011047const char* upb_MessageDef_Name(const upb_MessageDef* m);
11048
11049const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i);
11050const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m,
11051 int i);
11052const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m,
11053 int i);
11054
11055int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m);
11056int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m);
11057int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m);
11058
Jason Lunn67dee292023-07-13 13:15:26 -070011059UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m,
11060 int i);
11061UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011062int upb_MessageDef_RealOneofCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011063
Mike Kruskal232ecf42023-01-14 00:09:40 -080011064const UPB_DESC(MessageOptions) *
11065 upb_MessageDef_Options(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011066
11067upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i);
11068int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m);
11069
11070const upb_MessageReservedRange* upb_MessageDef_ReservedRange(
11071 const upb_MessageDef* m, int i);
11072int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m);
11073
Jason Lunn67dee292023-07-13 13:15:26 -070011074UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m);
11075UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011076
11077#ifdef __cplusplus
11078} /* extern "C" */
11079#endif
11080
11081
11082#endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */
11083
Protobuf Team Bot06310352023-09-26 21:54:58 +000011084// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011085
11086#ifndef UPB_REFLECTION_METHOD_DEF_H_
11087#define UPB_REFLECTION_METHOD_DEF_H_
11088
11089
11090// Must be last.
11091
11092#ifdef __cplusplus
11093extern "C" {
11094#endif
11095
11096bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
11097const char* upb_MethodDef_FullName(const upb_MethodDef* m);
11098bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
11099int upb_MethodDef_Index(const upb_MethodDef* m);
11100const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
11101const char* upb_MethodDef_Name(const upb_MethodDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011102const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011103const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
11104bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
11105const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
11106
11107#ifdef __cplusplus
11108} /* extern "C" */
11109#endif
11110
11111
11112#endif /* UPB_REFLECTION_METHOD_DEF_H_ */
11113
Protobuf Team Bot06310352023-09-26 21:54:58 +000011114// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011115
11116#ifndef UPB_REFLECTION_ONEOF_DEF_H_
11117#define UPB_REFLECTION_ONEOF_DEF_H_
11118
11119
11120// Must be last.
11121
11122#ifdef __cplusplus
11123extern "C" {
11124#endif
11125
Jason Lunn67dee292023-07-13 13:15:26 -070011126UPB_API const upb_MessageDef* upb_OneofDef_ContainingType(
11127 const upb_OneofDef* o);
11128UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i);
11129UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011130const char* upb_OneofDef_FullName(const upb_OneofDef* o);
11131bool upb_OneofDef_HasOptions(const upb_OneofDef* o);
11132uint32_t upb_OneofDef_Index(const upb_OneofDef* o);
11133bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o);
11134const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o,
11135 const char* name);
11136const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o,
11137 const char* name,
11138 size_t size);
11139const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o,
11140 uint32_t num);
Jason Lunn67dee292023-07-13 13:15:26 -070011141UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011142int upb_OneofDef_numfields(const upb_OneofDef* o);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011143const UPB_DESC(OneofOptions) * upb_OneofDef_Options(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011144
11145#ifdef __cplusplus
11146} /* extern "C" */
11147#endif
11148
11149
11150#endif /* UPB_REFLECTION_ONEOF_DEF_H_ */
11151
Protobuf Team Bot06310352023-09-26 21:54:58 +000011152// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011153
11154#ifndef UPB_REFLECTION_SERVICE_DEF_H_
11155#define UPB_REFLECTION_SERVICE_DEF_H_
11156
11157
11158// Must be last.
11159
11160#ifdef __cplusplus
11161extern "C" {
11162#endif
11163
11164const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
11165const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
11166 const char* name);
11167const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
11168bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
11169int upb_ServiceDef_Index(const upb_ServiceDef* s);
11170const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i);
11171int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
11172const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011173const UPB_DESC(ServiceOptions) *
11174 upb_ServiceDef_Options(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080011175
11176#ifdef __cplusplus
11177} /* extern "C" */
11178#endif
11179
11180
11181#endif /* UPB_REFLECTION_SERVICE_DEF_H_ */
Protobuf Team Botffc56ba2023-09-08 15:29:06 +000011182// IWYU pragma: end_exports
Eric Salo8809a112022-11-21 13:01:06 -080011183
11184#endif /* UPB_REFLECTION_DEF_H_ */
11185
11186// Must be last.
11187
11188#ifdef __cplusplus
11189extern "C" {
11190#endif
11191
11192enum { upb_JsonDecode_IgnoreUnknown = 1 };
11193
Jason Lunn67dee292023-07-13 13:15:26 -070011194UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
11195 const upb_MessageDef* m, const upb_DefPool* symtab,
11196 int options, upb_Arena* arena, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011197
11198#ifdef __cplusplus
11199} /* extern "C" */
11200#endif
11201
11202
11203#endif /* UPB_JSONDECODE_H_ */
11204
11205#ifndef UPB_LEX_ATOI_H_
11206#define UPB_LEX_ATOI_H_
11207
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011208#include <stdint.h>
11209
Eric Salo8809a112022-11-21 13:01:06 -080011210// Must be last.
11211
11212#ifdef __cplusplus
11213extern "C" {
11214#endif
11215
11216// We use these hand-written routines instead of strto[u]l() because the "long
11217// long" variants aren't in c89. Also our version allows setting a ptr limit.
11218// Return the new position of the pointer after parsing the int, or NULL on
11219// integer overflow.
11220
11221const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val);
11222const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
11223 bool* is_neg);
11224
11225#ifdef __cplusplus
11226} /* extern "C" */
11227#endif
11228
11229
11230#endif /* UPB_LEX_ATOI_H_ */
11231
11232#ifndef UPB_LEX_UNICODE_H_
11233#define UPB_LEX_UNICODE_H_
11234
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011235#include <stdint.h>
11236
Eric Salo8809a112022-11-21 13:01:06 -080011237// Must be last.
11238
11239#ifdef __cplusplus
11240extern "C" {
11241#endif
11242
11243// Returns true iff a codepoint is the value for a high surrogate.
11244UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) {
11245 return (cp >= 0xd800 && cp <= 0xdbff);
11246}
11247
11248// Returns true iff a codepoint is the value for a low surrogate.
11249UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) {
11250 return (cp >= 0xdc00 && cp <= 0xdfff);
11251}
11252
11253// Returns the high 16-bit surrogate value for a supplementary codepoint.
11254// Does not sanity-check the input.
11255UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) {
11256 return (cp >> 10) + 0xd7c0;
11257}
11258
11259// Returns the low 16-bit surrogate value for a supplementary codepoint.
11260// Does not sanity-check the input.
11261UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) {
11262 return (cp & 0x3ff) | 0xdc00;
11263}
11264
11265// Returns the 32-bit value corresponding to a pair of 16-bit surrogates.
11266// Does not sanity-check the input.
11267UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) {
11268 return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000;
11269}
11270
11271// Outputs a codepoint as UTF8.
11272// Returns the number of bytes written (1-4 on success, 0 on error).
11273// Does not sanity-check the input. Specifically does not check for surrogates.
11274int upb_Unicode_ToUTF8(uint32_t cp, char* out);
11275
11276#ifdef __cplusplus
11277} /* extern "C" */
11278#endif
11279
11280
11281#endif /* UPB_LEX_UNICODE_H_ */
11282
11283#ifndef UPB_REFLECTION_MESSAGE_H_
11284#define UPB_REFLECTION_MESSAGE_H_
11285
Protobuf Team Bot473d20d2023-09-15 22:27:16 +000011286#include <stddef.h>
11287
Eric Salo8809a112022-11-21 13:01:06 -080011288
11289// Must be last.
11290
11291#ifdef __cplusplus
11292extern "C" {
11293#endif
11294
Eric Salo3f36a912022-12-05 14:12:25 -080011295// Returns a mutable pointer to a map, array, or submessage value. If the given
11296// arena is non-NULL this will construct a new object if it was not previously
11297// present. May not be called for primitive fields.
Jason Lunn67dee292023-07-13 13:15:26 -070011298UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg,
11299 const upb_FieldDef* f,
11300 upb_Arena* a);
Eric Salo8809a112022-11-21 13:01:06 -080011301
Eric Salo3f36a912022-12-05 14:12:25 -080011302// Returns the field that is set in the oneof, or NULL if none are set.
Jason Lunn67dee292023-07-13 13:15:26 -070011303UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
11304 const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011305
Eric Salo3f36a912022-12-05 14:12:25 -080011306// Clear all data and unknown fields.
11307void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011308
Eric Salo3f36a912022-12-05 14:12:25 -080011309// Clears any field presence and sets the value back to its default.
Jason Lunn67dee292023-07-13 13:15:26 -070011310UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg,
11311 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011312
Eric Salo3f36a912022-12-05 14:12:25 -080011313// May only be called for fields where upb_FieldDef_HasPresence(f) == true.
Jason Lunn67dee292023-07-13 13:15:26 -070011314UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg,
11315 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011316
Eric Salo3f36a912022-12-05 14:12:25 -080011317// Returns the value in the message associated with this field def.
Jason Lunn67dee292023-07-13 13:15:26 -070011318UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
11319 const upb_FieldDef* f);
Eric Salo3f36a912022-12-05 14:12:25 -080011320
11321// Sets the given field to the given value. For a msg/array/map/string, the
11322// caller must ensure that the target data outlives |msg| (by living either in
11323// the same arena or a different arena that outlives it).
11324//
11325// Returns false if allocation fails.
Jason Lunn67dee292023-07-13 13:15:26 -070011326UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
11327 upb_MessageValue val, upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -080011328
11329// Iterate over present fields.
11330//
11331// size_t iter = kUpb_Message_Begin;
11332// const upb_FieldDef *f;
11333// upb_MessageValue val;
11334// while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) {
11335// process_field(f, val);
11336// }
11337//
11338// If ext_pool is NULL, no extensions will be returned. If the given symtab
11339// returns extensions that don't match what is in this message, those extensions
11340// will be skipped.
Eric Salo8809a112022-11-21 13:01:06 -080011341
11342#define kUpb_Message_Begin -1
Eric Salo3f36a912022-12-05 14:12:25 -080011343
Eric Salo8809a112022-11-21 13:01:06 -080011344bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
11345 const upb_DefPool* ext_pool, const upb_FieldDef** f,
11346 upb_MessageValue* val, size_t* iter);
11347
Eric Salo3f36a912022-12-05 14:12:25 -080011348// Clears all unknown field data from this message and all submessages.
Jason Lunn67dee292023-07-13 13:15:26 -070011349UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg,
11350 const upb_MessageDef* m, int maxdepth);
Eric Salo8809a112022-11-21 13:01:06 -080011351
11352#ifdef __cplusplus
11353} /* extern "C" */
11354#endif
11355
11356
11357#endif /* UPB_REFLECTION_MESSAGE_H_ */
11358
11359#ifndef UPB_JSON_ENCODE_H_
11360#define UPB_JSON_ENCODE_H_
11361
11362
11363// Must be last.
11364
11365#ifdef __cplusplus
11366extern "C" {
11367#endif
11368
11369enum {
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000011370 /* When set, emits 0/default values. TODO: proto3 only? */
Eric Salo8809a112022-11-21 13:01:06 -080011371 upb_JsonEncode_EmitDefaults = 1 << 0,
11372
11373 /* When set, use normal (snake_case) field names instead of JSON (camelCase)
11374 names. */
11375 upb_JsonEncode_UseProtoNames = 1 << 1,
11376
11377 /* When set, emits enums as their integer values instead of as their names. */
11378 upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2
11379};
11380
11381/* Encodes the given |msg| to JSON format. The message's reflection is given in
Protobuf Team Botad884532023-09-05 18:31:02 +000011382 * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL,
11383 * extensions will not be printed).
Eric Salo8809a112022-11-21 13:01:06 -080011384 *
11385 * Output is placed in the given buffer, and always NULL-terminated. The output
11386 * size (excluding NULL) is returned. This means that a return value >= |size|
11387 * implies that the output was truncated. (These are the same semantics as
11388 * snprintf()). */
Jason Lunn67dee292023-07-13 13:15:26 -070011389UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m,
11390 const upb_DefPool* ext_pool, int options,
11391 char* buf, size_t size, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011392
11393#ifdef __cplusplus
11394} /* extern "C" */
11395#endif
11396
11397
11398#endif /* UPB_JSONENCODE_H_ */
11399
11400#ifndef UPB_LEX_ROUND_TRIP_H_
11401#define UPB_LEX_ROUND_TRIP_H_
11402
11403// Must be last.
11404
11405// Encodes a float or double that is round-trippable, but as short as possible.
11406// These routines are not fully optimal (not guaranteed to be shortest), but are
11407// short-ish and match the implementation that has been used in protobuf since
11408// the beginning.
11409
11410// The given buffer size must be at least kUpb_RoundTripBufferSize.
11411enum { kUpb_RoundTripBufferSize = 32 };
11412
11413#ifdef __cplusplus
11414extern "C" {
11415#endif
11416
11417void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size);
11418void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size);
11419
11420#ifdef __cplusplus
11421} /* extern "C" */
11422#endif
11423
11424
11425#endif /* UPB_LEX_ROUND_TRIP_H_ */
11426
11427#ifndef UPB_PORT_VSNPRINTF_COMPAT_H_
11428#define UPB_PORT_VSNPRINTF_COMPAT_H_
11429
11430// Must be last.
11431
11432UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt,
11433 va_list ap) {
11434#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
11435 // The msvc runtime has a non-conforming vsnprintf() that requires the
11436 // following compatibility code to become conformant.
11437 int n = -1;
11438 if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap);
11439 if (n == -1) n = _vscprintf(fmt, ap);
11440 return n;
11441#else
11442 return vsnprintf(buf, size, fmt, ap);
11443#endif
11444}
11445
11446
11447#endif // UPB_PORT_VSNPRINTF_COMPAT_H_
11448
11449#ifndef UPB_LEX_STRTOD_H_
11450#define UPB_LEX_STRTOD_H_
11451
11452// Must be last.
11453
11454#ifdef __cplusplus
11455extern "C" {
11456#endif
11457
11458double _upb_NoLocaleStrtod(const char *str, char **endptr);
11459
11460#ifdef __cplusplus
11461} /* extern "C" */
11462#endif
11463
11464
11465#endif /* UPB_LEX_STRTOD_H_ */
11466
Sandy Zhange3b09432023-08-07 09:30:02 -070011467#ifndef UPB_MEM_INTERNAL_ARENA_H_
11468#define UPB_MEM_INTERNAL_ARENA_H_
Eric Salo8809a112022-11-21 13:01:06 -080011469
11470
11471// Must be last.
11472
11473typedef struct _upb_MemBlock _upb_MemBlock;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011474
11475struct upb_Arena {
11476 _upb_ArenaHead head;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011477
Deanna Garciac7d979d2023-04-14 17:22:13 -070011478 // upb_alloc* together with a low bit which signals if there is an initial
11479 // block.
11480 uintptr_t block_alloc;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011481
Deanna Garciac7d979d2023-04-14 17:22:13 -070011482 // When multiple arenas are fused together, each arena points to a parent
11483 // arena (root points to itself). The root tracks how many live arenas
11484 // reference it.
Joshua Habermand3995ec2022-09-30 16:54:39 -070011485
Deanna Garciac7d979d2023-04-14 17:22:13 -070011486 // The low bit is tagged:
11487 // 0: pointer to parent
11488 // 1: count, left shifted by one
11489 UPB_ATOMIC(uintptr_t) parent_or_count;
11490
11491 // All nodes that are fused together are in a singly-linked list.
11492 UPB_ATOMIC(upb_Arena*) next; // NULL at end of list.
11493
11494 // The last element of the linked list. This is present only as an
11495 // optimization, so that we do not have to iterate over all members for every
11496 // fuse. Only significant for an arena root. In other cases it is ignored.
11497 UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members.
11498
11499 // Linked list of blocks to free/cleanup. Atomic only for the benefit of
11500 // upb_Arena_SpaceAllocated().
11501 UPB_ATOMIC(_upb_MemBlock*) blocks;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011502};
11503
Eric Salodfb71552023-03-22 12:35:09 -070011504UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) {
11505 return (parent_or_count & 1) == 1;
11506}
Eric Salo8809a112022-11-21 13:01:06 -080011507
Eric Salodfb71552023-03-22 12:35:09 -070011508UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) {
11509 return (parent_or_count & 1) == 0;
11510}
11511
Deanna Garciac7d979d2023-04-14 17:22:13 -070011512UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) {
Eric Salodfb71552023-03-22 12:35:09 -070011513 UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
11514 return parent_or_count >> 1;
11515}
11516
Deanna Garciac7d979d2023-04-14 17:22:13 -070011517UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) {
11518 uintptr_t parent_or_count = (refcount << 1) | 1;
Eric Salodfb71552023-03-22 12:35:09 -070011519 UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
11520 return parent_or_count;
11521}
11522
11523UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) {
11524 UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
11525 return (upb_Arena*)parent_or_count;
11526}
11527
11528UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) {
11529 uintptr_t parent_or_count = (uintptr_t)a;
11530 UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
11531 return parent_or_count;
11532}
Joshua Habermand3995ec2022-09-30 16:54:39 -070011533
Deanna Garciac7d979d2023-04-14 17:22:13 -070011534UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) {
11535 return (upb_alloc*)(arena->block_alloc & ~0x1);
11536}
11537
11538UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc,
11539 bool has_initial) {
11540 uintptr_t alloc_uint = (uintptr_t)alloc;
11541 UPB_ASSERT((alloc_uint & 1) == 0);
11542 return alloc_uint | (has_initial ? 1 : 0);
11543}
11544
11545UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) {
11546 return arena->block_alloc & 0x1;
11547}
11548
Joshua Habermand3995ec2022-09-30 16:54:39 -070011549
Sandy Zhange3b09432023-08-07 09:30:02 -070011550#endif /* UPB_MEM_INTERNAL_ARENA_H_ */
Eric Salo8809a112022-11-21 13:01:06 -080011551
Eric Salodfb71552023-03-22 12:35:09 -070011552#ifndef UPB_PORT_ATOMIC_H_
11553#define UPB_PORT_ATOMIC_H_
11554
11555
11556#ifdef UPB_USE_C11_ATOMICS
11557
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011558// IWYU pragma: begin_exports
Eric Salodfb71552023-03-22 12:35:09 -070011559#include <stdatomic.h>
11560#include <stdbool.h>
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011561// IWYU pragma: end_exports
Eric Salodfb71552023-03-22 12:35:09 -070011562
Deanna Garciac7d979d2023-04-14 17:22:13 -070011563#define upb_Atomic_Init(addr, val) atomic_init(addr, val)
11564#define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order)
11565#define upb_Atomic_Store(addr, val, order) \
11566 atomic_store_explicit(addr, val, order)
11567#define upb_Atomic_Add(addr, val, order) \
11568 atomic_fetch_add_explicit(addr, val, order)
11569#define upb_Atomic_Sub(addr, val, order) \
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070011570 atomic_fetch_sub_explicit(addr, val, order)
11571#define upb_Atomic_Exchange(addr, val, order) \
11572 atomic_exchange_explicit(addr, val, order)
Deanna Garciac7d979d2023-04-14 17:22:13 -070011573#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
11574 success_order, failure_order) \
11575 atomic_compare_exchange_strong_explicit(addr, expected, desired, \
11576 success_order, failure_order)
11577#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
11578 failure_order) \
11579 atomic_compare_exchange_weak_explicit(addr, expected, desired, \
11580 success_order, failure_order)
Eric Salodfb71552023-03-22 12:35:09 -070011581
11582#else // !UPB_USE_C11_ATOMICS
11583
Deanna Garciac7d979d2023-04-14 17:22:13 -070011584#include <string.h>
Eric Salodfb71552023-03-22 12:35:09 -070011585
Deanna Garciac7d979d2023-04-14 17:22:13 -070011586#define upb_Atomic_Init(addr, val) (*addr = val)
11587#define upb_Atomic_Load(addr, order) (*addr)
11588#define upb_Atomic_Store(addr, val, order) (*(addr) = val)
11589#define upb_Atomic_Add(addr, val, order) (*(addr) += val)
11590#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val)
Eric Salodfb71552023-03-22 12:35:09 -070011591
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070011592UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) {
11593 void* old;
11594 memcpy(&old, addr, sizeof(value));
11595 memcpy(addr, &value, sizeof(value));
11596 return old;
11597}
11598
11599#define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val)
11600
Deanna Garciac7d979d2023-04-14 17:22:13 -070011601// `addr` and `expected` are logically double pointers.
11602UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
11603 void* expected,
11604 void* desired) {
11605 if (memcmp(addr, expected, sizeof(desired)) == 0) {
11606 memcpy(addr, &desired, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070011607 return true;
11608 } else {
Deanna Garciac7d979d2023-04-14 17:22:13 -070011609 memcpy(expected, addr, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070011610 return false;
11611 }
11612}
11613
Deanna Garciac7d979d2023-04-14 17:22:13 -070011614#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
11615 success_order, failure_order) \
11616 _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \
11617 (void*)desired)
11618#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
11619 failure_order) \
11620 upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0)
11621
Eric Salodfb71552023-03-22 12:35:09 -070011622#endif
11623
11624
11625#endif // UPB_PORT_ATOMIC_H_
11626
Eric Salob7d54ac2022-12-29 11:59:42 -080011627#ifndef UPB_WIRE_READER_H_
11628#define UPB_WIRE_READER_H_
11629
11630
Sandy Zhange3b09432023-08-07 09:30:02 -070011631#ifndef UPB_WIRE_INTERNAL_SWAP_H_
11632#define UPB_WIRE_INTERNAL_SWAP_H_
Eric Salob7d54ac2022-12-29 11:59:42 -080011633
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011634#include <stdint.h>
11635
Eric Salob7d54ac2022-12-29 11:59:42 -080011636// Must be last.
11637
11638#ifdef __cplusplus
11639extern "C" {
11640#endif
11641
11642UPB_INLINE bool _upb_IsLittleEndian(void) {
11643 int x = 1;
11644 return *(char*)&x == 1;
11645}
11646
11647UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) {
11648 if (_upb_IsLittleEndian()) return val;
11649
11650 return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
11651 ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
11652}
11653
11654UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) {
11655 if (_upb_IsLittleEndian()) return val;
11656
11657 return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) |
11658 _upb_BigEndian_Swap32((uint32_t)(val >> 32));
11659}
11660
11661#ifdef __cplusplus
11662} /* extern "C" */
11663#endif
11664
11665
Sandy Zhange3b09432023-08-07 09:30:02 -070011666#endif /* UPB_WIRE_INTERNAL_SWAP_H_ */
Eric Salob7d54ac2022-12-29 11:59:42 -080011667
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011668#ifndef UPB_WIRE_TYPES_H_
11669#define UPB_WIRE_TYPES_H_
11670
11671// A list of types as they are encoded on the wire.
11672typedef enum {
11673 kUpb_WireType_Varint = 0,
11674 kUpb_WireType_64Bit = 1,
11675 kUpb_WireType_Delimited = 2,
11676 kUpb_WireType_StartGroup = 3,
11677 kUpb_WireType_EndGroup = 4,
11678 kUpb_WireType_32Bit = 5
11679} upb_WireType;
11680
11681#endif /* UPB_WIRE_TYPES_H_ */
11682
Eric Salob7d54ac2022-12-29 11:59:42 -080011683// Must be last.
11684
11685#ifdef __cplusplus
11686extern "C" {
11687#endif
11688
11689// The upb_WireReader interface is suitable for general-purpose parsing of
11690// protobuf binary wire format. It is designed to be used along with
11691// upb_EpsCopyInputStream for buffering, and all parsing routines in this file
11692// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is
11693// available to read without any bounds checks.
11694
11695#define kUpb_WireReader_WireTypeMask 7
11696#define kUpb_WireReader_WireTypeBits 3
11697
11698typedef struct {
11699 const char* ptr;
11700 uint64_t val;
11701} _upb_WireReader_ReadLongVarintRet;
11702
11703_upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint(
11704 const char* ptr, uint64_t val);
11705
11706static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr,
11707 uint64_t* val,
11708 int maxlen,
11709 uint64_t maxval) {
11710 uint64_t byte = (uint8_t)*ptr;
11711 if (UPB_LIKELY((byte & 0x80) == 0)) {
11712 *val = (uint32_t)byte;
11713 return ptr + 1;
11714 }
11715 const char* start = ptr;
11716 _upb_WireReader_ReadLongVarintRet res =
11717 _upb_WireReader_ReadLongVarint(ptr, byte);
11718 if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) ||
11719 res.val > maxval) {
11720 return NULL; // Malformed.
11721 }
11722 *val = res.val;
11723 return res.ptr;
11724}
11725
11726// Parses a tag into `tag`, and returns a pointer past the end of the tag, or
11727// NULL if there was an error in the tag data.
11728//
11729// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11730// Bounds checks must be performed before calling this function, preferably
11731// by calling upb_EpsCopyInputStream_IsDone().
11732static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
11733 uint32_t* tag) {
11734 uint64_t val;
11735 ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX);
11736 if (!ptr) return NULL;
11737 *tag = val;
11738 return ptr;
11739}
11740
11741// Given a tag, returns the field number.
11742UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
11743 return tag >> kUpb_WireReader_WireTypeBits;
11744}
11745
11746// Given a tag, returns the wire type.
11747UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
11748 return tag & kUpb_WireReader_WireTypeMask;
11749}
11750
11751UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr,
11752 uint64_t* val) {
11753 return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX);
11754}
11755
11756// Skips data for a varint, returning a pointer past the end of the varint, or
11757// NULL if there was an error in the varint data.
11758//
11759// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11760// Bounds checks must be performed before calling this function, preferably
11761// by calling upb_EpsCopyInputStream_IsDone().
11762UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) {
11763 uint64_t val;
11764 return upb_WireReader_ReadVarint(ptr, &val);
11765}
11766
11767// Reads a varint indicating the size of a delimited field into `size`, or
11768// NULL if there was an error in the varint data.
11769//
11770// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11771// Bounds checks must be performed before calling this function, preferably
11772// by calling upb_EpsCopyInputStream_IsDone().
11773UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) {
11774 uint64_t size64;
11775 ptr = upb_WireReader_ReadVarint(ptr, &size64);
11776 if (!ptr || size64 >= INT32_MAX) return NULL;
11777 *size = size64;
11778 return ptr;
11779}
11780
11781// Reads a fixed32 field, performing byte swapping if necessary.
11782//
11783// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
11784// Bounds checks must be performed before calling this function, preferably
11785// by calling upb_EpsCopyInputStream_IsDone().
11786UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) {
11787 uint32_t uval;
11788 memcpy(&uval, ptr, 4);
11789 uval = _upb_BigEndian_Swap32(uval);
11790 memcpy(val, &uval, 4);
11791 return ptr + 4;
11792}
11793
11794// Reads a fixed64 field, performing byte swapping if necessary.
11795//
11796// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
11797// Bounds checks must be performed before calling this function, preferably
11798// by calling upb_EpsCopyInputStream_IsDone().
11799UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) {
11800 uint64_t uval;
11801 memcpy(&uval, ptr, 8);
11802 uval = _upb_BigEndian_Swap64(uval);
11803 memcpy(val, &uval, 8);
11804 return ptr + 8;
11805}
11806
Mike Kruskal232ecf42023-01-14 00:09:40 -080011807const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag,
11808 int depth_limit,
11809 upb_EpsCopyInputStream* stream);
11810
Eric Salob7d54ac2022-12-29 11:59:42 -080011811// Skips data for a group, returning a pointer past the end of the group, or
11812// NULL if there was an error parsing the group. The `tag` argument should be
11813// the start group tag that begins the group. The `depth_limit` argument
11814// indicates how many levels of recursion the group is allowed to have before
11815// reporting a parse error (this limit exists to protect against stack
11816// overflow).
Eric Salob7d54ac2022-12-29 11:59:42 -080011817//
Mike Kruskal232ecf42023-01-14 00:09:40 -080011818// TODO: evaluate how the depth_limit should be specified. Do users need
11819// control over this?
11820UPB_INLINE const char* upb_WireReader_SkipGroup(
11821 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
11822 return _upb_WireReader_SkipGroup(ptr, tag, 100, stream);
11823}
11824
11825UPB_INLINE const char* _upb_WireReader_SkipValue(
Eric Salob7d54ac2022-12-29 11:59:42 -080011826 const char* ptr, uint32_t tag, int depth_limit,
11827 upb_EpsCopyInputStream* stream) {
11828 switch (upb_WireReader_GetWireType(tag)) {
11829 case kUpb_WireType_Varint:
11830 return upb_WireReader_SkipVarint(ptr);
11831 case kUpb_WireType_32Bit:
11832 return ptr + 4;
11833 case kUpb_WireType_64Bit:
11834 return ptr + 8;
11835 case kUpb_WireType_Delimited: {
11836 int size;
11837 ptr = upb_WireReader_ReadSize(ptr, &size);
11838 if (!ptr) return NULL;
11839 ptr += size;
11840 return ptr;
11841 }
11842 case kUpb_WireType_StartGroup:
Mike Kruskal232ecf42023-01-14 00:09:40 -080011843 return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream);
Eric Salob7d54ac2022-12-29 11:59:42 -080011844 case kUpb_WireType_EndGroup:
11845 return NULL; // Should be handled before now.
11846 default:
11847 return NULL; // Unknown wire type.
11848 }
11849}
11850
Mike Kruskal232ecf42023-01-14 00:09:40 -080011851// Skips data for a wire value of any type, returning a pointer past the end of
11852// the data, or NULL if there was an error parsing the group. The `tag` argument
11853// should be the tag that was just parsed. The `depth_limit` argument indicates
11854// how many levels of recursion a group is allowed to have before reporting a
11855// parse error (this limit exists to protect against stack overflow).
11856//
11857// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11858// Bounds checks must be performed before calling this function, preferably
11859// by calling upb_EpsCopyInputStream_IsDone().
11860//
11861// TODO: evaluate how the depth_limit should be specified. Do users need
11862// control over this?
11863UPB_INLINE const char* upb_WireReader_SkipValue(
11864 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
11865 return _upb_WireReader_SkipValue(ptr, tag, 100, stream);
11866}
11867
Eric Salob7d54ac2022-12-29 11:59:42 -080011868#ifdef __cplusplus
11869} /* extern "C" */
11870#endif
11871
11872
11873#endif // UPB_WIRE_READER_H_
11874
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000011875// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
11876
11877#ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
11878#define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
11879
11880#include <stdlib.h>
11881
11882
11883#ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
11884#define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
11885
11886
11887// Map entries aren't actually stored for map fields, they are only used during
11888// parsing. For parsing, it helps a lot if all map entry messages have the same
11889// layout. The layout code in mini_table/decode.c will ensure that all map
11890// entries have this layout.
11891//
11892// Note that users can and do create map entries directly, which will also use
11893// this layout.
11894//
11895// NOTE: sync with wire/decode.c.
11896typedef struct {
11897 // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
11898 // and the uint64_t helps make this clear.
11899 uint64_t hasbits;
11900 union {
11901 upb_StringView str; // For str/bytes.
11902 upb_value val; // For all other types.
11903 } k;
11904 union {
11905 upb_StringView str; // For str/bytes.
11906 upb_value val; // For all other types.
11907 } v;
11908} upb_MapEntryData;
11909
11910typedef struct {
11911 upb_Message_Internal internal;
11912 upb_MapEntryData data;
11913} upb_MapEntry;
11914
11915#endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
11916
11917// Must be last.
11918
11919#ifdef __cplusplus
11920extern "C" {
11921#endif
11922
11923// _upb_mapsorter sorts maps and provides ordered iteration over the entries.
11924// Since maps can be recursive (map values can be messages which contain other
11925// maps), _upb_mapsorter can contain a stack of maps.
11926
11927typedef struct {
11928 void const** entries;
11929 int size;
11930 int cap;
11931} _upb_mapsorter;
11932
11933typedef struct {
11934 int start;
11935 int pos;
11936 int end;
11937} _upb_sortedmap;
11938
11939UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) {
11940 s->entries = NULL;
11941 s->size = 0;
11942 s->cap = 0;
11943}
11944
11945UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) {
11946 if (s->entries) free(s->entries);
11947}
11948
11949UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map,
11950 _upb_sortedmap* sorted, upb_MapEntry* ent) {
11951 if (sorted->pos == sorted->end) return false;
11952 const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++];
11953 upb_StringView key = upb_tabstrview(tabent->key);
11954 _upb_map_fromkey(key, &ent->data.k, map->key_size);
11955 upb_value val = {tabent->val.val};
11956 _upb_map_fromvalue(val, &ent->data.v, map->val_size);
11957 return true;
11958}
11959
11960UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s,
11961 _upb_sortedmap* sorted,
11962 const upb_Message_Extension** ext) {
11963 if (sorted->pos == sorted->end) return false;
11964 *ext = (const upb_Message_Extension*)s->entries[sorted->pos++];
11965 return true;
11966}
11967
11968UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s,
11969 _upb_sortedmap* sorted) {
11970 s->size = sorted->start;
11971}
11972
11973bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
11974 const upb_Map* map, _upb_sortedmap* sorted);
11975
11976bool _upb_mapsorter_pushexts(_upb_mapsorter* s,
11977 const upb_Message_Extension* exts, size_t count,
11978 _upb_sortedmap* sorted);
11979
11980#ifdef __cplusplus
11981} /* extern "C" */
11982#endif
11983
11984
11985#endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */
11986
Adam Cozzette8059da22023-08-16 07:57:14 -070011987#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
11988#define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
11989
11990
11991#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
11992#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
11993
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011994#include <stdint.h>
11995
Adam Cozzette8059da22023-08-16 07:57:14 -070011996
11997// Must be last.
11998
11999#ifdef __cplusplus
12000extern "C" {
12001#endif
12002
12003UPB_INLINE char _upb_ToBase92(int8_t ch) {
12004 extern const char _kUpb_ToBase92[];
12005 UPB_ASSERT(0 <= ch && ch < 92);
12006 return _kUpb_ToBase92[ch];
12007}
12008
12009UPB_INLINE char _upb_FromBase92(uint8_t ch) {
12010 extern const int8_t _kUpb_FromBase92[];
12011 if (' ' > ch || ch > '~') return -1;
12012 return _kUpb_FromBase92[ch - ' '];
12013}
12014
12015UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr,
12016 const char* end, char first_ch,
12017 uint8_t min, uint8_t max,
12018 uint32_t* out_val) {
12019 uint32_t val = 0;
12020 uint32_t shift = 0;
12021 const int bits_per_char =
12022 upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min));
12023 char ch = first_ch;
12024 while (1) {
12025 uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min);
12026 val |= bits << shift;
12027 if (ptr == end || *ptr < min || max < *ptr) {
12028 *out_val = val;
12029 UPB_ASSUME(ptr != NULL);
12030 return ptr;
12031 }
12032 ch = *ptr++;
12033 shift += bits_per_char;
12034 if (shift >= 32) return NULL;
12035 }
12036}
12037
12038#ifdef __cplusplus
12039} /* extern "C" */
12040#endif
12041
12042
12043#endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12044
12045// Must be last.
12046
12047// upb_MdDecoder: used internally for decoding MiniDescriptors for messages,
12048// extensions, and enums.
12049typedef struct {
12050 const char* end;
12051 upb_Status* status;
12052 jmp_buf err;
12053} upb_MdDecoder;
12054
12055UPB_PRINTF(2, 3)
12056UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d,
12057 const char* fmt, ...) {
12058 if (d->status) {
12059 va_list argp;
12060 upb_Status_SetErrorMessage(d->status, "Error building mini table: ");
12061 va_start(argp, fmt);
12062 upb_Status_VAppendErrorFormat(d->status, fmt, argp);
12063 va_end(argp);
12064 }
12065 UPB_LONGJMP(d->err, 1);
12066}
12067
12068UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d,
12069 const void* ptr) {
12070 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory");
12071}
12072
12073UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint(
12074 upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max,
12075 uint32_t* out_val) {
12076 ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val);
12077 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint");
12078 return ptr;
12079}
12080
12081
12082#endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12083
12084#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12085#define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12086
12087
12088// Must be last.
12089
12090typedef enum {
12091 kUpb_EncodedType_Double = 0,
12092 kUpb_EncodedType_Float = 1,
12093 kUpb_EncodedType_Fixed32 = 2,
12094 kUpb_EncodedType_Fixed64 = 3,
12095 kUpb_EncodedType_SFixed32 = 4,
12096 kUpb_EncodedType_SFixed64 = 5,
12097 kUpb_EncodedType_Int32 = 6,
12098 kUpb_EncodedType_UInt32 = 7,
12099 kUpb_EncodedType_SInt32 = 8,
12100 kUpb_EncodedType_Int64 = 9,
12101 kUpb_EncodedType_UInt64 = 10,
12102 kUpb_EncodedType_SInt64 = 11,
12103 kUpb_EncodedType_OpenEnum = 12,
12104 kUpb_EncodedType_Bool = 13,
12105 kUpb_EncodedType_Bytes = 14,
12106 kUpb_EncodedType_String = 15,
12107 kUpb_EncodedType_Group = 16,
12108 kUpb_EncodedType_Message = 17,
12109 kUpb_EncodedType_ClosedEnum = 18,
12110
12111 kUpb_EncodedType_RepeatedBase = 20,
12112} upb_EncodedType;
12113
12114typedef enum {
12115 kUpb_EncodedFieldModifier_FlipPacked = 1 << 0,
12116 kUpb_EncodedFieldModifier_IsRequired = 1 << 1,
12117 kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012118 kUpb_EncodedFieldModifier_FlipValidateUtf8 = 1 << 3,
Adam Cozzette8059da22023-08-16 07:57:14 -070012119} upb_EncodedFieldModifier;
12120
12121enum {
12122 kUpb_EncodedValue_MinField = ' ',
12123 kUpb_EncodedValue_MaxField = 'I',
12124 kUpb_EncodedValue_MinModifier = 'L',
12125 kUpb_EncodedValue_MaxModifier = '[',
12126 kUpb_EncodedValue_End = '^',
12127 kUpb_EncodedValue_MinSkip = '_',
12128 kUpb_EncodedValue_MaxSkip = '~',
12129 kUpb_EncodedValue_OneofSeparator = '~',
12130 kUpb_EncodedValue_FieldSeparator = '|',
12131 kUpb_EncodedValue_MinOneofField = ' ',
12132 kUpb_EncodedValue_MaxOneofField = 'b',
12133 kUpb_EncodedValue_MaxEnumMask = 'A',
12134};
12135
12136enum {
12137 kUpb_EncodedVersion_EnumV1 = '!',
12138 kUpb_EncodedVersion_ExtensionV1 = '#',
12139 kUpb_EncodedVersion_MapV1 = '%',
12140 kUpb_EncodedVersion_MessageV1 = '$',
12141 kUpb_EncodedVersion_MessageSetV1 = '&',
12142};
12143
12144
12145#endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12146
12147#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12148#define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12149
12150// Must be last.
12151
12152typedef enum {
12153 kUpb_FieldModifier_IsRepeated = 1 << 0,
12154 kUpb_FieldModifier_IsPacked = 1 << 1,
12155 kUpb_FieldModifier_IsClosedEnum = 1 << 2,
12156 kUpb_FieldModifier_IsProto3Singular = 1 << 3,
12157 kUpb_FieldModifier_IsRequired = 1 << 4,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012158 kUpb_FieldModifier_ValidateUtf8 = 1 << 5,
Adam Cozzette8059da22023-08-16 07:57:14 -070012159} kUpb_FieldModifier;
12160
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012161// These modifiers are also used on the wire.
Adam Cozzette8059da22023-08-16 07:57:14 -070012162typedef enum {
12163 kUpb_MessageModifier_ValidateUtf8 = 1 << 0,
12164 kUpb_MessageModifier_DefaultIsPacked = 1 << 1,
12165 kUpb_MessageModifier_IsExtendable = 1 << 2,
12166} kUpb_MessageModifier;
12167
12168
12169#endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12170
12171#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
12172#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
12173
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012174#include <stdint.h>
12175
Adam Cozzette8059da22023-08-16 07:57:14 -070012176
12177// Must be last.
12178
12179// If the input buffer has at least this many bytes available, the encoder call
12180// is guaranteed to succeed (as long as field number order is maintained).
12181#define kUpb_MtDataEncoder_MinSize 16
12182
12183typedef struct {
12184 char* end; // Limit of the buffer passed as a parameter.
12185 // Aliased to internal-only members in .cc.
12186 char internal[32];
12187} upb_MtDataEncoder;
12188
12189#ifdef __cplusplus
12190extern "C" {
12191#endif
12192
12193// Encodes field/oneof information for a given message. The sequence of calls
12194// should look like:
12195//
12196// upb_MtDataEncoder e;
12197// char buf[256];
12198// char* ptr = buf;
12199// e.end = ptr + sizeof(buf);
12200// unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero
12201// ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod);
12202// // Fields *must* be in field number order.
12203// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12204// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12205// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12206//
12207// // If oneofs are present. Oneofs must be encoded after regular fields.
12208// ptr = upb_MiniTable_StartOneof(&e, ptr)
12209// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12210// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12211//
12212// ptr = upb_MiniTable_StartOneof(&e, ptr);
12213// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12214// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12215//
12216// Oneofs must be encoded after all regular fields.
12217char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr,
12218 uint64_t msg_mod);
12219char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr,
12220 upb_FieldType type, uint32_t field_num,
12221 uint64_t field_mod);
12222char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr);
12223char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr,
12224 uint32_t field_num);
12225
12226// Encodes the set of values for a given enum. The values must be given in
12227// order (after casting to uint32_t), and repeats are not allowed.
12228char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr);
12229char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr,
12230 uint32_t val);
12231char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr);
12232
12233// Encodes an entire mini descriptor for an extension.
12234char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr,
12235 upb_FieldType type, uint32_t field_num,
12236 uint64_t field_mod);
12237
12238// Encodes an entire mini descriptor for a map.
12239char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr,
12240 upb_FieldType key_type,
12241 upb_FieldType value_type, uint64_t key_mod,
12242 uint64_t value_mod);
12243
12244// Encodes an entire mini descriptor for a message set.
12245char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr);
12246
12247#ifdef __cplusplus
12248} /* extern "C" */
12249#endif
12250
12251
12252#endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */
12253
Eric Salo8809a112022-11-21 13:01:06 -080012254#ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_
12255#define UPB_REFLECTION_DEF_POOL_INTERNAL_H_
12256
12257
12258// Must be last.
12259
12260#ifdef __cplusplus
12261extern "C" {
12262#endif
12263
12264upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s);
12265size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s);
12266upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s);
12267
12268bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext,
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012269 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012270bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v,
12271 upb_Status* status);
12272bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size,
12273 upb_value* v);
12274
12275void** _upb_DefPool_ScratchData(const upb_DefPool* s);
12276size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080012277void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform);
Eric Salo8809a112022-11-21 13:01:06 -080012278
12279// For generated code only: loads a generated descriptor.
12280typedef struct _upb_DefPool_Init {
12281 struct _upb_DefPool_Init** deps; // Dependencies of this file.
12282 const upb_MiniTableFile* layout;
12283 const char* filename;
12284 upb_StringView descriptor; // Serialized descriptor.
12285} _upb_DefPool_Init;
12286
12287bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init);
12288
12289// Should only be directly called by tests. This variant lets us suppress
12290// the use of compiled-in tables, forcing a rebuild of the tables at runtime.
12291bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init,
12292 bool rebuild_minitable);
12293
12294#ifdef __cplusplus
12295} /* extern "C" */
12296#endif
12297
12298
12299#endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */
12300
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000012301#ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
12302#define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
12303
12304
Eric Salo8809a112022-11-21 13:01:06 -080012305// Must be last.
12306
12307// We want to copy the options verbatim into the destination options proto.
12308// We use serialize+parse as our deep copy.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012309#define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \
12310 if (UPB_DESC(desc_type##_has_options)(proto)) { \
12311 size_t size; \
12312 char* pb = UPB_DESC(options_type##_serialize)( \
12313 UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \
12314 if (!pb) _upb_DefBuilder_OomErr(ctx); \
12315 target = \
12316 UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \
12317 if (!target) _upb_DefBuilder_OomErr(ctx); \
12318 } else { \
12319 target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \
Eric Salo8809a112022-11-21 13:01:06 -080012320 }
12321
12322#ifdef __cplusplus
12323extern "C" {
12324#endif
12325
12326struct upb_DefBuilder {
12327 upb_DefPool* symtab;
12328 upb_FileDef* file; // File we are building.
12329 upb_Arena* arena; // Allocate defs here.
12330 upb_Arena* tmp_arena; // For temporary allocations.
12331 upb_Status* status; // Record errors here.
12332 const upb_MiniTableFile* layout; // NULL if we should build layouts.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012333 upb_MiniTablePlatform platform; // Platform we are targeting.
Eric Salo8809a112022-11-21 13:01:06 -080012334 int enum_count; // Count of enums built so far.
12335 int msg_count; // Count of messages built so far.
12336 int ext_count; // Count of extensions built so far.
12337 jmp_buf err; // longjmp() on error.
12338};
12339
12340extern const char* kUpbDefOptDefault;
12341
12342// ctx->status has already been set elsewhere so just fail/longjmp()
12343UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx);
12344
12345UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt,
12346 ...) UPB_PRINTF(2, 3);
12347UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx);
12348
12349const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx,
12350 const char* prefix,
12351 upb_StringView name);
12352
12353// Given a symbol and the base symbol inside which it is defined,
12354// find the symbol's definition.
12355const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx,
12356 const char* from_name_dbg,
12357 const char* base, upb_StringView sym,
12358 upb_deftype_t* type);
12359
12360const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx,
12361 const char* from_name_dbg, const char* base,
12362 upb_StringView sym, upb_deftype_t type);
12363
12364char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f,
12365 const char** src, const char* end);
12366
12367const char* _upb_DefBuilder_FullToShort(const char* fullname);
12368
12369UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) {
12370 if (bytes == 0) return NULL;
12371 void* ret = upb_Arena_Malloc(ctx->arena, bytes);
12372 if (!ret) _upb_DefBuilder_OomErr(ctx);
12373 return ret;
12374}
12375
12376// Adds a symbol |v| to the symtab, which must be a def pointer previously
12377// packed with pack_def(). The def's pointer to upb_FileDef* must be set before
12378// adding, so we know which entries to remove if building this file fails.
12379UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name,
12380 upb_value v) {
12381 upb_StringView sym = {.data = name, .size = strlen(name)};
12382 bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status);
12383 if (!ok) _upb_DefBuilder_FailJmp(ctx);
12384}
12385
12386UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) {
12387 return ctx->arena;
12388}
12389
12390UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) {
12391 return ctx->file;
12392}
12393
12394// This version of CheckIdent() is only called by other, faster versions after
12395// they detect a parsing error.
12396void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name,
12397 bool full);
12398
Eric Salo8809a112022-11-21 13:01:06 -080012399// Verify a full identifier string. This is slightly more complicated than
12400// verifying a relative identifier string because we must track '.' chars.
12401UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx,
12402 upb_StringView name) {
12403 bool good = name.size > 0;
12404 bool start = true;
12405
12406 for (size_t i = 0; i < name.size; i++) {
12407 const char c = name.data[i];
12408 const char d = c | 0x20; // force lowercase
12409 const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_');
12410 const bool is_numer = ('0' <= c) & (c <= '9') & !start;
12411 const bool is_dot = (c == '.') & !start;
12412
12413 good &= is_alpha | is_numer | is_dot;
12414 start = is_dot;
12415 }
12416
12417 if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true);
12418}
12419
12420#ifdef __cplusplus
12421} /* extern "C" */
12422#endif
12423
12424
12425#endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */
12426
12427#ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
12428#define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
12429
12430
12431// Must be last.
12432
12433#ifdef __cplusplus
12434extern "C" {
12435#endif
12436
12437upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i);
12438bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a);
12439const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e);
12440
12441// Allocate and initialize an array of |n| enum defs.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012442upb_EnumDef* _upb_EnumDefs_New(
12443 upb_DefBuilder* ctx, int n,
12444 const UPB_DESC(EnumDescriptorProto) * const* protos,
12445 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080012446
12447#ifdef __cplusplus
12448} /* extern "C" */
12449#endif
12450
12451
12452#endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */
12453
12454#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
12455#define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
12456
12457
12458// Must be last.
12459
12460#ifdef __cplusplus
12461extern "C" {
12462#endif
12463
12464upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i);
12465
12466// Allocate and initialize an array of |n| enum value defs owned by |e|.
12467upb_EnumValueDef* _upb_EnumValueDefs_New(
12468 upb_DefBuilder* ctx, const char* prefix, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012469 const UPB_DESC(EnumValueDescriptorProto) * const* protos, upb_EnumDef* e,
Eric Salo8809a112022-11-21 13:01:06 -080012470 bool* is_sorted);
12471
12472const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v,
12473 int n, upb_Arena* a);
12474
12475#ifdef __cplusplus
12476} /* extern "C" */
12477#endif
12478
12479
12480#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */
12481
12482#ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
12483#define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
12484
12485
12486// Must be last.
12487
12488#ifdef __cplusplus
12489extern "C" {
12490#endif
12491
12492upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i);
12493
12494const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable(
12495 const upb_FieldDef* f);
12496bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f);
12497bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f);
12498int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
12499uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f);
12500void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix,
12501 upb_FieldDef* f);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012502void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx,
12503 const upb_FieldDef* f);
12504
12505// Allocate and initialize an array of |n| extensions (field defs).
12506upb_FieldDef* _upb_Extensions_New(
12507 upb_DefBuilder* ctx, int n,
12508 const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix,
12509 upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012510
12511// Allocate and initialize an array of |n| field defs.
12512upb_FieldDef* _upb_FieldDefs_New(
12513 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012514 const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix,
Eric Salo8809a112022-11-21 13:01:06 -080012515 upb_MessageDef* m, bool* is_sorted);
12516
12517// Allocate and return a list of pointers to the |n| field defs in |ff|,
12518// sorted by field number.
12519const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n,
12520 upb_Arena* a);
12521
12522#ifdef __cplusplus
12523} /* extern "C" */
12524#endif
12525
12526
12527#endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */
12528
12529#ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_
12530#define UPB_REFLECTION_FILE_DEF_INTERNAL_H_
12531
12532
12533// Must be last.
12534
12535#ifdef __cplusplus
12536extern "C" {
12537#endif
12538
12539const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable(
12540 const upb_FileDef* f, int i);
12541const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f);
12542const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f);
12543
12544// upb_FileDef_Package() returns "" if f->package is NULL, this does not.
12545const char* _upb_FileDef_RawPackage(const upb_FileDef* f);
12546
12547void _upb_FileDef_Create(upb_DefBuilder* ctx,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012548 const UPB_DESC(FileDescriptorProto) * file_proto);
Eric Salo8809a112022-11-21 13:01:06 -080012549
12550#ifdef __cplusplus
12551} /* extern "C" */
12552#endif
12553
12554
12555#endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */
12556
12557#ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
12558#define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
12559
12560
12561// Must be last.
12562
12563#ifdef __cplusplus
12564extern "C" {
12565#endif
12566
12567upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i);
12568bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m);
12569bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size,
12570 upb_value v, upb_Arena* a);
12571void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
12572 const upb_FieldDef* f);
12573bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012574void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012575void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx,
12576 const upb_MessageDef* m);
12577void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m);
12578
12579// Allocate and initialize an array of |n| message defs.
12580upb_MessageDef* _upb_MessageDefs_New(
Mike Kruskal232ecf42023-01-14 00:09:40 -080012581 upb_DefBuilder* ctx, int n, const UPB_DESC(DescriptorProto) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012582 const upb_MessageDef* containing_type);
12583
12584#ifdef __cplusplus
12585} /* extern "C" */
12586#endif
12587
12588
12589#endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */
12590
12591#ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
12592#define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
12593
12594
12595// Must be last.
12596
12597#ifdef __cplusplus
12598extern "C" {
12599#endif
12600
12601upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i);
12602
12603// Allocate and initialize an array of |n| service defs.
12604upb_ServiceDef* _upb_ServiceDefs_New(
12605 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012606 const UPB_DESC(ServiceDescriptorProto) * const* protos);
Eric Salo8809a112022-11-21 13:01:06 -080012607
12608#ifdef __cplusplus
12609} /* extern "C" */
12610#endif
12611
12612
12613#endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */
12614
12615#ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_
12616#define UPB_REFLECTION_DESC_STATE_INTERNAL_H_
12617
12618
12619// Must be last.
12620
12621// Manages the storage for mini descriptor strings as they are being encoded.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000012622// TODO: Move some of this state directly into the encoder, maybe.
Eric Salo8809a112022-11-21 13:01:06 -080012623typedef struct {
12624 upb_MtDataEncoder e;
12625 size_t bufsize;
12626 char* buf;
12627 char* ptr;
12628} upb_DescState;
12629
12630#ifdef __cplusplus
12631extern "C" {
12632#endif
12633
12634UPB_INLINE void _upb_DescState_Init(upb_DescState* d) {
12635 d->bufsize = kUpb_MtDataEncoder_MinSize * 2;
12636 d->buf = NULL;
12637 d->ptr = NULL;
12638}
12639
12640bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a);
12641
12642#ifdef __cplusplus
12643} /* extern "C" */
12644#endif
12645
12646
12647#endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */
12648
12649#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
12650#define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
12651
12652
Protobuf Team Bot06310352023-09-26 21:54:58 +000012653// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012654
12655#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
12656#define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
12657
12658
12659// Must be last.
12660
12661#ifdef __cplusplus
12662extern "C" {
12663#endif
12664
12665int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r);
12666int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r);
12667
12668#ifdef __cplusplus
12669} /* extern "C" */
12670#endif
12671
12672
12673#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */
12674
12675// Must be last.
12676
12677#ifdef __cplusplus
12678extern "C" {
12679#endif
12680
12681upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r,
12682 int i);
12683
12684// Allocate and initialize an array of |n| reserved ranges owned by |e|.
12685upb_EnumReservedRange* _upb_EnumReservedRanges_New(
12686 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012687 const UPB_DESC(EnumDescriptorProto_EnumReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012688 const upb_EnumDef* e);
12689
12690#ifdef __cplusplus
12691} /* extern "C" */
12692#endif
12693
12694
12695#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */
12696
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000012697#ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_
12698#define UPB_REFLECTION_INTERNAL_STRDUP2_H_
12699
12700#include <stddef.h>
12701
12702
12703// Must be last.
12704
12705#ifdef __cplusplus
12706extern "C" {
12707#endif
12708
12709// Variant that works with a length-delimited rather than NULL-delimited string,
12710// as supported by strtable.
12711char* upb_strdup2(const char* s, size_t len, upb_Arena* a);
12712
12713#ifdef __cplusplus
12714} /* extern "C" */
12715#endif
12716
12717
12718#endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */
12719
Eric Salo8809a112022-11-21 13:01:06 -080012720#ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
12721#define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
12722
12723
12724// Must be last.
12725
12726#ifdef __cplusplus
12727extern "C" {
12728#endif
12729
12730upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i);
12731
12732// Allocate and initialize an array of |n| extension ranges owned by |m|.
12733upb_ExtensionRange* _upb_ExtensionRanges_New(
12734 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012735 const UPB_DESC(DescriptorProto_ExtensionRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012736 const upb_MessageDef* m);
12737
12738#ifdef __cplusplus
12739} /* extern "C" */
12740#endif
12741
12742
12743#endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */
12744
12745#ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
12746#define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
12747
12748
12749// Must be last.
12750
12751#ifdef __cplusplus
12752extern "C" {
12753#endif
12754
12755upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012756void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o,
12757 const upb_FieldDef* f, const char* name, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -080012758
12759// Allocate and initialize an array of |n| oneof defs owned by |m|.
12760upb_OneofDef* _upb_OneofDefs_New(
12761 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012762 const UPB_DESC(OneofDescriptorProto) * const* protos, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012763
12764size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m);
12765
12766#ifdef __cplusplus
12767} /* extern "C" */
12768#endif
12769
12770
12771#endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */
12772
12773#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
12774#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
12775
12776
Protobuf Team Bot06310352023-09-26 21:54:58 +000012777// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012778
12779#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
12780#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
12781
12782
12783// Must be last.
12784
12785#ifdef __cplusplus
12786extern "C" {
12787#endif
12788
12789int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r);
12790int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r);
12791
12792#ifdef __cplusplus
12793} /* extern "C" */
12794#endif
12795
12796
12797#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */
12798
12799// Must be last.
12800
12801#ifdef __cplusplus
12802extern "C" {
12803#endif
12804
12805upb_MessageReservedRange* _upb_MessageReservedRange_At(
12806 const upb_MessageReservedRange* r, int i);
12807
12808// Allocate and initialize an array of |n| reserved ranges owned by |m|.
12809upb_MessageReservedRange* _upb_MessageReservedRanges_New(
12810 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012811 const UPB_DESC(DescriptorProto_ReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012812 const upb_MessageDef* m);
12813
12814#ifdef __cplusplus
12815} /* extern "C" */
12816#endif
12817
12818
12819#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */
12820
12821#ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
12822#define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
12823
12824
12825// Must be last.
12826
12827#ifdef __cplusplus
12828extern "C" {
12829#endif
12830
12831upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i);
12832
12833// Allocate and initialize an array of |n| method defs owned by |s|.
12834upb_MethodDef* _upb_MethodDefs_New(
12835 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012836 const UPB_DESC(MethodDescriptorProto) * const* protos, upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012837
12838#ifdef __cplusplus
12839} /* extern "C" */
12840#endif
12841
12842
12843#endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */
12844
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012845#ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_
12846#define UPB_WIRE_INTERNAL_CONSTANTS_H_
Eric Salo8809a112022-11-21 13:01:06 -080012847
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012848#define kUpb_WireFormat_DefaultDepthLimit 100
Eric Salo8809a112022-11-21 13:01:06 -080012849
12850// MessageSet wire format is:
12851// message MessageSet {
12852// repeated group Item = 1 {
12853// required int32 type_id = 2;
12854// required bytes message = 3;
12855// }
12856// }
12857
12858enum {
12859 kUpb_MsgSet_Item = 1,
12860 kUpb_MsgSet_TypeId = 2,
12861 kUpb_MsgSet_Message = 3,
12862};
12863
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012864#endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */
Eric Salo8809a112022-11-21 13:01:06 -080012865
12866/*
12867 * Internal implementation details of the decoder that are shared between
12868 * decode.c and decode_fast.c.
12869 */
12870
Sandy Zhange3b09432023-08-07 09:30:02 -070012871#ifndef UPB_WIRE_INTERNAL_DECODE_H_
12872#define UPB_WIRE_INTERNAL_DECODE_H_
Eric Salo8809a112022-11-21 13:01:06 -080012873
Eric Salo3f36a912022-12-05 14:12:25 -080012874#include "utf8_range.h"
Joshua Habermand3995ec2022-09-30 16:54:39 -070012875
12876// Must be last.
12877
12878#define DECODE_NOGROUP (uint32_t) - 1
12879
12880typedef struct upb_Decoder {
Eric Salo10505992022-12-12 12:16:36 -080012881 upb_EpsCopyInputStream input;
12882 const upb_ExtensionRegistry* extreg;
12883 const char* unknown; // Start of unknown data, preserve at buffer flip
12884 upb_Message* unknown_msg; // Pointer to preserve data to
12885 int depth; // Tracks recursion depth to bound stack usage.
12886 uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP.
Joshua Habermand3995ec2022-09-30 16:54:39 -070012887 uint16_t options;
12888 bool missing_required;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012889 upb_Arena arena;
Mike Kruskal232ecf42023-01-14 00:09:40 -080012890 upb_DecodeStatus status;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012891 jmp_buf err;
12892
12893#ifndef NDEBUG
12894 const char* debug_tagstart;
12895 const char* debug_valstart;
12896#endif
12897} upb_Decoder;
12898
12899/* Error function that will abort decoding with longjmp(). We can't declare this
12900 * UPB_NORETURN, even though it is appropriate, because if we do then compilers
12901 * will "helpfully" refuse to tailcall to it
12902 * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
12903 * of our optimizations. That is also why we must declare it in a separate file,
12904 * otherwise the compiler will see that it calls longjmp() and deduce that it is
12905 * noreturn. */
12906const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status);
12907
12908extern const uint8_t upb_utf8_offsets[];
12909
12910UPB_INLINE
12911bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) {
12912 const char* end = ptr + len;
12913
12914 // Check 8 bytes at a time for any non-ASCII char.
12915 while (end - ptr >= 8) {
12916 uint64_t data;
12917 memcpy(&data, ptr, 8);
12918 if (data & 0x8080808080808080) goto non_ascii;
12919 ptr += 8;
12920 }
12921
12922 // Check one byte at a time for non-ASCII.
12923 while (ptr < end) {
12924 if (*ptr & 0x80) goto non_ascii;
12925 ptr++;
12926 }
12927
12928 return true;
12929
12930non_ascii:
12931 return utf8_range2((const unsigned char*)ptr, end - ptr) == 0;
12932}
12933
12934const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr,
12935 const upb_Message* msg,
12936 const upb_MiniTable* l);
12937
12938/* x86-64 pointers always have the high 16 bits matching. So we can shift
12939 * left 8 and right 8 without loss of information. */
12940UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) {
12941 return ((intptr_t)tablep << 8) | tablep->table_mask;
12942}
12943
12944UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) {
12945 return (const upb_MiniTable*)(table >> 8);
12946}
12947
Eric Salo10505992022-12-12 12:16:36 -080012948const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
12949 const char* ptr, int overrun);
12950
12951UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) {
Eric Salob7d54ac2022-12-29 11:59:42 -080012952 return upb_EpsCopyInputStream_IsDoneWithCallback(
12953 &d->input, ptr, &_upb_Decoder_IsDoneFallback);
Joshua Habermand3995ec2022-09-30 16:54:39 -070012954}
12955
Eric Salo10505992022-12-12 12:16:36 -080012956UPB_INLINE const char* _upb_Decoder_BufferFlipCallback(
12957 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) {
12958 upb_Decoder* d = (upb_Decoder*)e;
12959 if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
Joshua Habermand3995ec2022-09-30 16:54:39 -070012960
Eric Salo10505992022-12-12 12:16:36 -080012961 if (d->unknown) {
12962 if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown,
12963 old_end - d->unknown, &d->arena)) {
12964 _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
12965 }
12966 d->unknown = new_start;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012967 }
Eric Salo10505992022-12-12 12:16:36 -080012968 return new_start;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012969}
12970
12971#if UPB_FASTTABLE
12972UPB_INLINE
12973const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr,
12974 upb_Message* msg, intptr_t table,
12975 uint64_t hasbits, uint64_t tag) {
12976 const upb_MiniTable* table_p = decode_totablep(table);
12977 uint8_t mask = table;
12978 uint64_t data;
12979 size_t idx = tag & mask;
12980 UPB_ASSUME((idx & 7) == 0);
12981 idx >>= 3;
12982 data = table_p->fasttable[idx].field_data ^ tag;
12983 UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table,
12984 hasbits, data);
12985}
12986#endif
12987
12988UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) {
12989 uint16_t tag;
12990 memcpy(&tag, ptr, 2);
12991 return tag;
12992}
12993
Joshua Habermand3995ec2022-09-30 16:54:39 -070012994
Sandy Zhange3b09432023-08-07 09:30:02 -070012995#endif /* UPB_WIRE_INTERNAL_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -070012996
Eric Salo8809a112022-11-21 13:01:06 -080012997// This should #undef all macros #defined in def.inc
Joshua Haberman9abf6e22021-01-13 12:16:25 -080012998
Joshua Haberman9abf6e22021-01-13 12:16:25 -080012999#undef UPB_SIZE
13000#undef UPB_PTR_AT
Joshua Habermandd69a482021-05-17 22:40:33 -070013001#undef UPB_MAPTYPE_STRING
Eric Salo3f36a912022-12-05 14:12:25 -080013002#undef UPB_EXPORT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013003#undef UPB_INLINE
Eric Salo3f36a912022-12-05 14:12:25 -080013004#undef UPB_API
13005#undef UPB_API_INLINE
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013006#undef UPB_ALIGN_UP
13007#undef UPB_ALIGN_DOWN
13008#undef UPB_ALIGN_MALLOC
13009#undef UPB_ALIGN_OF
Joshua Habermand3995ec2022-09-30 16:54:39 -070013010#undef UPB_MALLOC_ALIGN
Joshua Habermandd69a482021-05-17 22:40:33 -070013011#undef UPB_LIKELY
13012#undef UPB_UNLIKELY
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013013#undef UPB_FORCEINLINE
13014#undef UPB_NOINLINE
13015#undef UPB_NORETURN
Joshua Habermandd69a482021-05-17 22:40:33 -070013016#undef UPB_PRINTF
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013017#undef UPB_MAX
13018#undef UPB_MIN
13019#undef UPB_UNUSED
13020#undef UPB_ASSUME
13021#undef UPB_ASSERT
13022#undef UPB_UNREACHABLE
Joshua Habermandd69a482021-05-17 22:40:33 -070013023#undef UPB_SETJMP
13024#undef UPB_LONGJMP
13025#undef UPB_PTRADD
13026#undef UPB_MUSTTAIL
13027#undef UPB_FASTTABLE_SUPPORTED
Mike Kruskal232ecf42023-01-14 00:09:40 -080013028#undef UPB_FASTTABLE_MASK
Joshua Habermandd69a482021-05-17 22:40:33 -070013029#undef UPB_FASTTABLE
13030#undef UPB_FASTTABLE_INIT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013031#undef UPB_POISON_MEMORY_REGION
13032#undef UPB_UNPOISON_MEMORY_REGION
13033#undef UPB_ASAN
Sandy Zhange3b09432023-08-07 09:30:02 -070013034#undef UPB_ASAN_GUARD_SIZE
13035#undef UPB_CLANG_ASAN
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070013036#undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3
Joshua Habermand3995ec2022-09-30 16:54:39 -070013037#undef UPB_DEPRECATED
13038#undef UPB_GNUC_MIN
Mike Kruskal232ecf42023-01-14 00:09:40 -080013039#undef UPB_DESCRIPTOR_UPB_H_FILENAME
13040#undef UPB_DESC
13041#undef UPB_IS_GOOGLE3
Eric Salodfb71552023-03-22 12:35:09 -070013042#undef UPB_ATOMIC
13043#undef UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -070013044#undef UPB_PRIVATE