blob: d2cf56e965c568e63f9811d5ea0573db842cfd77 [file] [log] [blame]
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07001// Ruby is still using proto3 enum semantics for proto2
Protobuf Team Bot5e8d7e52024-03-15 22:28:30 +00002#define UPB_DISABLE_CLOSED_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
Protobuf Team Bote2785502023-12-21 21:28:36 +000099#ifdef _MSC_VER
100// Some versions of our Windows compiler don't support the C11 syntax.
101#define UPB_ALIGN_AS(x) __declspec(align(x))
102#else
103#define UPB_ALIGN_AS(x) _Alignas(x)
104#endif
105
Eric Salo8809a112022-11-21 13:01:06 -0800106// Hints to the compiler about likely/unlikely branches.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800107#if defined (__GNUC__) || defined(__clang__)
Eric Salo8809a112022-11-21 13:01:06 -0800108#define UPB_LIKELY(x) __builtin_expect((bool)(x), 1)
109#define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800110#else
111#define UPB_LIKELY(x) (x)
112#define UPB_UNLIKELY(x) (x)
113#endif
114
Eric Salo8809a112022-11-21 13:01:06 -0800115// Macros for function attributes on compilers that support them.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800116#ifdef __GNUC__
Protobuf Team Bot1d143b52024-01-25 20:29:43 +0000117#define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800118#define UPB_NOINLINE __attribute__((noinline))
119#define UPB_NORETURN __attribute__((__noreturn__))
120#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg)))
121#elif defined(_MSC_VER)
122#define UPB_NOINLINE
Protobuf Team Bot1d143b52024-01-25 20:29:43 +0000123#define UPB_FORCEINLINE static
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800124#define UPB_NORETURN __declspec(noreturn)
125#define UPB_PRINTF(str, first_vararg)
126#else /* !defined(__GNUC__) */
Protobuf Team Bot1d143b52024-01-25 20:29:43 +0000127#define UPB_FORCEINLINE static
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800128#define UPB_NOINLINE
129#define UPB_NORETURN
130#define UPB_PRINTF(str, first_vararg)
131#endif
132
133#define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
134#define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
135
136#define UPB_UNUSED(var) (void)var
137
Eric Salo8809a112022-11-21 13:01:06 -0800138// UPB_ASSUME(): in release mode, we tell the compiler to assume this is true.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800139#ifdef NDEBUG
140#ifdef __GNUC__
141#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable()
142#elif defined _MSC_VER
143#define UPB_ASSUME(expr) if (!(expr)) __assume(0)
144#else
145#define UPB_ASSUME(expr) do {} while (false && (expr))
146#endif
147#else
148#define UPB_ASSUME(expr) assert(expr)
149#endif
150
151/* UPB_ASSERT(): in release mode, we use the expression without letting it be
152 * evaluated. This prevents "unused variable" warnings. */
153#ifdef NDEBUG
154#define UPB_ASSERT(expr) do {} while (false && (expr))
155#else
156#define UPB_ASSERT(expr) assert(expr)
157#endif
158
159#if defined(__GNUC__) || defined(__clang__)
160#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
Eric Salo10505992022-12-12 12:16:36 -0800161#elif defined(_MSC_VER)
162#define UPB_UNREACHABLE() \
163 do { \
164 assert(0); \
165 __assume(0); \
166 } while (0)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800167#else
168#define UPB_UNREACHABLE() do { assert(0); } while(0)
169#endif
170
171/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */
172#ifdef __APPLE__
173#define UPB_SETJMP(buf) _setjmp(buf)
174#define UPB_LONGJMP(buf, val) _longjmp(buf, val)
175#else
176#define UPB_SETJMP(buf) setjmp(buf)
177#define UPB_LONGJMP(buf, val) longjmp(buf, val)
178#endif
179
Eric Salodfb71552023-03-22 12:35:09 -0700180#ifdef __GNUC__
181#define UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -0700182#define UPB_ATOMIC(T) _Atomic(T)
Eric Salodfb71552023-03-22 12:35:09 -0700183#else
Deanna Garciac7d979d2023-04-14 17:22:13 -0700184#define UPB_ATOMIC(T) T
Eric Salodfb71552023-03-22 12:35:09 -0700185#endif
186
Joshua Habermandd69a482021-05-17 22:40:33 -0700187/* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */
188#define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr))
189
Deanna Garciac7d979d2023-04-14 17:22:13 -0700190#define UPB_PRIVATE(x) x##_dont_copy_me__upb_internal_use_only
191
Protobuf Team Bot07194fc2023-11-30 05:43:03 +0000192#ifdef UPB_ALLOW_PRIVATE_ACCESS__FOR_BITS_ONLY
193#define UPB_ONLYBITS(x) x
194#else
195#define UPB_ONLYBITS(x) UPB_PRIVATE(x)
196#endif
197
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800198/* Configure whether fasttable is switched on or not. *************************/
199
Joshua Habermandd69a482021-05-17 22:40:33 -0700200#ifdef __has_attribute
201#define UPB_HAS_ATTRIBUTE(x) __has_attribute(x)
202#else
203#define UPB_HAS_ATTRIBUTE(x) 0
204#endif
205
206#if UPB_HAS_ATTRIBUTE(musttail)
207#define UPB_MUSTTAIL __attribute__((musttail))
208#else
209#define UPB_MUSTTAIL
210#endif
211
212#undef UPB_HAS_ATTRIBUTE
213
214/* This check is not fully robust: it does not require that we have "musttail"
215 * support available. We need tail calls to avoid consuming arbitrary amounts
216 * of stack space.
217 *
218 * GCC/Clang can mostly be trusted to generate tail calls as long as
219 * optimization is enabled, but, debug builds will not generate tail calls
220 * unless "musttail" is available.
221 *
222 * We should probably either:
223 * 1. require that the compiler supports musttail.
224 * 2. add some fallback code for when musttail isn't available (ie. return
225 * instead of tail calling). This is safe and portable, but this comes at
226 * a CPU cost.
227 */
228#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800229#define UPB_FASTTABLE_SUPPORTED 1
230#else
231#define UPB_FASTTABLE_SUPPORTED 0
232#endif
233
234/* define UPB_ENABLE_FASTTABLE to force fast table support.
235 * This is useful when we want to ensure we are really getting fasttable,
236 * for example for testing or benchmarking. */
237#if defined(UPB_ENABLE_FASTTABLE)
238#if !UPB_FASTTABLE_SUPPORTED
Joshua Habermandd69a482021-05-17 22:40:33 -0700239#error fasttable is x86-64/ARM64 only and requires GCC or Clang.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800240#endif
241#define UPB_FASTTABLE 1
242/* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible.
243 * This is useful for releasing code that might be used on multiple platforms,
244 * for example the PHP or Ruby C extensions. */
245#elif defined(UPB_TRY_ENABLE_FASTTABLE)
246#define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
247#else
248#define UPB_FASTTABLE 0
249#endif
250
251/* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully
Mike Kruskal232ecf42023-01-14 00:09:40 -0800252 * degrade to non-fasttable if the runtime or platform do not support it. */
253#if !UPB_FASTTABLE
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800254#define UPB_FASTTABLE_INIT(...)
Mike Kruskal232ecf42023-01-14 00:09:40 -0800255#define UPB_FASTTABLE_MASK(mask) -1
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800256#else
257#define UPB_FASTTABLE_INIT(...) __VA_ARGS__
Mike Kruskal232ecf42023-01-14 00:09:40 -0800258#define UPB_FASTTABLE_MASK(mask) mask
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800259#endif
260
261#undef UPB_FASTTABLE_SUPPORTED
262
Joshua Habermand3995ec2022-09-30 16:54:39 -0700263/* ASAN poisoning (for arena).
264 * If using UPB from an interpreted language like Ruby, a build of the
Joshua Haberman488b8b92022-09-30 18:07:16 -0700265 * interpreter compiled with ASAN enabled must be used in order to get sane and
Joshua Habermand3995ec2022-09-30 16:54:39 -0700266 * expected behavior.
267 */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800268
Sandy Zhange3b09432023-08-07 09:30:02 -0700269/* Due to preprocessor limitations, the conditional logic for setting
270 * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner.
271 * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html.
272 */
273#if defined(__has_feature)
274#if __has_feature(address_sanitizer)
275#define UPB_CLANG_ASAN 1
276#else
277#define UPB_CLANG_ASAN 0
278#endif
279#else
280#define UPB_CLANG_ASAN 0
281#endif
282
283#if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800284#define UPB_ASAN 1
Sandy Zhange3b09432023-08-07 09:30:02 -0700285#define UPB_ASAN_GUARD_SIZE 32
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800286#ifdef __cplusplus
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700287 extern "C" {
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800288#endif
289void __asan_poison_memory_region(void const volatile *addr, size_t size);
290void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
291#ifdef __cplusplus
292} /* extern "C" */
293#endif
294#define UPB_POISON_MEMORY_REGION(addr, size) \
295 __asan_poison_memory_region((addr), (size))
296#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
297 __asan_unpoison_memory_region((addr), (size))
298#else
299#define UPB_ASAN 0
Sandy Zhange3b09432023-08-07 09:30:02 -0700300#define UPB_ASAN_GUARD_SIZE 0
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800301#define UPB_POISON_MEMORY_REGION(addr, size) \
302 ((void)(addr), (void)(size))
303#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
304 ((void)(addr), (void)(size))
Joshua Habermandd69a482021-05-17 22:40:33 -0700305#endif
306
Joshua Haberman7ecf43f2022-03-14 13:11:29 -0700307/* Disable proto2 arena behavior (TEMPORARY) **********************************/
308
Protobuf Team Bot5e8d7e52024-03-15 22:28:30 +0000309#ifdef UPB_DISABLE_CLOSED_ENUM_CHECKING
310#define UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN 1
Joshua Haberman7ecf43f2022-03-14 13:11:29 -0700311#else
Protobuf Team Bot5e8d7e52024-03-15 22:28:30 +0000312#define UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN 0
Joshua Haberman7ecf43f2022-03-14 13:11:29 -0700313#endif
314
Joshua Habermand3995ec2022-09-30 16:54:39 -0700315#if defined(__cplusplus)
316#if defined(__clang__) || UPB_GNUC_MIN(6, 0)
317// https://gcc.gnu.org/gcc-6/changes.html
318#if __cplusplus >= 201402L
319#define UPB_DEPRECATED [[deprecated]]
320#else
321#define UPB_DEPRECATED __attribute__((deprecated))
322#endif
323#else
324#define UPB_DEPRECATED
325#endif
326#else
327#define UPB_DEPRECATED
328#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800329
Mike Kruskal232ecf42023-01-14 00:09:40 -0800330// begin:google_only
331// #define UPB_IS_GOOGLE3
332// end:google_only
333
334#if defined(UPB_IS_GOOGLE3) && !defined(UPB_BOOTSTRAP_STAGE0)
335#define UPB_DESC(sym) proto2_##sym
Protobuf Team Botce9dcc22023-11-03 22:38:26 +0000336#define UPB_DESC_MINITABLE(sym) &proto2__##sym##_msg_init
337#elif defined(UPB_BOOTSTRAP_STAGE0)
338#define UPB_DESC(sym) google_protobuf_##sym
339#define UPB_DESC_MINITABLE(sym) google__protobuf__##sym##_msg_init()
Mike Kruskal232ecf42023-01-14 00:09:40 -0800340#else
341#define UPB_DESC(sym) google_protobuf_##sym
Protobuf Team Botce9dcc22023-11-03 22:38:26 +0000342#define UPB_DESC_MINITABLE(sym) &google__protobuf__##sym##_msg_init
Mike Kruskal232ecf42023-01-14 00:09:40 -0800343#endif
344
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +0000345#ifdef UPB_TRACING_ENABLED
346#ifdef NDEBUG
347error UPB_TRACING_ENABLED Tracing should be disabled in production builds
348#endif
349#endif
350
Eric Salo8809a112022-11-21 13:01:06 -0800351#ifndef UPB_BASE_STATUS_H_
352#define UPB_BASE_STATUS_H_
353
354#include <stdarg.h>
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700355
356// Must be last.
357
Protobuf Team Botb931e792024-01-31 21:16:11 +0000358#define _kUpb_Status_MaxMessage 511
Eric Salo8809a112022-11-21 13:01:06 -0800359
360typedef struct {
361 bool ok;
362 char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated.
363} upb_Status;
364
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700365#ifdef __cplusplus
366extern "C" {
367#endif
368
Eric Salo3f36a912022-12-05 14:12:25 -0800369UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status);
370UPB_API bool upb_Status_IsOk(const upb_Status* status);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700371
Eric Salo8809a112022-11-21 13:01:06 -0800372// These are no-op if |status| is NULL.
Eric Salo3f36a912022-12-05 14:12:25 -0800373UPB_API void upb_Status_Clear(upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -0800374void upb_Status_SetErrorMessage(upb_Status* status, const char* msg);
375void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...)
376 UPB_PRINTF(2, 3);
377void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt,
378 va_list args) UPB_PRINTF(2, 0);
379void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt,
380 va_list args) UPB_PRINTF(2, 0);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700381
382#ifdef __cplusplus
383} /* extern "C" */
384#endif
385
386
Eric Salo8809a112022-11-21 13:01:06 -0800387#endif /* UPB_BASE_STATUS_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700388
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000389#ifndef UPB_GENERATED_CODE_SUPPORT_H_
390#define UPB_GENERATED_CODE_SUPPORT_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700391
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000392// IWYU pragma: begin_exports
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800393
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +0000394#ifndef UPB_BASE_UPCAST_H_
395#define UPB_BASE_UPCAST_H_
396
397// Must be last.
398
399// This macro provides a way to upcast message pointers in a way that is
400// somewhat more bulletproof than blindly casting a pointer. Example:
401//
402// typedef struct {
403// upb_Message UPB_PRIVATE(base);
404// } pkg_FooMessage;
405//
406// void f(pkg_FooMessage* msg) {
407// upb_Decode(UPB_UPCAST(msg), ...);
408// }
409
410#define UPB_UPCAST(x) (&(x)->base##_dont_copy_me__upb_internal_use_only)
411
412
413#endif /* UPB_BASE_UPCAST_H_ */
414
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000415#ifndef UPB_MESSAGE_ACCESSORS_H_
416#define UPB_MESSAGE_ACCESSORS_H_
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000417
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000418#include <stddef.h>
419#include <stdint.h>
420#include <string.h>
421
Joshua Habermand3995ec2022-09-30 16:54:39 -0700422
Eric Salo8809a112022-11-21 13:01:06 -0800423#ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_
424#define UPB_BASE_DESCRIPTOR_CONSTANTS_H_
425
Eric Salodfb71552023-03-22 12:35:09 -0700426// Must be last.
427
Eric Salo8809a112022-11-21 13:01:06 -0800428// The types a field can have. Note that this list is not identical to the
429// types defined in descriptor.proto, which gives INT32 and SINT32 separate
430// types (we distinguish the two with the "integer encoding" enum below).
431// This enum is an internal convenience only and has no meaning outside of upb.
432typedef enum {
433 kUpb_CType_Bool = 1,
434 kUpb_CType_Float = 2,
435 kUpb_CType_Int32 = 3,
436 kUpb_CType_UInt32 = 4,
Protobuf Team Bot986cbb62023-09-19 15:03:51 +0000437 kUpb_CType_Enum = 5, // Enum values are int32. TODO: rename
Eric Salo8809a112022-11-21 13:01:06 -0800438 kUpb_CType_Message = 6,
439 kUpb_CType_Double = 7,
440 kUpb_CType_Int64 = 8,
441 kUpb_CType_UInt64 = 9,
442 kUpb_CType_String = 10,
443 kUpb_CType_Bytes = 11
444} upb_CType;
445
446// The repeated-ness of each field; this matches descriptor.proto.
447typedef enum {
448 kUpb_Label_Optional = 1,
449 kUpb_Label_Required = 2,
450 kUpb_Label_Repeated = 3
451} upb_Label;
452
453// Descriptor types, as defined in descriptor.proto.
454typedef enum {
455 kUpb_FieldType_Double = 1,
456 kUpb_FieldType_Float = 2,
457 kUpb_FieldType_Int64 = 3,
458 kUpb_FieldType_UInt64 = 4,
459 kUpb_FieldType_Int32 = 5,
460 kUpb_FieldType_Fixed64 = 6,
461 kUpb_FieldType_Fixed32 = 7,
462 kUpb_FieldType_Bool = 8,
463 kUpb_FieldType_String = 9,
464 kUpb_FieldType_Group = 10,
465 kUpb_FieldType_Message = 11,
466 kUpb_FieldType_Bytes = 12,
467 kUpb_FieldType_UInt32 = 13,
468 kUpb_FieldType_Enum = 14,
469 kUpb_FieldType_SFixed32 = 15,
470 kUpb_FieldType_SFixed64 = 16,
471 kUpb_FieldType_SInt32 = 17,
472 kUpb_FieldType_SInt64 = 18,
473} upb_FieldType;
474
475#define kUpb_FieldType_SizeOf 19
476
Eric Salodfb71552023-03-22 12:35:09 -0700477#ifdef __cplusplus
478extern "C" {
479#endif
480
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000481// Convert from upb_FieldType to upb_CType
482UPB_INLINE upb_CType upb_FieldType_CType(upb_FieldType field_type) {
483 static const upb_CType c_type[] = {
484 kUpb_CType_Double, // kUpb_FieldType_Double
485 kUpb_CType_Float, // kUpb_FieldType_Float
486 kUpb_CType_Int64, // kUpb_FieldType_Int64
487 kUpb_CType_UInt64, // kUpb_FieldType_UInt64
488 kUpb_CType_Int32, // kUpb_FieldType_Int32
489 kUpb_CType_UInt64, // kUpb_FieldType_Fixed64
490 kUpb_CType_UInt32, // kUpb_FieldType_Fixed32
491 kUpb_CType_Bool, // kUpb_FieldType_Bool
492 kUpb_CType_String, // kUpb_FieldType_String
493 kUpb_CType_Message, // kUpb_FieldType_Group
494 kUpb_CType_Message, // kUpb_FieldType_Message
495 kUpb_CType_Bytes, // kUpb_FieldType_Bytes
496 kUpb_CType_UInt32, // kUpb_FieldType_UInt32
497 kUpb_CType_Enum, // kUpb_FieldType_Enum
498 kUpb_CType_Int32, // kUpb_FieldType_SFixed32
499 kUpb_CType_Int64, // kUpb_FieldType_SFixed64
500 kUpb_CType_Int32, // kUpb_FieldType_SInt32
501 kUpb_CType_Int64, // kUpb_FieldType_SInt64
502 };
503
504 // -1 here because the enum is one-based but the table is zero-based.
505 return c_type[field_type - 1];
506}
507
508UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType field_type) {
Eric Salodfb71552023-03-22 12:35:09 -0700509 // clang-format off
510 const unsigned kUnpackableTypes =
511 (1 << kUpb_FieldType_String) |
512 (1 << kUpb_FieldType_Bytes) |
513 (1 << kUpb_FieldType_Message) |
514 (1 << kUpb_FieldType_Group);
515 // clang-format on
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000516 return (1 << field_type) & ~kUnpackableTypes;
Eric Salodfb71552023-03-22 12:35:09 -0700517}
518
519#ifdef __cplusplus
520} /* extern "C" */
521#endif
522
523
Eric Salo8809a112022-11-21 13:01:06 -0800524#endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000525#ifndef UPB_BASE_STRING_VIEW_H_
526#define UPB_BASE_STRING_VIEW_H_
Eric Salo8809a112022-11-21 13:01:06 -0800527
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000528#include <string.h>
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000529
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000530// Must be last.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000531
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000532#define UPB_STRINGVIEW_INIT(ptr, len) \
533 { ptr, len }
534
535#define UPB_STRINGVIEW_FORMAT "%.*s"
536#define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data
537
538// LINT.IfChange(struct_definition)
539typedef struct {
540 const char* data;
541 size_t size;
542} upb_StringView;
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000543
544#ifdef __cplusplus
545extern "C" {
546#endif
547
548UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data,
549 size_t size) {
550 upb_StringView ret;
551 ret.data = data;
552 ret.size = size;
553 return ret;
554}
555
556UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) {
557 return upb_StringView_FromDataAndSize(data, strlen(data));
558}
559
560UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
Protobuf Team Botddc54062023-12-12 20:03:38 +0000561 return (a.size == b.size) && (!a.size || !memcmp(a.data, b.data, a.size));
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000562}
563
Protobuf Team Bot030ab8d2023-12-01 19:20:11 +0000564// LINT.ThenChange(
Protobuf Team Botfd82df72024-01-29 20:24:42 +0000565// GoogleInternalName1,
Protobuf Team Bot030ab8d2023-12-01 19:20:11 +0000566// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string,
567// //depot/google3/third_party/upb/bits/typescript/string_view.ts
568// )
569
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000570#ifdef __cplusplus
571} /* extern "C" */
572#endif
573
574
575#endif /* UPB_BASE_STRING_VIEW_H_ */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000576
Eric Salo8809a112022-11-21 13:01:06 -0800577/* upb_Arena is a specific allocator implementation that uses arena allocation.
578 * The user provides an allocator that will be used to allocate the underlying
579 * arena blocks. Arenas by nature do not require the individual allocations
580 * to be freed. However the Arena does allow users to register cleanup
581 * functions that will run when the arena is destroyed.
Joshua Habermandd69a482021-05-17 22:40:33 -0700582 *
Eric Salo8809a112022-11-21 13:01:06 -0800583 * A upb_Arena is *not* thread-safe.
584 *
585 * You could write a thread-safe arena allocator that satisfies the
586 * upb_alloc interface, but it would not be as efficient for the
587 * single-threaded case. */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800588
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700589#ifndef UPB_MEM_ARENA_H_
590#define UPB_MEM_ARENA_H_
Joshua Habermandd69a482021-05-17 22:40:33 -0700591
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700592#include <stddef.h>
593#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800594
595
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700596#ifndef UPB_MEM_ALLOC_H_
597#define UPB_MEM_ALLOC_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700598
599// Must be last.
600
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800601#ifdef __cplusplus
602extern "C" {
603#endif
604
Joshua Habermand3995ec2022-09-30 16:54:39 -0700605typedef struct upb_alloc upb_alloc;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800606
Joshua Habermand3995ec2022-09-30 16:54:39 -0700607/* A combined `malloc()`/`free()` function.
608 * If `size` is 0 then the function acts like `free()`, otherwise it acts like
609 * `realloc()`. Only `oldsize` bytes from a previous allocation are
610 * preserved. */
611typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize,
612 size_t size);
613
614/* A upb_alloc is a possibly-stateful allocator object.
615 *
616 * It could either be an arena allocator (which doesn't require individual
617 * `free()` calls) or a regular `malloc()` (which does). The client must
618 * therefore free memory unless it knows that the allocator is an arena
619 * allocator. */
620struct upb_alloc {
621 upb_alloc_func* func;
622};
623
624UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) {
625 UPB_ASSERT(alloc);
626 return alloc->func(alloc, NULL, 0, size);
627}
628
629UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize,
630 size_t size) {
631 UPB_ASSERT(alloc);
632 return alloc->func(alloc, ptr, oldsize, size);
633}
634
635UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) {
636 UPB_ASSERT(alloc);
637 alloc->func(alloc, ptr, 0, 0);
638}
639
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700640// The global allocator used by upb. Uses the standard malloc()/free().
Joshua Habermand3995ec2022-09-30 16:54:39 -0700641
642extern upb_alloc upb_alloc_global;
643
644/* Functions that hard-code the global malloc.
645 *
646 * We still get benefit because we can put custom logic into our global
647 * allocator, like injecting out-of-memory faults in debug/testing builds. */
648
649UPB_INLINE void* upb_gmalloc(size_t size) {
650 return upb_malloc(&upb_alloc_global, size);
651}
652
653UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) {
654 return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
655}
656
657UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); }
658
659#ifdef __cplusplus
660} /* extern "C" */
661#endif
662
663
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700664#endif /* UPB_MEM_ALLOC_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700665
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000666#ifndef UPB_MEM_INTERNAL_ARENA_H_
667#define UPB_MEM_INTERNAL_ARENA_H_
668
669#include <stddef.h>
670#include <stdint.h>
671#include <string.h>
672
673// Must be last.
674
675// This is QUITE an ugly hack, which specifies the number of pointers needed
676// to equal (or exceed) the storage required for one upb_Arena.
677//
678// We need this because the decoder inlines a upb_Arena for performance but
679// the full struct is not visible outside of arena.c. Yes, I know, it's awful.
680#define UPB_ARENA_SIZE_HACK 7
681
Protobuf Team Bot6964e2c2023-12-21 15:42:16 +0000682// LINT.IfChange(upb_Arena)
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000683
684struct upb_Arena {
685 char* UPB_ONLYBITS(ptr);
686 char* UPB_ONLYBITS(end);
687};
688
Protobuf Team Bot6964e2c2023-12-21 15:42:16 +0000689// LINT.ThenChange(//depot/google3/third_party/upb/bits/typescript/arena.ts:upb_Arena)
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000690
691#ifdef __cplusplus
692extern "C" {
693#endif
694
695void UPB_PRIVATE(_upb_Arena_SwapIn)(struct upb_Arena* des,
696 const struct upb_Arena* src);
697void UPB_PRIVATE(_upb_Arena_SwapOut)(struct upb_Arena* des,
698 const struct upb_Arena* src);
699
Protobuf Team Bot56409302024-02-12 16:52:47 +0000700// Returns whether |ptr| was allocated directly by |a| (so care must be used
701// with fused arenas).
702UPB_API bool UPB_ONLYBITS(_upb_Arena_Contains)(const struct upb_Arena* a,
703 void* ptr);
704
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000705UPB_INLINE size_t UPB_PRIVATE(_upb_ArenaHas)(const struct upb_Arena* a) {
706 return (size_t)(a->UPB_ONLYBITS(end) - a->UPB_ONLYBITS(ptr));
707}
708
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000709UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) {
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000710 void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(struct upb_Arena * a, size_t size);
711
712 size = UPB_ALIGN_MALLOC(size);
713 const size_t span = size + UPB_ASAN_GUARD_SIZE;
714 if (UPB_UNLIKELY(UPB_PRIVATE(_upb_ArenaHas)(a) < span)) {
715 return UPB_PRIVATE(_upb_Arena_SlowMalloc)(a, span);
716 }
717
718 // We have enough space to do a fast malloc.
719 void* ret = a->UPB_ONLYBITS(ptr);
720 UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret);
721 UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size);
722 UPB_UNPOISON_MEMORY_REGION(ret, size);
723
724 a->UPB_ONLYBITS(ptr) += span;
725
726 return ret;
727}
728
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000729UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr,
730 size_t oldsize, size_t size) {
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000731 oldsize = UPB_ALIGN_MALLOC(oldsize);
732 size = UPB_ALIGN_MALLOC(size);
733 bool is_most_recent_alloc =
734 (uintptr_t)ptr + oldsize == (uintptr_t)a->UPB_ONLYBITS(ptr);
735
736 if (is_most_recent_alloc) {
737 ptrdiff_t diff = size - oldsize;
738 if ((ptrdiff_t)UPB_PRIVATE(_upb_ArenaHas)(a) >= diff) {
739 a->UPB_ONLYBITS(ptr) += diff;
740 return ptr;
741 }
742 } else if (size <= oldsize) {
743 return ptr;
744 }
745
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000746 void* ret = upb_Arena_Malloc(a, size);
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000747
748 if (ret && oldsize > 0) {
749 memcpy(ret, ptr, UPB_MIN(oldsize, size));
750 }
751
752 return ret;
753}
754
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000755UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr,
756 size_t oldsize, size_t size) {
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000757 oldsize = UPB_ALIGN_MALLOC(oldsize);
758 size = UPB_ALIGN_MALLOC(size);
759 // Must be the last alloc.
760 UPB_ASSERT((char*)ptr + oldsize ==
761 a->UPB_ONLYBITS(ptr) - UPB_ASAN_GUARD_SIZE);
762 UPB_ASSERT(size <= oldsize);
763 a->UPB_ONLYBITS(ptr) = (char*)ptr + size;
764}
765
766#ifdef __cplusplus
767} /* extern "C" */
768#endif
769
770
771#endif /* UPB_MEM_INTERNAL_ARENA_H_ */
772
Joshua Habermand3995ec2022-09-30 16:54:39 -0700773// Must be last.
774
Joshua Habermand3995ec2022-09-30 16:54:39 -0700775typedef struct upb_Arena upb_Arena;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800776
Eric Salo8809a112022-11-21 13:01:06 -0800777#ifdef __cplusplus
778extern "C" {
779#endif
780
Mike Kruskal3bc50492022-12-01 13:34:12 -0800781// Creates an arena from the given initial block (if any -- n may be 0).
782// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
783// is a fixed-size arena and cannot grow.
Eric Salo3f36a912022-12-05 14:12:25 -0800784UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc);
Mike Kruskal3bc50492022-12-01 13:34:12 -0800785
Eric Salo3f36a912022-12-05 14:12:25 -0800786UPB_API void upb_Arena_Free(upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -0800787UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b);
788
Protobuf Team Bot3d597c22023-12-13 04:04:17 +0000789bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner);
790void upb_Arena_DecRefFor(upb_Arena* a, const void* owner);
Protobuf Team Bot777d6a92023-10-06 23:52:49 +0000791
Protobuf Team Bota3c33a82024-02-13 21:14:13 +0000792size_t upb_Arena_SpaceAllocated(upb_Arena* a, size_t* fused_count);
Protobuf Team Bot3d597c22023-12-13 04:04:17 +0000793uint32_t upb_Arena_DebugRefCount(upb_Arena* a);
794
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000795UPB_API_INLINE upb_Arena* upb_Arena_New(void) {
796 return upb_Arena_Init(NULL, 0, &upb_alloc_global);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700797}
798
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000799UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -0800800
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000801UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000802 size_t size);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700803
Joshua Habermand3995ec2022-09-30 16:54:39 -0700804// Shrinks the last alloc from arena.
805// REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena.
806// We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if
807// this was not the last alloc.
Eric Salo3f36a912022-12-05 14:12:25 -0800808UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000809 size_t oldsize, size_t size);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700810
Protobuf Team Botfb08bca2024-03-14 15:21:13 +0000811#ifdef UPB_TRACING_ENABLED
812void upb_Arena_SetTraceHandler(void (*initArenaTraceHandler)(const upb_Arena*,
813 size_t size),
814 void (*fuseArenaTraceHandler)(const upb_Arena*,
815 const upb_Arena*),
816 void (*freeArenaTraceHandler)(const upb_Arena*));
817#endif
818
Joshua Habermand3995ec2022-09-30 16:54:39 -0700819#ifdef __cplusplus
820} /* extern "C" */
821#endif
822
823
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700824#endif /* UPB_MEM_ARENA_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700825
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000826#ifndef UPB_MESSAGE_ARRAY_H_
827#define UPB_MESSAGE_ARRAY_H_
828
829#include <stddef.h>
830
831
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000832#ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_
833#define UPB_MESSAGE_INTERNAL_ARRAY_H_
834
835#include <stdint.h>
836#include <string.h>
837
838
839// Must be last.
840
841#define _UPB_ARRAY_MASK_IMM 0x4 // Frozen/immutable bit.
842#define _UPB_ARRAY_MASK_LG2 0x3 // Encoded elem size.
843#define _UPB_ARRAY_MASK_ALL (_UPB_ARRAY_MASK_IMM | _UPB_ARRAY_MASK_LG2)
844
845#ifdef __cplusplus
846extern "C" {
847#endif
848
Protobuf Team Botfd82df72024-01-29 20:24:42 +0000849// LINT.IfChange(upb_Array)
850
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000851// Our internal representation for repeated fields.
852struct upb_Array {
853 // This is a tagged pointer. Bits #0 and #1 encode the elem size as follows:
854 // 0 maps to elem size 1
855 // 1 maps to elem size 4
856 // 2 maps to elem size 8
857 // 3 maps to elem size 16
858 //
Protobuf Team Bot886a0b12024-01-26 21:23:01 +0000859 // Bit #2 contains the frozen/immutable flag.
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000860 uintptr_t UPB_ONLYBITS(data);
861
862 size_t UPB_ONLYBITS(size); // The number of elements in the array.
863 size_t UPB_PRIVATE(capacity); // Allocated storage. Measured in elements.
864};
865
Protobuf Team Bot886a0b12024-01-26 21:23:01 +0000866UPB_INLINE void UPB_PRIVATE(_upb_Array_ShallowFreeze)(struct upb_Array* arr) {
867 arr->UPB_ONLYBITS(data) |= _UPB_ARRAY_MASK_IMM;
868}
869
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000870UPB_API_INLINE bool upb_Array_IsFrozen(const struct upb_Array* arr) {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +0000871 return (arr->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_IMM) != 0;
872}
873
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000874UPB_INLINE void UPB_PRIVATE(_upb_Array_SetTaggedPtr)(struct upb_Array* array,
875 void* data, size_t lg2) {
876 UPB_ASSERT(lg2 != 1);
877 UPB_ASSERT(lg2 <= 4);
878 const size_t bits = lg2 - (lg2 != 0);
879 array->UPB_ONLYBITS(data) = (uintptr_t)data | bits;
880}
881
882UPB_INLINE size_t
883UPB_PRIVATE(_upb_Array_ElemSizeLg2)(const struct upb_Array* array) {
884 const size_t bits = array->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_LG2;
885 const size_t lg2 = bits + (bits != 0);
886 return lg2;
887}
888
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000889UPB_API_INLINE const void* upb_Array_DataPtr(const struct upb_Array* array) {
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000890 UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array); // Check assertions.
891 return (void*)(array->UPB_ONLYBITS(data) & ~(uintptr_t)_UPB_ARRAY_MASK_ALL);
892}
893
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000894UPB_API_INLINE void* upb_Array_MutableDataPtr(struct upb_Array* array) {
895 return (void*)upb_Array_DataPtr(array);
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000896}
897
898UPB_INLINE struct upb_Array* UPB_PRIVATE(_upb_Array_New)(upb_Arena* arena,
899 size_t init_capacity,
900 int elem_size_lg2) {
901 UPB_ASSERT(elem_size_lg2 != 1);
902 UPB_ASSERT(elem_size_lg2 <= 4);
903 const size_t array_size =
904 UPB_ALIGN_UP(sizeof(struct upb_Array), UPB_MALLOC_ALIGN);
905 const size_t bytes = array_size + (init_capacity << elem_size_lg2);
906 struct upb_Array* array = (struct upb_Array*)upb_Arena_Malloc(arena, bytes);
907 if (!array) return NULL;
908 UPB_PRIVATE(_upb_Array_SetTaggedPtr)
909 (array, UPB_PTR_AT(array, array_size, void), elem_size_lg2);
910 array->UPB_ONLYBITS(size) = 0;
911 array->UPB_PRIVATE(capacity) = init_capacity;
912 return array;
913}
914
915// Resizes the capacity of the array to be at least min_size.
916bool UPB_PRIVATE(_upb_Array_Realloc)(struct upb_Array* array, size_t min_size,
917 upb_Arena* arena);
918
Protobuf Team Bot4b6de0f2024-03-29 19:09:40 +0000919UPB_API_INLINE bool upb_Array_Reserve(struct upb_Array* array, size_t size,
920 upb_Arena* arena) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000921 UPB_ASSERT(!upb_Array_IsFrozen(array));
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000922 if (array->UPB_PRIVATE(capacity) < size)
923 return UPB_PRIVATE(_upb_Array_Realloc)(array, size, arena);
924 return true;
925}
926
927// Resize without initializing new elements.
928UPB_INLINE bool UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
929 struct upb_Array* array, size_t size, upb_Arena* arena) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000930 UPB_ASSERT(!upb_Array_IsFrozen(array));
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000931 UPB_ASSERT(size <= array->UPB_ONLYBITS(size) ||
932 arena); // Allow NULL arena when shrinking.
Protobuf Team Bot4b6de0f2024-03-29 19:09:40 +0000933 if (!upb_Array_Reserve(array, size, arena)) return false;
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000934 array->UPB_ONLYBITS(size) = size;
935 return true;
936}
937
938// This function is intended for situations where elem_size is compile-time
939// constant or a known expression of the form (1 << lg2), so that the expression
940// i*elem_size does not result in an actual multiplication.
941UPB_INLINE void UPB_PRIVATE(_upb_Array_Set)(struct upb_Array* array, size_t i,
942 const void* data,
943 size_t elem_size) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000944 UPB_ASSERT(!upb_Array_IsFrozen(array));
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000945 UPB_ASSERT(i < array->UPB_ONLYBITS(size));
946 UPB_ASSERT(elem_size == 1U << UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array));
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000947 char* arr_data = (char*)upb_Array_MutableDataPtr(array);
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000948 memcpy(arr_data + (i * elem_size), data, elem_size);
949}
950
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000951UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) {
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000952 return arr->UPB_ONLYBITS(size);
953}
954
Protobuf Team Botfd82df72024-01-29 20:24:42 +0000955// LINT.ThenChange(GoogleInternalName0)
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000956
957#ifdef __cplusplus
958} /* extern "C" */
959#endif
960
961#undef _UPB_ARRAY_MASK_IMM
962#undef _UPB_ARRAY_MASK_LG2
963#undef _UPB_ARRAY_MASK_ALL
964
965
966#endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */
967
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000968// Users should include array.h or map.h instead.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000969// IWYU pragma: private, include "upb/message/array.h"
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000970
971#ifndef UPB_MESSAGE_VALUE_H_
972#define UPB_MESSAGE_VALUE_H_
973
974#include <stdint.h>
975
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000976
Protobuf Team Bote1253cd2024-01-08 23:09:09 +0000977typedef union {
978 bool bool_val;
979 float float_val;
980 double double_val;
981 int32_t int32_val;
982 int64_t int64_val;
983 uint32_t uint32_val;
984 uint64_t uint64_val;
985 const struct upb_Array* array_val;
986 const struct upb_Map* map_val;
987 const struct upb_Message* msg_val;
988 upb_StringView str_val;
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000989
Protobuf Team Bote1253cd2024-01-08 23:09:09 +0000990 // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of
991 // msg_val if unlinked sub-messages may possibly be in use. See the
992 // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more
993 // information.
994 uintptr_t tagged_msg_val; // upb_TaggedMessagePtr
995} upb_MessageValue;
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000996
Protobuf Team Bote1253cd2024-01-08 23:09:09 +0000997typedef union {
998 struct upb_Array* array;
999 struct upb_Map* map;
1000 struct upb_Message* msg;
1001} upb_MutableMessageValue;
1002
1003#endif /* UPB_MESSAGE_VALUE_H_ */
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00001004
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001005#ifndef UPB_MINI_TABLE_FIELD_H_
1006#define UPB_MINI_TABLE_FIELD_H_
1007
1008#include <stdint.h>
1009
1010
1011#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
1012#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
1013
1014#include <stddef.h>
1015#include <stdint.h>
1016
1017
1018#ifndef UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
1019#define UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
1020
1021#include <stddef.h>
1022#include <stdint.h>
1023
1024
1025// Must be last.
1026
1027#ifdef __cplusplus
1028extern "C" {
1029#endif
1030
1031// Return the log2 of the storage size in bytes for a upb_CType
1032UPB_INLINE int UPB_PRIVATE(_upb_CType_SizeLg2)(upb_CType c_type) {
1033 static const int8_t size[] = {
1034 0, // kUpb_CType_Bool
1035 2, // kUpb_CType_Float
1036 2, // kUpb_CType_Int32
1037 2, // kUpb_CType_UInt32
1038 2, // kUpb_CType_Enum
1039 UPB_SIZE(2, 3), // kUpb_CType_Message
1040 3, // kUpb_CType_Double
1041 3, // kUpb_CType_Int64
1042 3, // kUpb_CType_UInt64
1043 UPB_SIZE(3, 4), // kUpb_CType_String
1044 UPB_SIZE(3, 4), // kUpb_CType_Bytes
1045 };
1046
1047 // -1 here because the enum is one-based but the table is zero-based.
1048 return size[c_type - 1];
1049}
1050
1051// Return the log2 of the storage size in bytes for a upb_FieldType
1052UPB_INLINE int UPB_PRIVATE(_upb_FieldType_SizeLg2)(upb_FieldType field_type) {
1053 static const int8_t size[] = {
1054 3, // kUpb_FieldType_Double
1055 2, // kUpb_FieldType_Float
1056 3, // kUpb_FieldType_Int64
1057 3, // kUpb_FieldType_UInt64
1058 2, // kUpb_FieldType_Int32
1059 3, // kUpb_FieldType_Fixed64
1060 2, // kUpb_FieldType_Fixed32
1061 0, // kUpb_FieldType_Bool
1062 UPB_SIZE(3, 4), // kUpb_FieldType_String
1063 UPB_SIZE(2, 3), // kUpb_FieldType_Group
1064 UPB_SIZE(2, 3), // kUpb_FieldType_Message
1065 UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
1066 2, // kUpb_FieldType_UInt32
1067 2, // kUpb_FieldType_Enum
1068 2, // kUpb_FieldType_SFixed32
1069 3, // kUpb_FieldType_SFixed64
1070 2, // kUpb_FieldType_SInt32
1071 3, // kUpb_FieldType_SInt64
1072 };
1073
1074 // -1 here because the enum is one-based but the table is zero-based.
1075 return size[field_type - 1];
1076}
1077
1078#ifdef __cplusplus
1079} /* extern "C" */
1080#endif
1081
1082
1083#endif /* UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_ */
1084
1085// Must be last.
1086
1087// LINT.IfChange(struct_definition)
1088struct upb_MiniTableField {
1089 uint32_t UPB_ONLYBITS(number);
1090 uint16_t UPB_ONLYBITS(offset);
1091 int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index
1092
1093 // Indexes into `upb_MiniTable.subs`
1094 // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM
1095 uint16_t UPB_PRIVATE(submsg_index);
1096
1097 uint8_t UPB_PRIVATE(descriptortype);
1098
1099 // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift)
1100 uint8_t UPB_ONLYBITS(mode);
1101};
1102
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001103#define kUpb_NoSub ((uint16_t) - 1)
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001104
1105typedef enum {
1106 kUpb_FieldMode_Map = 0,
1107 kUpb_FieldMode_Array = 1,
1108 kUpb_FieldMode_Scalar = 2,
1109} upb_FieldMode;
1110
1111// Mask to isolate the upb_FieldMode from field.mode.
1112#define kUpb_FieldMode_Mask 3
1113
1114// Extra flags on the mode field.
1115typedef enum {
1116 kUpb_LabelFlags_IsPacked = 4,
1117 kUpb_LabelFlags_IsExtension = 8,
1118 // Indicates that this descriptor type is an "alternate type":
1119 // - for Int32, this indicates that the actual type is Enum (but was
1120 // rewritten to Int32 because it is an open enum that requires no check).
1121 // - for Bytes, this indicates that the actual type is String (but does
1122 // not require any UTF-8 check).
1123 kUpb_LabelFlags_IsAlternate = 16,
1124} upb_LabelFlags;
1125
1126// Note: we sort by this number when calculating layout order.
1127typedef enum {
1128 kUpb_FieldRep_1Byte = 0,
1129 kUpb_FieldRep_4Byte = 1,
1130 kUpb_FieldRep_StringView = 2,
1131 kUpb_FieldRep_8Byte = 3,
1132
1133 kUpb_FieldRep_NativePointer =
1134 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte),
1135 kUpb_FieldRep_Max = kUpb_FieldRep_8Byte,
1136} upb_FieldRep;
1137
1138#define kUpb_FieldRep_Shift 6
1139
1140#ifdef __cplusplus
1141extern "C" {
1142#endif
1143
1144UPB_INLINE upb_FieldMode
1145UPB_PRIVATE(_upb_MiniTableField_Mode)(const struct upb_MiniTableField* f) {
1146 return (upb_FieldMode)(f->UPB_ONLYBITS(mode) & kUpb_FieldMode_Mask);
1147}
1148
1149UPB_INLINE upb_FieldRep
1150UPB_PRIVATE(_upb_MiniTableField_GetRep)(const struct upb_MiniTableField* f) {
1151 return (upb_FieldRep)(f->UPB_ONLYBITS(mode) >> kUpb_FieldRep_Shift);
1152}
1153
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001154UPB_API_INLINE bool upb_MiniTableField_IsArray(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001155 const struct upb_MiniTableField* f) {
1156 return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Array;
1157}
1158
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001159UPB_API_INLINE bool upb_MiniTableField_IsMap(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001160 const struct upb_MiniTableField* f) {
1161 return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Map;
1162}
1163
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001164UPB_API_INLINE bool upb_MiniTableField_IsScalar(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001165 const struct upb_MiniTableField* f) {
1166 return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Scalar;
1167}
1168
1169UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsAlternate)(
1170 const struct upb_MiniTableField* f) {
1171 return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsAlternate) != 0;
1172}
1173
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001174UPB_API_INLINE bool upb_MiniTableField_IsExtension(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001175 const struct upb_MiniTableField* f) {
1176 return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsExtension) != 0;
1177}
1178
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001179UPB_API_INLINE bool upb_MiniTableField_IsPacked(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001180 const struct upb_MiniTableField* f) {
1181 return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsPacked) != 0;
1182}
1183
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001184UPB_API_INLINE upb_FieldType
1185upb_MiniTableField_Type(const struct upb_MiniTableField* f) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001186 const upb_FieldType type = (upb_FieldType)f->UPB_PRIVATE(descriptortype);
1187 if (UPB_PRIVATE(_upb_MiniTableField_IsAlternate)(f)) {
1188 if (type == kUpb_FieldType_Int32) return kUpb_FieldType_Enum;
1189 if (type == kUpb_FieldType_Bytes) return kUpb_FieldType_String;
1190 UPB_ASSERT(false);
1191 }
1192 return type;
1193}
1194
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001195UPB_API_INLINE
1196upb_CType upb_MiniTableField_CType(const struct upb_MiniTableField* f) {
1197 return upb_FieldType_CType(upb_MiniTableField_Type(f));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001198}
1199
1200UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(
1201 const struct upb_MiniTableField* f) {
1202 return f->presence > 0;
1203}
1204
1205UPB_INLINE char UPB_PRIVATE(_upb_MiniTableField_HasbitMask)(
1206 const struct upb_MiniTableField* f) {
1207 UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f));
1208 const size_t index = f->presence;
1209 return 1 << (index % 8);
1210}
1211
1212UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(
1213 const struct upb_MiniTableField* f) {
1214 UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f));
1215 const size_t index = f->presence;
1216 return index / 8;
1217}
1218
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001219UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001220 const struct upb_MiniTableField* f) {
1221 return f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum;
1222}
1223
Protobuf Team Bot89587682024-02-29 17:19:51 +00001224UPB_API_INLINE bool upb_MiniTableField_IsInOneof(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001225 const struct upb_MiniTableField* f) {
1226 return f->presence < 0;
1227}
1228
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001229UPB_API_INLINE bool upb_MiniTableField_IsSubMessage(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001230 const struct upb_MiniTableField* f) {
1231 return f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message ||
1232 f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group;
1233}
1234
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001235UPB_API_INLINE bool upb_MiniTableField_HasPresence(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001236 const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001237 if (upb_MiniTableField_IsExtension(f)) {
1238 return upb_MiniTableField_IsScalar(f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001239 } else {
1240 return f->presence != 0;
1241 }
1242}
1243
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001244UPB_API_INLINE uint32_t
1245upb_MiniTableField_Number(const struct upb_MiniTableField* f) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001246 return f->UPB_ONLYBITS(number);
1247}
1248
1249UPB_INLINE uint16_t
1250UPB_PRIVATE(_upb_MiniTableField_Offset)(const struct upb_MiniTableField* f) {
1251 return f->UPB_ONLYBITS(offset);
1252}
1253
1254UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_OneofOffset)(
1255 const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001256 UPB_ASSERT(upb_MiniTableField_IsInOneof(f));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001257 return ~(ptrdiff_t)f->presence;
1258}
1259
1260UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(
1261 const struct upb_MiniTableField* f) {
1262 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(f) ==
1263 kUpb_FieldRep_NativePointer);
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001264 UPB_ASSUME(upb_MiniTableField_IsArray(f));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001265 UPB_ASSUME(f->presence == 0);
1266}
1267
1268UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(
1269 const struct upb_MiniTableField* f) {
1270 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(f) ==
1271 kUpb_FieldRep_NativePointer);
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001272 UPB_ASSUME(upb_MiniTableField_IsMap(f));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001273 UPB_ASSUME(f->presence == 0);
1274}
1275
1276UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_ElemSizeLg2)(
1277 const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001278 const upb_FieldType field_type = upb_MiniTableField_Type(f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001279 return UPB_PRIVATE(_upb_FieldType_SizeLg2)(field_type);
1280}
1281
1282// LINT.ThenChange(//depot/google3/third_party/upb/bits/typescript/mini_table_field.ts)
1283
1284#ifdef __cplusplus
1285} /* extern "C" */
1286#endif
1287
1288
1289#endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */
1290
1291// Must be last.
1292
1293typedef struct upb_MiniTableField upb_MiniTableField;
1294
1295#ifdef __cplusplus
1296extern "C" {
1297#endif
1298
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001299UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001300
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001301UPB_API_INLINE bool upb_MiniTableField_HasPresence(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001302
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001303UPB_API_INLINE bool upb_MiniTableField_IsArray(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001304
1305UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001306 const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001307
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001308UPB_API_INLINE bool upb_MiniTableField_IsExtension(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001309
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001310UPB_API_INLINE bool upb_MiniTableField_IsInOneof(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001311
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001312UPB_API_INLINE bool upb_MiniTableField_IsMap(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001313
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001314UPB_API_INLINE bool upb_MiniTableField_IsPacked(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001315
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001316UPB_API_INLINE bool upb_MiniTableField_IsScalar(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001317
1318UPB_API_INLINE bool upb_MiniTableField_IsSubMessage(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001319 const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001320
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001321UPB_API_INLINE uint32_t upb_MiniTableField_Number(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001322
1323UPB_API_INLINE upb_FieldType
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001324upb_MiniTableField_Type(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001325
1326#ifdef __cplusplus
1327} /* extern "C" */
1328#endif
1329
1330
1331#endif /* UPB_MINI_TABLE_FIELD_H_ */
1332
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001333#ifndef UPB_MINI_TABLE_MESSAGE_H_
1334#define UPB_MINI_TABLE_MESSAGE_H_
1335
1336
1337#ifndef UPB_MINI_TABLE_ENUM_H_
1338#define UPB_MINI_TABLE_ENUM_H_
1339
1340#include <stdint.h>
1341
1342
1343#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
1344#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
1345
1346#include <stdint.h>
1347
1348// Must be last.
1349
1350struct upb_MiniTableEnum {
1351 uint32_t UPB_PRIVATE(mask_limit); // Highest that can be tested with mask.
1352 uint32_t UPB_PRIVATE(value_count); // Number of values after the bitfield.
1353 uint32_t UPB_PRIVATE(data)[]; // Bitmask + enumerated values follow.
1354};
1355
1356#ifdef __cplusplus
1357extern "C" {
1358#endif
1359
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001360UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001361 const struct upb_MiniTableEnum* e, uint32_t val) {
1362 if (UPB_LIKELY(val < 64)) {
1363 const uint64_t mask =
1364 e->UPB_PRIVATE(data)[0] | ((uint64_t)e->UPB_PRIVATE(data)[1] << 32);
1365 const uint64_t bit = 1ULL << val;
1366 return (mask & bit) != 0;
1367 }
1368 if (UPB_LIKELY(val < e->UPB_PRIVATE(mask_limit))) {
1369 const uint32_t mask = e->UPB_PRIVATE(data)[val / 32];
1370 const uint32_t bit = 1ULL << (val % 32);
1371 return (mask & bit) != 0;
1372 }
1373
1374 // OPT: binary search long lists?
1375 const uint32_t* start =
1376 &e->UPB_PRIVATE(data)[e->UPB_PRIVATE(mask_limit) / 32];
1377 const uint32_t* limit = &e->UPB_PRIVATE(
1378 data)[e->UPB_PRIVATE(mask_limit) / 32 + e->UPB_PRIVATE(value_count)];
1379 for (const uint32_t* p = start; p < limit; p++) {
1380 if (*p == val) return true;
1381 }
1382 return false;
1383}
1384
1385#ifdef __cplusplus
1386} /* extern "C" */
1387#endif
1388
1389
1390#endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */
1391
1392// Must be last
1393
1394typedef struct upb_MiniTableEnum upb_MiniTableEnum;
1395
1396#ifdef __cplusplus
1397extern "C" {
1398#endif
1399
1400// Validates enum value against range defined by enum mini table.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001401UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e,
1402 uint32_t val);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001403
1404#ifdef __cplusplus
1405} /* extern "C" */
1406#endif
1407
1408
1409#endif /* UPB_MINI_TABLE_ENUM_H_ */
1410
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001411#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1412#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1413
1414#include <stdint.h>
1415
1416
1417#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_
1418#define UPB_MINI_TABLE_INTERNAL_SUB_H_
1419
1420// Must be last.
1421
1422union upb_MiniTableSub {
1423 const struct upb_MiniTable* UPB_PRIVATE(submsg);
1424 const struct upb_MiniTableEnum* UPB_PRIVATE(subenum);
1425};
1426
1427#ifdef __cplusplus
1428extern "C" {
1429#endif
1430
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001431UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromEnum(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001432 const struct upb_MiniTableEnum* subenum) {
1433 union upb_MiniTableSub out;
1434 out.UPB_PRIVATE(subenum) = subenum;
1435 return out;
1436}
1437
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001438UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromMessage(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001439 const struct upb_MiniTable* submsg) {
1440 union upb_MiniTableSub out;
1441 out.UPB_PRIVATE(submsg) = submsg;
1442 return out;
1443}
1444
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001445UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableSub_Enum(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001446 const union upb_MiniTableSub sub) {
1447 return sub.UPB_PRIVATE(subenum);
1448}
1449
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001450UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableSub_Message(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001451 const union upb_MiniTableSub sub) {
1452 return sub.UPB_PRIVATE(submsg);
1453}
1454
1455#ifdef __cplusplus
1456} /* extern "C" */
1457#endif
1458
1459
1460#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
1461
1462// Must be last.
1463
1464struct upb_Decoder;
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00001465struct upb_Message;
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001466typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr,
1467 struct upb_Message* msg, intptr_t table,
1468 uint64_t hasbits, uint64_t data);
1469typedef struct {
1470 uint64_t field_data;
1471 _upb_FieldParser* field_parser;
1472} _upb_FastTable_Entry;
1473
1474typedef enum {
1475 kUpb_ExtMode_NonExtendable = 0, // Non-extendable message.
1476 kUpb_ExtMode_Extendable = 1, // Normal extendable message.
1477 kUpb_ExtMode_IsMessageSet = 2, // MessageSet message.
1478 kUpb_ExtMode_IsMessageSet_ITEM =
1479 3, // MessageSet item (temporary only, see decode.c)
1480
1481 // During table building we steal a bit to indicate that the message is a map
1482 // entry. *Only* used during table building!
1483 kUpb_ExtMode_IsMapEntry = 4,
1484} upb_ExtMode;
1485
1486// upb_MiniTable represents the memory layout of a given upb_MessageDef.
1487// The members are public so generated code can initialize them,
1488// but users MUST NOT directly read or write any of its members.
1489
1490// LINT.IfChange(minitable_struct_definition)
1491struct upb_MiniTable {
1492 const union upb_MiniTableSub* UPB_PRIVATE(subs);
1493 const struct upb_MiniTableField* UPB_ONLYBITS(fields);
1494
1495 // Must be aligned to sizeof(void*). Doesn't include internal members like
1496 // unknown fields, extension dict, pointer to msglayout, etc.
1497 uint16_t UPB_PRIVATE(size);
1498
1499 uint16_t UPB_ONLYBITS(field_count);
1500
1501 uint8_t UPB_PRIVATE(ext); // upb_ExtMode, uint8_t here so sizeof(ext) == 1
1502 uint8_t UPB_PRIVATE(dense_below);
1503 uint8_t UPB_PRIVATE(table_mask);
1504 uint8_t UPB_PRIVATE(required_count); // Required fields have the low hasbits.
Protobuf Team Botccfab6a2024-03-07 20:32:42 +00001505
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001506#ifdef UPB_TRACING_ENABLED
1507 const char* UPB_PRIVATE(full_name);
1508#endif
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001509
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001510#ifdef UPB_FASTTABLE_ENABLED
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001511 // To statically initialize the tables of variable length, we need a flexible
1512 // array member, and we need to compile in gnu99 mode (constant initialization
1513 // of flexible array members is a GNU extension, not in C99 unfortunately.
1514 _upb_FastTable_Entry UPB_PRIVATE(fasttable)[];
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001515#endif
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001516};
1517// LINT.ThenChange(//depot/google3/third_party/upb/bits/typescript/mini_table.ts)
1518
1519#ifdef __cplusplus
1520extern "C" {
1521#endif
1522
1523UPB_INLINE const struct upb_MiniTable* UPB_PRIVATE(_upb_MiniTable_Empty)(void) {
1524 extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty);
1525
1526 return &UPB_PRIVATE(_kUpb_MiniTable_Empty);
1527}
1528
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001529UPB_API_INLINE int upb_MiniTable_FieldCount(const struct upb_MiniTable* m) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001530 return m->UPB_ONLYBITS(field_count);
1531}
1532
1533UPB_INLINE bool UPB_PRIVATE(_upb_MiniTable_IsEmpty)(
1534 const struct upb_MiniTable* m) {
1535 extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty);
1536
1537 return m == &UPB_PRIVATE(_kUpb_MiniTable_Empty);
1538}
1539
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001540UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
1541 const struct upb_MiniTable* m, uint32_t i) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001542 return &m->UPB_ONLYBITS(fields)[i];
1543}
1544
1545UPB_INLINE const union upb_MiniTableSub* UPB_PRIVATE(
1546 _upb_MiniTable_GetSubByIndex)(const struct upb_MiniTable* m, uint32_t i) {
1547 return &m->UPB_PRIVATE(subs)[i];
1548}
1549
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001550UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_GetSubMessageTable(
1551 const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
1552 UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Message);
1553 const struct upb_MiniTable* ret = upb_MiniTableSub_Message(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001554 m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1555 UPB_ASSUME(ret);
1556 return UPB_PRIVATE(_upb_MiniTable_IsEmpty)(ret) ? NULL : ret;
1557}
1558
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001559UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_SubMessage(
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001560 const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001561 if (upb_MiniTableField_CType(f) != kUpb_CType_Message) {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001562 return NULL;
1563 }
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001564 return upb_MiniTableSub_Message(
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001565 m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1566}
1567
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001568UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001569 const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001570 UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Enum);
1571 return upb_MiniTableSub_Enum(
1572 m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1573}
1574
1575UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapKey(
1576 const struct upb_MiniTable* m) {
1577 UPB_ASSERT(upb_MiniTable_FieldCount(m) == 2);
1578 const struct upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, 0);
1579 UPB_ASSERT(upb_MiniTableField_Number(f) == 1);
1580 return f;
1581}
1582
1583UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapValue(
1584 const struct upb_MiniTable* m) {
1585 UPB_ASSERT(upb_MiniTable_FieldCount(m) == 2);
1586 const struct upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, 1);
1587 UPB_ASSERT(upb_MiniTableField_Number(f) == 2);
1588 return f;
1589}
1590
1591UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
1592 const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
1593 return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001594}
1595
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00001596// Computes a bitmask in which the |m->required_count| lowest bits are set.
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001597//
1598// Sample output:
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00001599// RequiredMask(1) => 0b1 (0x1)
1600// RequiredMask(5) => 0b11111 (0x1f)
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001601UPB_INLINE uint64_t
1602UPB_PRIVATE(_upb_MiniTable_RequiredMask)(const struct upb_MiniTable* m) {
1603 int n = m->UPB_PRIVATE(required_count);
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00001604 UPB_ASSERT(0 < n && n <= 64);
1605 return (1ULL << n) - 1;
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001606}
1607
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001608#ifdef UPB_TRACING_ENABLED
1609UPB_INLINE const char* upb_MiniTable_FullName(
1610 const struct upb_MiniTable* mini_table) {
1611 return mini_table->UPB_PRIVATE(full_name);
1612}
Protobuf Team Botccfab6a2024-03-07 20:32:42 +00001613// Initializes tracing proto name from language runtimes that construct
1614// mini tables dynamically at runtime. The runtime is responsible for passing
1615// controlling lifetime of name such as storing in same arena as mini_table.
Protobuf Team Bot3ee01202024-03-07 23:27:46 +00001616UPB_INLINE void upb_MiniTable_SetFullName(struct upb_MiniTable* mini_table,
1617 const char* full_name) {
Protobuf Team Botccfab6a2024-03-07 20:32:42 +00001618 mini_table->UPB_PRIVATE(full_name) = full_name;
1619}
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001620#endif
1621
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001622#ifdef __cplusplus
1623} /* extern "C" */
1624#endif
1625
1626
1627#endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */
1628
1629// Must be last.
1630
1631typedef struct upb_MiniTable upb_MiniTable;
1632
1633#ifdef __cplusplus
1634extern "C" {
1635#endif
1636
1637UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
1638 const upb_MiniTable* m, uint32_t number);
1639
1640UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001641 const upb_MiniTable* m, uint32_t index);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001642
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001643UPB_API_INLINE int upb_MiniTable_FieldCount(const upb_MiniTable* m);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001644
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001645// DEPRECATED: use upb_MiniTable_SubMessage() instead
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001646// Returns the MiniTable for a message field, NULL if the field is unlinked.
1647UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001648 const upb_MiniTable* m, const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001649
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001650// Returns the MiniTable for a message field if it is a submessage.
1651UPB_API_INLINE const upb_MiniTable* upb_MiniTable_SubMessage(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001652 const upb_MiniTable* m, const upb_MiniTableField* f);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001653
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001654// Returns the MiniTableEnum for a message field, NULL if the field is unlinked.
1655UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001656 const upb_MiniTable* m, const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001657
1658// Returns the MiniTableField for the key of a map.
1659UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_MapKey(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001660 const upb_MiniTable* m);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001661
1662// Returns the MiniTableField for the value of a map.
1663UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_MapValue(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001664 const upb_MiniTable* m);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001665
1666// Returns true if this MiniTable field is linked to a MiniTable for the
1667// sub-message.
1668UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001669 const upb_MiniTable* m, const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001670
1671// If this field is in a oneof, returns the first field in the oneof.
1672//
1673// Otherwise returns NULL.
1674//
1675// Usage:
1676// const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f);
1677// do {
1678// ..
1679// } while (upb_MiniTable_NextOneofField(m, &field);
1680//
1681const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m,
1682 const upb_MiniTableField* f);
1683
1684// Iterates to the next field in the oneof. If this is the last field in the
1685// oneof, returns false. The ordering of fields in the oneof is not
1686// guaranteed.
1687// REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated
1688// by prior upb_MiniTable_NextOneofField calls.
1689bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
1690 const upb_MiniTableField** f);
1691
1692#ifdef __cplusplus
1693} /* extern "C" */
1694#endif
1695
1696
1697#endif /* UPB_MINI_TABLE_MESSAGE_H_ */
1698
1699// Must be last.
1700
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001701typedef struct upb_Array upb_Array;
1702
1703#ifdef __cplusplus
1704extern "C" {
1705#endif
1706
1707// Creates a new array on the given arena that holds elements of this type.
1708UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type);
1709
1710// Returns the number of elements in the array.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001711UPB_API_INLINE size_t upb_Array_Size(const upb_Array* arr);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001712
1713// Returns the given element, which must be within the array's current size.
1714UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i);
1715
1716// Returns a mutating pointer to the given element, which must be within the
1717// array's current size.
1718UPB_API upb_MutableMessageValue upb_Array_GetMutable(upb_Array* arr, size_t i);
1719
1720// Sets the given element, which must be within the array's current size.
1721UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);
1722
1723// Appends an element to the array. Returns false on allocation failure.
1724UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val,
1725 upb_Arena* arena);
1726
1727// Moves elements within the array using memmove().
1728// Like memmove(), the source and destination elements may be overlapping.
1729UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx,
1730 size_t count);
1731
1732// Inserts one or more empty elements into the array.
1733// Existing elements are shifted right.
1734// The new elements have undefined state and must be set with `upb_Array_Set()`.
1735// REQUIRES: `i <= upb_Array_Size(arr)`
1736UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count,
1737 upb_Arena* arena);
1738
1739// Deletes one or more elements from the array.
1740// Existing elements are shifted left.
1741// REQUIRES: `i + count <= upb_Array_Size(arr)`
1742UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count);
1743
Protobuf Team Bot4b6de0f2024-03-29 19:09:40 +00001744// Reserves |size| elements of storage for the array.
1745UPB_API_INLINE bool upb_Array_Reserve(struct upb_Array* array, size_t size,
1746 upb_Arena* arena);
1747
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001748// Changes the size of a vector. New elements are initialized to NULL/0.
1749// Returns false on allocation failure.
1750UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena);
1751
1752// Returns pointer to array data.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001753UPB_API_INLINE const void* upb_Array_DataPtr(const upb_Array* arr);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001754
1755// Returns mutable pointer to array data.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001756UPB_API_INLINE void* upb_Array_MutableDataPtr(upb_Array* arr);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001757
1758// Mark an array and all of its descendents as frozen/immutable.
1759// If the array elements are messages then |m| must point to the minitable for
1760// those messages. Otherwise |m| must be NULL.
1761UPB_API void upb_Array_Freeze(upb_Array* arr, const upb_MiniTable* m);
1762
1763// Returns whether an array has been frozen.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001764UPB_API_INLINE bool upb_Array_IsFrozen(const upb_Array* arr);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001765
1766#ifdef __cplusplus
1767} /* extern "C" */
1768#endif
1769
1770
1771#endif /* UPB_MESSAGE_ARRAY_H_ */
1772
1773#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
1774#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
1775
1776#include <stddef.h>
1777#include <stdint.h>
1778#include <string.h>
1779
1780
1781#ifndef UPB_BASE_INTERNAL_ENDIAN_H_
1782#define UPB_BASE_INTERNAL_ENDIAN_H_
1783
1784#include <stdint.h>
1785
1786// Must be last.
1787
1788#ifdef __cplusplus
1789extern "C" {
1790#endif
1791
1792UPB_INLINE bool upb_IsLittleEndian(void) {
1793 const int x = 1;
1794 return *(char*)&x == 1;
1795}
1796
1797UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) {
1798 if (upb_IsLittleEndian()) return val;
1799
1800 return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
1801 ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
1802}
1803
1804UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) {
1805 if (upb_IsLittleEndian()) return val;
1806
1807 const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32;
1808 const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32));
1809 return hi | lo;
1810}
1811
1812#ifdef __cplusplus
1813} /* extern "C" */
1814#endif
1815
1816
1817#endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */
1818
1819#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
1820#define UPB_MESSAGE_INTERNAL_EXTENSION_H_
1821
Protobuf Team Bot4df6e042024-01-30 19:27:52 +00001822#include <stddef.h>
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001823
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001824
1825#ifndef UPB_MINI_TABLE_EXTENSION_H_
1826#define UPB_MINI_TABLE_EXTENSION_H_
1827
1828#include <stdint.h>
1829
1830
1831#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
1832#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
1833
1834#include <stdint.h>
1835
1836
1837// Must be last.
1838
1839struct upb_MiniTableExtension {
1840 // Do not move this field. We need to be able to alias pointers.
1841 struct upb_MiniTableField UPB_PRIVATE(field);
1842
1843 const struct upb_MiniTable* UPB_PRIVATE(extendee);
1844 union upb_MiniTableSub UPB_PRIVATE(sub); // NULL unless submsg or proto2 enum
1845};
1846
1847#ifdef __cplusplus
1848extern "C" {
1849#endif
1850
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001851UPB_API_INLINE upb_CType
1852upb_MiniTableExtension_CType(const struct upb_MiniTableExtension* e) {
1853 return upb_MiniTableField_CType(&e->UPB_PRIVATE(field));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001854}
1855
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001856UPB_API_INLINE uint32_t
1857upb_MiniTableExtension_Number(const struct upb_MiniTableExtension* e) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001858 return e->UPB_PRIVATE(field).UPB_ONLYBITS(number);
1859}
1860
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001861UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableExtension_GetSubMessage(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001862 const struct upb_MiniTableExtension* e) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001863 return upb_MiniTableSub_Message(e->UPB_PRIVATE(sub));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001864}
1865
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001866UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001867 struct upb_MiniTableExtension* e, const struct upb_MiniTable* m) {
1868 e->UPB_PRIVATE(sub).UPB_PRIVATE(submsg) = m;
1869}
1870
1871#ifdef __cplusplus
1872} /* extern "C" */
1873#endif
1874
1875
1876#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */
1877
1878// Must be last.
1879
1880typedef struct upb_MiniTableExtension upb_MiniTableExtension;
1881
1882#ifdef __cplusplus
1883extern "C" {
1884#endif
1885
Protobuf Team Botfe6a6012024-01-18 00:05:28 +00001886UPB_API_INLINE upb_CType
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001887upb_MiniTableExtension_CType(const upb_MiniTableExtension* e);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001888
1889UPB_API_INLINE uint32_t
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001890upb_MiniTableExtension_Number(const upb_MiniTableExtension* e);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001891
1892UPB_API_INLINE const upb_MiniTable* upb_MiniTableExtension_GetSubMessage(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001893 const upb_MiniTableExtension* e);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001894
1895UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001896 upb_MiniTableExtension* e, const upb_MiniTable* m);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001897
1898#ifdef __cplusplus
1899} /* extern "C" */
1900#endif
1901
1902
1903#endif /* UPB_MINI_TABLE_EXTENSION_H_ */
1904
1905// Must be last.
1906
1907// The internal representation of an extension is self-describing: it contains
1908// enough information that we can serialize it to binary format without needing
1909// to look it up in a upb_ExtensionRegistry.
1910//
1911// This representation allocates 16 bytes to data on 64-bit platforms.
1912// This is rather wasteful for scalars (in the extreme case of bool,
1913// it wastes 15 bytes). We accept this because we expect messages to be
1914// the most common extension type.
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001915typedef struct {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001916 const upb_MiniTableExtension* ext;
Protobuf Team Bot4df6e042024-01-30 19:27:52 +00001917 upb_MessageValue data;
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001918} upb_Extension;
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001919
1920#ifdef __cplusplus
1921extern "C" {
1922#endif
1923
1924// Adds the given extension data to the given message.
1925// |ext| is copied into the message instance.
1926// This logically replaces any previously-added extension with this number.
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001927upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001928 struct upb_Message* msg, const upb_MiniTableExtension* ext,
1929 upb_Arena* arena);
1930
1931// Returns an array of extensions for this message.
1932// Note: the array is ordered in reverse relative to the order of creation.
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001933const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001934 const struct upb_Message* msg, size_t* count);
1935
1936// Returns an extension for a message with a given mini table,
1937// or NULL if no extension exists with this mini table.
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001938const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001939 const struct upb_Message* msg, const upb_MiniTableExtension* ext);
1940
1941#ifdef __cplusplus
1942} /* extern "C" */
1943#endif
1944
1945
1946#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */
Protobuf Team Bot499c7482023-12-30 01:42:17 +00001947
1948#ifndef UPB_MESSAGE_INTERNAL_MAP_H_
1949#define UPB_MESSAGE_INTERNAL_MAP_H_
1950
1951#include <stddef.h>
1952#include <string.h>
1953
1954
1955#ifndef UPB_HASH_STR_TABLE_H_
1956#define UPB_HASH_STR_TABLE_H_
1957
1958
1959/*
1960 * upb_table
1961 *
1962 * This header is INTERNAL-ONLY! Its interfaces are not public or stable!
1963 * This file defines very fast int->upb_value (inttable) and string->upb_value
1964 * (strtable) hash tables.
1965 *
1966 * The table uses chained scatter with Brent's variation (inspired by the Lua
1967 * implementation of hash tables). The hash function for strings is Austin
1968 * Appleby's "MurmurHash."
1969 *
1970 * The inttable uses uintptr_t as its key, which guarantees it can be used to
1971 * store pointers or integers of at least 32 bits (upb isn't really useful on
1972 * systems where sizeof(void*) < 4).
1973 *
1974 * The table must be homogeneous (all values of the same type). In debug
1975 * mode, we check this on insert and lookup.
1976 */
1977
1978#ifndef UPB_HASH_COMMON_H_
1979#define UPB_HASH_COMMON_H_
1980
1981#include <string.h>
1982
1983
1984// Must be last.
1985
1986#ifdef __cplusplus
1987extern "C" {
1988#endif
1989
1990/* upb_value ******************************************************************/
1991
1992typedef struct {
1993 uint64_t val;
1994} upb_value;
1995
1996UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; }
1997
1998/* For each value ctype, define the following set of functions:
1999 *
2000 * // Get/set an int32 from a upb_value.
2001 * int32_t upb_value_getint32(upb_value val);
2002 * void upb_value_setint32(upb_value *val, int32_t cval);
2003 *
2004 * // Construct a new upb_value from an int32.
2005 * upb_value upb_value_int32(int32_t val); */
2006#define FUNCS(name, membername, type_t, converter) \
2007 UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \
2008 val->val = (converter)cval; \
2009 } \
2010 UPB_INLINE upb_value upb_value_##name(type_t val) { \
2011 upb_value ret; \
2012 upb_value_set##name(&ret, val); \
2013 return ret; \
2014 } \
2015 UPB_INLINE type_t upb_value_get##name(upb_value val) { \
2016 return (type_t)(converter)val.val; \
2017 }
2018
2019FUNCS(int32, int32, int32_t, int32_t)
2020FUNCS(int64, int64, int64_t, int64_t)
2021FUNCS(uint32, uint32, uint32_t, uint32_t)
2022FUNCS(uint64, uint64, uint64_t, uint64_t)
2023FUNCS(bool, _bool, bool, bool)
2024FUNCS(cstr, cstr, char*, uintptr_t)
2025FUNCS(uintptr, uptr, uintptr_t, uintptr_t)
2026FUNCS(ptr, ptr, void*, uintptr_t)
2027FUNCS(constptr, constptr, const void*, uintptr_t)
2028
2029#undef FUNCS
2030
2031UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) {
2032 memcpy(&val->val, &cval, sizeof(cval));
2033}
2034
2035UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) {
2036 memcpy(&val->val, &cval, sizeof(cval));
2037}
2038
2039UPB_INLINE upb_value upb_value_float(float cval) {
2040 upb_value ret;
2041 upb_value_setfloat(&ret, cval);
2042 return ret;
2043}
2044
2045UPB_INLINE upb_value upb_value_double(double cval) {
2046 upb_value ret;
2047 upb_value_setdouble(&ret, cval);
2048 return ret;
2049}
2050
2051/* upb_tabkey *****************************************************************/
2052
2053/* Either:
2054 * 1. an actual integer key, or
2055 * 2. a pointer to a string prefixed by its uint32_t length, owned by us.
2056 *
2057 * ...depending on whether this is a string table or an int table. We would
2058 * make this a union of those two types, but C89 doesn't support statically
2059 * initializing a non-first union member. */
2060typedef uintptr_t upb_tabkey;
2061
2062UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) {
2063 char* mem = (char*)key;
2064 if (len) memcpy(len, mem, sizeof(*len));
2065 return mem + sizeof(*len);
2066}
2067
2068UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) {
2069 upb_StringView ret;
2070 uint32_t len;
2071 ret.data = upb_tabstr(key, &len);
2072 ret.size = len;
2073 return ret;
2074}
2075
2076/* upb_tabval *****************************************************************/
2077
2078typedef struct upb_tabval {
2079 uint64_t val;
2080} upb_tabval;
2081
2082#define UPB_TABVALUE_EMPTY_INIT \
2083 { -1 }
2084
2085/* upb_table ******************************************************************/
2086
2087typedef struct _upb_tabent {
2088 upb_tabkey key;
2089 upb_tabval val;
2090
2091 /* Internal chaining. This is const so we can create static initializers for
2092 * tables. We cast away const sometimes, but *only* when the containing
2093 * upb_table is known to be non-const. This requires a bit of care, but
2094 * the subtlety is confined to table.c. */
2095 const struct _upb_tabent* next;
2096} upb_tabent;
2097
2098typedef struct {
2099 size_t count; /* Number of entries in the hash part. */
2100 uint32_t mask; /* Mask to turn hash value -> bucket. */
2101 uint32_t max_count; /* Max count before we hit our load limit. */
2102 uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
2103 upb_tabent* entries;
2104} upb_table;
2105
2106UPB_INLINE size_t upb_table_size(const upb_table* t) {
2107 return t->size_lg2 ? 1 << t->size_lg2 : 0;
2108}
2109
2110// Internal-only functions, in .h file only out of necessity.
2111
2112UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; }
2113
2114uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed);
2115
2116#ifdef __cplusplus
2117} /* extern "C" */
2118#endif
2119
2120
2121#endif /* UPB_HASH_COMMON_H_ */
2122
2123// Must be last.
2124
2125typedef struct {
2126 upb_table t;
2127} upb_strtable;
2128
2129#ifdef __cplusplus
2130extern "C" {
2131#endif
2132
2133// Initialize a table. If memory allocation failed, false is returned and
2134// the table is uninitialized.
2135bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a);
2136
2137// Returns the number of values in the table.
2138UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) {
2139 return t->t.count;
2140}
2141
2142void upb_strtable_clear(upb_strtable* t);
2143
2144// Inserts the given key into the hashtable with the given value.
2145// The key must not already exist in the hash table. The key is not required
2146// to be NULL-terminated, and the table will make an internal copy of the key.
2147//
2148// If a table resize was required but memory allocation failed, false is
2149// returned and the table is unchanged. */
2150bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len,
2151 upb_value val, upb_Arena* a);
2152
2153// Looks up key in this table, returning "true" if the key was found.
2154// If v is non-NULL, copies the value for this key into *v.
2155bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len,
2156 upb_value* v);
2157
2158// For NULL-terminated strings.
2159UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key,
2160 upb_value* v) {
2161 return upb_strtable_lookup2(t, key, strlen(key), v);
2162}
2163
2164// Removes an item from the table. Returns true if the remove was successful,
2165// and stores the removed item in *val if non-NULL.
2166bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len,
2167 upb_value* val);
2168
2169UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key,
2170 upb_value* v) {
2171 return upb_strtable_remove2(t, key, strlen(key), v);
2172}
2173
2174// Exposed for testing only.
2175bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a);
2176
2177/* Iteration over strtable:
2178 *
2179 * intptr_t iter = UPB_STRTABLE_BEGIN;
2180 * upb_StringView key;
2181 * upb_value val;
2182 * while (upb_strtable_next2(t, &key, &val, &iter)) {
2183 * // ...
2184 * }
2185 */
2186
2187#define UPB_STRTABLE_BEGIN -1
2188
2189bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key,
2190 upb_value* val, intptr_t* iter);
2191void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter);
2192void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v);
2193
2194/* DEPRECATED iterators, slated for removal.
2195 *
2196 * Iterators for string tables. We are subject to some kind of unusual
2197 * design constraints:
2198 *
2199 * For high-level languages:
2200 * - we must be able to guarantee that we don't crash or corrupt memory even if
2201 * the program accesses an invalidated iterator.
2202 *
2203 * For C++11 range-based for:
2204 * - iterators must be copyable
2205 * - iterators must be comparable
2206 * - it must be possible to construct an "end" value.
2207 *
2208 * Iteration order is undefined.
2209 *
2210 * Modifying the table invalidates iterators. upb_{str,int}table_done() is
2211 * guaranteed to work even on an invalidated iterator, as long as the table it
2212 * is iterating over has not been freed. Calling next() or accessing data from
2213 * an invalidated iterator yields unspecified elements from the table, but it is
2214 * guaranteed not to crash and to return real table elements (except when done()
2215 * is true). */
2216/* upb_strtable_iter **********************************************************/
2217
2218/* upb_strtable_iter i;
2219 * upb_strtable_begin(&i, t);
2220 * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
2221 * const char *key = upb_strtable_iter_key(&i);
2222 * const upb_value val = upb_strtable_iter_value(&i);
2223 * // ...
2224 * }
2225 */
2226
2227typedef struct {
2228 const upb_strtable* t;
2229 size_t index;
2230} upb_strtable_iter;
2231
2232UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) {
2233 return &i->t->t.entries[i->index];
2234}
2235
2236void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t);
2237void upb_strtable_next(upb_strtable_iter* i);
2238bool upb_strtable_done(const upb_strtable_iter* i);
2239upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i);
2240upb_value upb_strtable_iter_value(const upb_strtable_iter* i);
2241void upb_strtable_iter_setdone(upb_strtable_iter* i);
2242bool upb_strtable_iter_isequal(const upb_strtable_iter* i1,
2243 const upb_strtable_iter* i2);
2244
2245#ifdef __cplusplus
2246} /* extern "C" */
2247#endif
2248
2249
2250#endif /* UPB_HASH_STR_TABLE_H_ */
2251
2252// Must be last.
2253
2254typedef enum {
2255 kUpb_MapInsertStatus_Inserted = 0,
2256 kUpb_MapInsertStatus_Replaced = 1,
2257 kUpb_MapInsertStatus_OutOfMemory = 2,
2258} upb_MapInsertStatus;
2259
2260// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
2261
2262struct upb_Map {
2263 // Size of key and val, based on the map type.
2264 // Strings are represented as '0' because they must be handled specially.
2265 char key_size;
2266 char val_size;
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002267 bool UPB_PRIVATE(is_frozen);
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002268
2269 upb_strtable table;
2270};
2271
2272#ifdef __cplusplus
2273extern "C" {
2274#endif
2275
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002276UPB_INLINE void UPB_PRIVATE(_upb_Map_ShallowFreeze)(struct upb_Map* map) {
2277 map->UPB_PRIVATE(is_frozen) = true;
2278}
2279
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002280UPB_API_INLINE bool upb_Map_IsFrozen(const struct upb_Map* map) {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002281 return map->UPB_PRIVATE(is_frozen);
2282}
2283
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002284// Converting between internal table representation and user values.
2285//
2286// _upb_map_tokey() and _upb_map_fromkey() are inverses.
2287// _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
2288//
2289// These functions account for the fact that strings are treated differently
2290// from other types when stored in a map.
2291
2292UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) {
2293 if (size == UPB_MAPTYPE_STRING) {
2294 return *(upb_StringView*)key;
2295 } else {
2296 return upb_StringView_FromDataAndSize((const char*)key, size);
2297 }
2298}
2299
2300UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) {
2301 if (size == UPB_MAPTYPE_STRING) {
2302 memcpy(out, &key, sizeof(key));
2303 } else {
2304 memcpy(out, key.data, size);
2305 }
2306}
2307
2308UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size,
2309 upb_value* msgval, upb_Arena* a) {
2310 if (size == UPB_MAPTYPE_STRING) {
2311 upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp));
2312 if (!strp) return false;
2313 *strp = *(upb_StringView*)val;
2314 *msgval = upb_value_ptr(strp);
2315 } else {
2316 memcpy(msgval, val, size);
2317 }
2318 return true;
2319}
2320
2321UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
2322 if (size == UPB_MAPTYPE_STRING) {
2323 const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val);
2324 memcpy(out, strp, sizeof(upb_StringView));
2325 } else {
2326 memcpy(out, &val, size);
2327 }
2328}
2329
2330UPB_INLINE void* _upb_map_next(const struct upb_Map* map, size_t* iter) {
2331 upb_strtable_iter it;
2332 it.t = &map->table;
2333 it.index = *iter;
2334 upb_strtable_next(&it);
2335 *iter = it.index;
2336 if (upb_strtable_done(&it)) return NULL;
2337 return (void*)str_tabent(&it);
2338}
2339
2340UPB_INLINE void _upb_Map_Clear(struct upb_Map* map) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002341 UPB_ASSERT(!upb_Map_IsFrozen(map));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002342
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002343 upb_strtable_clear(&map->table);
2344}
2345
2346UPB_INLINE bool _upb_Map_Delete(struct upb_Map* map, const void* key,
2347 size_t key_size, upb_value* val) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002348 UPB_ASSERT(!upb_Map_IsFrozen(map));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002349
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002350 upb_StringView k = _upb_map_tokey(key, key_size);
2351 return upb_strtable_remove2(&map->table, k.data, k.size, val);
2352}
2353
2354UPB_INLINE bool _upb_Map_Get(const struct upb_Map* map, const void* key,
2355 size_t key_size, void* val, size_t val_size) {
2356 upb_value tabval;
2357 upb_StringView k = _upb_map_tokey(key, key_size);
2358 bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
2359 if (ret && val) {
2360 _upb_map_fromvalue(tabval, val, val_size);
2361 }
2362 return ret;
2363}
2364
2365UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(struct upb_Map* map,
2366 const void* key, size_t key_size,
2367 void* val, size_t val_size,
2368 upb_Arena* a) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002369 UPB_ASSERT(!upb_Map_IsFrozen(map));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002370
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002371 upb_StringView strkey = _upb_map_tokey(key, key_size);
2372 upb_value tabval = {0};
2373 if (!_upb_map_tovalue(val, val_size, &tabval, a)) {
2374 return kUpb_MapInsertStatus_OutOfMemory;
2375 }
2376
2377 // TODO: add overwrite operation to minimize number of lookups.
2378 bool removed =
2379 upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL);
2380 if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) {
2381 return kUpb_MapInsertStatus_OutOfMemory;
2382 }
2383 return removed ? kUpb_MapInsertStatus_Replaced
2384 : kUpb_MapInsertStatus_Inserted;
2385}
2386
2387UPB_INLINE size_t _upb_Map_Size(const struct upb_Map* map) {
2388 return map->table.t.count;
2389}
2390
2391// Strings/bytes are special-cased in maps.
2392extern char _upb_Map_CTypeSizeTable[12];
2393
2394UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) {
2395 return _upb_Map_CTypeSizeTable[ctype];
2396}
2397
2398// Creates a new map on the given arena with this key/value type.
2399struct upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
2400
2401#ifdef __cplusplus
2402} /* extern "C" */
2403#endif
2404
2405
2406#endif /* UPB_MESSAGE_INTERNAL_MAP_H_ */
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00002407
Protobuf Team Bot4df6e042024-01-30 19:27:52 +00002408/*
2409** Our memory representation for parsing tables and messages themselves.
2410** Functions in this file are used by generated code and possibly reflection.
2411**
2412** The definitions in this file are internal to upb.
2413**/
2414
2415#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_
2416#define UPB_MESSAGE_INTERNAL_MESSAGE_H_
2417
2418#include <stdlib.h>
2419#include <string.h>
2420
2421
2422// Must be last.
2423
2424#ifdef __cplusplus
2425extern "C" {
2426#endif
2427
2428extern const float kUpb_FltInfinity;
2429extern const double kUpb_Infinity;
2430extern const double kUpb_NaN;
2431
2432// Internal members of a upb_Message that track unknown fields and/or
2433// extensions. We can change this without breaking binary compatibility.
2434
2435typedef struct upb_Message_Internal {
2436 // Total size of this structure, including the data that follows.
2437 // Must be aligned to 8, which is alignof(upb_Extension)
2438 uint32_t size;
2439
2440 /* Offsets relative to the beginning of this structure.
2441 *
2442 * Unknown data grows forward from the beginning to unknown_end.
2443 * Extension data grows backward from size to ext_begin.
2444 * When the two meet, we're out of data and have to realloc.
2445 *
2446 * If we imagine that the final member of this struct is:
2447 * char data[size - overhead]; // overhead = sizeof(upb_Message_Internal)
2448 *
2449 * Then we have:
2450 * unknown data: data[0 .. (unknown_end - overhead)]
2451 * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
2452 uint32_t unknown_end;
2453 uint32_t ext_begin;
2454 // Data follows, as if there were an array:
2455 // char data[size - sizeof(upb_Message_Internal)];
2456} upb_Message_Internal;
2457
Protobuf Team Botccfab6a2024-03-07 20:32:42 +00002458#ifdef UPB_TRACING_ENABLED
Protobuf Team Botfb08bca2024-03-14 15:21:13 +00002459void UPB_PRIVATE(upb_Message_SetNewMessageTraceHandler)(
Protobuf Team Botccfab6a2024-03-07 20:32:42 +00002460 void (*newMessageTraceHandler)(const upb_MiniTable*, const upb_Arena*));
Protobuf Team Botfb08bca2024-03-14 15:21:13 +00002461void UPB_PRIVATE(upb_Message_LogNewMessage)(const upb_MiniTable* mini_table,
2462 const upb_Arena* arena);
Protobuf Team Botccfab6a2024-03-07 20:32:42 +00002463#endif
2464
Protobuf Team Bot4df6e042024-01-30 19:27:52 +00002465// Inline version upb_Message_New(), for internal use.
2466UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
2467 upb_Arena* a) {
Protobuf Team Botccfab6a2024-03-07 20:32:42 +00002468#ifdef UPB_TRACING_ENABLED
Protobuf Team Botfb08bca2024-03-14 15:21:13 +00002469 UPB_PRIVATE(upb_Message_LogNewMessage)(m, a);
Protobuf Team Botccfab6a2024-03-07 20:32:42 +00002470#endif
Protobuf Team Bot4df6e042024-01-30 19:27:52 +00002471 const int size = m->UPB_PRIVATE(size);
2472 struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
2473 if (UPB_UNLIKELY(!msg)) return NULL;
2474 memset(msg, 0, size);
2475 return msg;
2476}
2477
2478// Discards the unknown fields for this message only.
2479void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg);
2480
2481// Adds unknown data (serialized protobuf data) to the given message.
2482// The data is copied into the message instance.
2483bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg,
2484 const char* data, size_t len,
2485 upb_Arena* arena);
2486
2487bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
2488 upb_Arena* arena);
2489
2490#ifdef __cplusplus
2491} /* extern "C" */
2492#endif
2493
2494
2495#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */
2496
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002497#ifndef UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_
2498#define UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_
2499
2500#include <stdint.h>
2501
2502
2503// Must be last.
2504
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002505#ifdef __cplusplus
2506extern "C" {
2507#endif
2508
2509// Internal-only because empty messages cannot be created by the user.
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00002510UPB_INLINE uintptr_t
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002511UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(struct upb_Message* ptr, bool empty) {
2512 UPB_ASSERT(((uintptr_t)ptr & 1) == 0);
2513 return (uintptr_t)ptr | (empty ? 1 : 0);
2514}
2515
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002516UPB_API_INLINE bool upb_TaggedMessagePtr_IsEmpty(uintptr_t ptr) {
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002517 return ptr & 1;
2518}
2519
2520UPB_INLINE struct upb_Message* UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00002521 uintptr_t ptr) {
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002522 return (struct upb_Message*)(ptr & ~(uintptr_t)1);
2523}
2524
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002525UPB_API_INLINE struct upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
2526 uintptr_t ptr) {
2527 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr));
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002528 return UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(ptr);
2529}
2530
2531UPB_INLINE struct upb_Message* UPB_PRIVATE(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00002532 _upb_TaggedMessagePtr_GetEmptyMessage)(uintptr_t ptr) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002533 UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr));
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002534 return UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(ptr);
2535}
2536
2537#ifdef __cplusplus
2538} /* extern "C" */
2539#endif
2540
2541
2542#endif /* UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_ */
2543
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00002544#ifndef UPB_MESSAGE_INTERNAL_TYPES_H_
2545#define UPB_MESSAGE_INTERNAL_TYPES_H_
2546
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002547#include <stdint.h>
2548
2549// Must be last.
2550
2551#define UPB_OPAQUE(x) x##_opaque
2552
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00002553struct upb_Message {
2554 union {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002555 uintptr_t UPB_OPAQUE(internal); // tagged pointer, low bit == frozen
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00002556 double d; // Forces same size for 32-bit/64-bit builds
2557 };
2558};
2559
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002560#ifdef __cplusplus
2561extern "C" {
2562#endif
2563
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002564UPB_INLINE void UPB_PRIVATE(_upb_Message_ShallowFreeze)(
2565 struct upb_Message* msg) {
2566 msg->UPB_OPAQUE(internal) |= 1ULL;
2567}
2568
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002569UPB_API_INLINE bool upb_Message_IsFrozen(const struct upb_Message* msg) {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002570 return (msg->UPB_OPAQUE(internal) & 1ULL) != 0;
2571}
2572
2573UPB_INLINE struct upb_Message_Internal* UPB_PRIVATE(_upb_Message_GetInternal)(
2574 const struct upb_Message* msg) {
2575 const uintptr_t tmp = msg->UPB_OPAQUE(internal) & ~1ULL;
2576 return (struct upb_Message_Internal*)tmp;
2577}
2578
2579UPB_INLINE void UPB_PRIVATE(_upb_Message_SetInternal)(
2580 struct upb_Message* msg, struct upb_Message_Internal* internal) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002581 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002582 msg->UPB_OPAQUE(internal) = (uintptr_t)internal;
2583}
2584
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002585#ifdef __cplusplus
2586} /* extern "C" */
2587#endif
2588
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002589#undef UPB_OPAQUE
2590
2591
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00002592#endif /* UPB_MESSAGE_INTERNAL_TYPES_H_ */
2593
Eric Salo8809a112022-11-21 13:01:06 -08002594// Must be last.
2595
Eric Salob7d54ac2022-12-29 11:59:42 -08002596#if defined(__GNUC__) && !defined(__clang__)
2597// GCC raises incorrect warnings in these functions. It thinks that we are
2598// overrunning buffers, but we carefully write the functions in this file to
2599// guarantee that this is impossible. GCC gets this wrong due it its failure
2600// to perform constant propagation as we expect:
2601// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217
2602// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226
2603//
2604// Unfortunately this also indicates that GCC is not optimizing away the
2605// switch() in cases where it should be, compromising the performance.
2606#pragma GCC diagnostic push
2607#pragma GCC diagnostic ignored "-Warray-bounds"
2608#pragma GCC diagnostic ignored "-Wstringop-overflow"
Mike Kruskal232ecf42023-01-14 00:09:40 -08002609#if __GNUC__ >= 11
Eric Salob7d54ac2022-12-29 11:59:42 -08002610#pragma GCC diagnostic ignored "-Wstringop-overread"
2611#endif
Mike Kruskal232ecf42023-01-14 00:09:40 -08002612#endif
Eric Salob7d54ac2022-12-29 11:59:42 -08002613
Eric Salo8809a112022-11-21 13:01:06 -08002614#ifdef __cplusplus
2615extern "C" {
2616#endif
2617
Mike Kruskal9d435022023-07-11 12:45:07 -07002618// LINT.IfChange(presence_logic)
2619
2620// Hasbit access ///////////////////////////////////////////////////////////////
2621
Protobuf Team Bot7713df52023-12-05 20:16:11 +00002622UPB_INLINE bool UPB_PRIVATE(_upb_Message_GetHasbit)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002623 const struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bota0e81952023-12-21 14:54:29 +00002624 const size_t offset = UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(f);
2625 const char mask = UPB_PRIVATE(_upb_MiniTableField_HasbitMask)(f);
2626
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002627 return (*UPB_PTR_AT(msg, offset, const char) & mask) != 0;
Mike Kruskal9d435022023-07-11 12:45:07 -07002628}
2629
Protobuf Team Bot7713df52023-12-05 20:16:11 +00002630UPB_INLINE void UPB_PRIVATE(_upb_Message_SetHasbit)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002631 const struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bota0e81952023-12-21 14:54:29 +00002632 const size_t offset = UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(f);
2633 const char mask = UPB_PRIVATE(_upb_MiniTableField_HasbitMask)(f);
2634
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002635 (*UPB_PTR_AT(msg, offset, char)) |= mask;
2636}
2637
Protobuf Team Bot7713df52023-12-05 20:16:11 +00002638UPB_INLINE void UPB_PRIVATE(_upb_Message_ClearHasbit)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002639 const struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bota0e81952023-12-21 14:54:29 +00002640 const size_t offset = UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(f);
2641 const char mask = UPB_PRIVATE(_upb_MiniTableField_HasbitMask)(f);
2642
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002643 (*UPB_PTR_AT(msg, offset, char)) &= ~mask;
2644}
2645
Mike Kruskal9d435022023-07-11 12:45:07 -07002646// Oneof case access ///////////////////////////////////////////////////////////
2647
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002648UPB_INLINE uint32_t* UPB_PRIVATE(_upb_Message_OneofCasePtr)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002649 struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bota0e81952023-12-21 14:54:29 +00002650 return UPB_PTR_AT(msg, UPB_PRIVATE(_upb_MiniTableField_OneofOffset)(f),
2651 uint32_t);
Mike Kruskal9d435022023-07-11 12:45:07 -07002652}
2653
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002654UPB_INLINE uint32_t UPB_PRIVATE(_upb_Message_GetOneofCase)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002655 const struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002656 const uint32_t* ptr =
2657 UPB_PRIVATE(_upb_Message_OneofCasePtr)((struct upb_Message*)msg, f);
2658
2659 return *ptr;
Mike Kruskal9d435022023-07-11 12:45:07 -07002660}
2661
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002662UPB_INLINE void UPB_PRIVATE(_upb_Message_SetOneofCase)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002663 struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002664 uint32_t* ptr = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, f);
2665
2666 *ptr = upb_MiniTableField_Number(f);
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002667}
2668
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002669// Returns true if the given field is the current oneof case.
2670// Does nothing if it is not the current oneof case.
2671UPB_INLINE bool UPB_PRIVATE(_upb_Message_ClearOneofCase)(
2672 struct upb_Message* msg, const upb_MiniTableField* f) {
2673 uint32_t* ptr = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, f);
2674
2675 if (*ptr != upb_MiniTableField_Number(f)) return false;
2676 *ptr = 0;
2677 return true;
2678}
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002679
Mike Kruskal9d435022023-07-11 12:45:07 -07002680// LINT.ThenChange(GoogleInternalName2)
Mike Kruskal9d435022023-07-11 12:45:07 -07002681
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00002682// Returns false if the message is missing any of its required fields.
2683UPB_INLINE bool UPB_PRIVATE(_upb_Message_IsInitializedShallow)(
2684 const struct upb_Message* msg, const upb_MiniTable* m) {
2685 uint64_t bits;
2686 memcpy(&bits, msg + 1, sizeof(bits));
2687 bits = upb_BigEndian64(bits);
2688 return (UPB_PRIVATE(_upb_MiniTable_RequiredMask)(m) & ~bits) == 0;
2689}
2690
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002691UPB_INLINE void* UPB_PRIVATE(_upb_Message_MutableDataPtr)(
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002692 struct upb_Message* msg, const upb_MiniTableField* f) {
2693 return (char*)msg + f->UPB_ONLYBITS(offset);
Eric Salo8809a112022-11-21 13:01:06 -08002694}
2695
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002696UPB_INLINE const void* UPB_PRIVATE(_upb_Message_DataPtr)(
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002697 const struct upb_Message* msg, const upb_MiniTableField* f) {
2698 return (const char*)msg + f->UPB_ONLYBITS(offset);
Eric Salo8809a112022-11-21 13:01:06 -08002699}
2700
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002701UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)(
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002702 struct upb_Message* msg, const upb_MiniTableField* f) {
2703 if (UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f)) {
2704 UPB_PRIVATE(_upb_Message_SetHasbit)(msg, f);
2705 } else if (upb_MiniTableField_IsInOneof(f)) {
2706 UPB_PRIVATE(_upb_Message_SetOneofCase)(msg, f);
Eric Salo8809a112022-11-21 13:01:06 -08002707 }
2708}
2709
Protobuf Team Botddc54062023-12-12 20:03:38 +00002710UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)(
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002711 const upb_MiniTableField* f, void* to, const void* from) {
2712 switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) {
Eric Salo8809a112022-11-21 13:01:06 -08002713 case kUpb_FieldRep_1Byte:
2714 memcpy(to, from, 1);
2715 return;
2716 case kUpb_FieldRep_4Byte:
2717 memcpy(to, from, 4);
2718 return;
2719 case kUpb_FieldRep_8Byte:
2720 memcpy(to, from, 8);
2721 return;
2722 case kUpb_FieldRep_StringView: {
2723 memcpy(to, from, sizeof(upb_StringView));
2724 return;
2725 }
2726 }
2727 UPB_UNREACHABLE();
2728}
2729
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002730UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)(
2731 const upb_MiniTableField* f, const void* a, const void* b) {
2732 switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) {
2733 case kUpb_FieldRep_1Byte:
2734 return memcmp(a, b, 1) == 0;
2735 case kUpb_FieldRep_4Byte:
2736 return memcmp(a, b, 4) == 0;
2737 case kUpb_FieldRep_8Byte:
2738 return memcmp(a, b, 8) == 0;
2739 case kUpb_FieldRep_StringView: {
2740 const upb_StringView sa = *(const upb_StringView*)a;
2741 const upb_StringView sb = *(const upb_StringView*)b;
2742 return upb_StringView_IsEqual(sa, sb);
2743 }
2744 }
2745 UPB_UNREACHABLE();
2746}
2747
2748UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataClear)(
2749 const upb_MiniTableField* f, void* val) {
2750 const char zero[16] = {0};
2751 return UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, val, zero);
2752}
2753
2754UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(
2755 const upb_MiniTableField* f, const void* val) {
2756 const char zero[16] = {0};
2757 return UPB_PRIVATE(_upb_MiniTableField_DataEquals)(f, val, zero);
2758}
2759
Eric Salo8809a112022-11-21 13:01:06 -08002760// Here we define universal getter/setter functions for message fields.
2761// These look very branchy and inefficient, but as long as the MiniTableField
2762// values are known at compile time, all the branches are optimized away and
2763// we are left with ideal code. This can happen either through through
2764// literals or UPB_ASSUME():
2765//
Eric Salob598b2d2022-12-22 23:14:27 -08002766// // Via struct literals.
Eric Salo8809a112022-11-21 13:01:06 -08002767// bool FooMessage_set_bool_field(const upb_Message* msg, bool val) {
2768// const upb_MiniTableField field = {1, 0, 0, /* etc... */};
2769// // All value in "field" are compile-time known.
Eric Salo10505992022-12-12 12:16:36 -08002770// _upb_Message_SetNonExtensionField(msg, &field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002771// }
2772//
2773// // Via UPB_ASSUME().
Eric Salo10505992022-12-12 12:16:36 -08002774// UPB_INLINE bool upb_Message_SetBool(upb_Message* msg,
2775// const upb_MiniTableField* field,
2776// bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002777// UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool);
Protobuf Team Bot42169722023-11-29 03:54:33 +00002778// UPB_ASSUME(upb_MiniTableField_IsScalar(field));
2779// UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
2780// kUpb_FieldRep_1Byte);
Protobuf Team Bot54573a42023-11-21 14:47:34 +00002781// upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002782// }
2783//
2784// As a result, we can use these universal getters/setters for *all* message
2785// accessors: generated code, MiniTable accessors, and reflection. The only
2786// exception is the binary encoder/decoder, which need to be a bit more clever
Eric Salob598b2d2022-12-22 23:14:27 -08002787// about how they read/write the message data, for efficiency.
Eric Salo10505992022-12-12 12:16:36 -08002788//
2789// These functions work on both extensions and non-extensions. If the field
2790// of a setter is known to be a non-extension, the arena may be NULL and the
2791// returned bool value may be ignored since it will always succeed.
Eric Salo8809a112022-11-21 13:01:06 -08002792
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002793UPB_API_INLINE bool upb_Message_HasBaseField(const struct upb_Message* msg,
2794 const upb_MiniTableField* field) {
Eric Salo10505992022-12-12 12:16:36 -08002795 UPB_ASSERT(upb_MiniTableField_HasPresence(field));
2796 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Protobuf Team Bote81cda12023-11-21 18:23:13 +00002797 if (upb_MiniTableField_IsInOneof(field)) {
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002798 return UPB_PRIVATE(_upb_Message_GetOneofCase)(msg, field) ==
Protobuf Team Bot7bdd38e2023-12-01 23:06:45 +00002799 upb_MiniTableField_Number(field);
Eric Salo10505992022-12-12 12:16:36 -08002800 } else {
Protobuf Team Bot7713df52023-12-05 20:16:11 +00002801 return UPB_PRIVATE(_upb_Message_GetHasbit)(msg, field);
Eric Salo10505992022-12-12 12:16:36 -08002802 }
2803}
2804
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002805UPB_API_INLINE bool upb_Message_HasExtension(const struct upb_Message* msg,
2806 const upb_MiniTableExtension* e) {
2807 UPB_ASSERT(upb_MiniTableField_HasPresence(&e->UPB_PRIVATE(field)));
2808 return UPB_PRIVATE(_upb_Message_Getext)(msg, e) != NULL;
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00002809}
2810
Protobuf Team Bot1d143b52024-01-25 20:29:43 +00002811UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002812 const struct upb_Message* msg, const upb_MiniTableField* field,
Eric Salo8809a112022-11-21 13:01:06 -08002813 const void* default_val, void* val) {
2814 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Protobuf Team Bote81cda12023-11-21 18:23:13 +00002815 if ((upb_MiniTableField_IsInOneof(field) ||
Protobuf Team Botddc54062023-12-12 20:03:38 +00002816 !UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(field, default_val)) &&
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002817 !upb_Message_HasBaseField(msg, field)) {
Protobuf Team Botddc54062023-12-12 20:03:38 +00002818 UPB_PRIVATE(_upb_MiniTableField_DataCopy)(field, val, default_val);
Eric Salo8809a112022-11-21 13:01:06 -08002819 return;
2820 }
Protobuf Team Botddc54062023-12-12 20:03:38 +00002821 UPB_PRIVATE(_upb_MiniTableField_DataCopy)
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002822 (field, val, UPB_PRIVATE(_upb_Message_DataPtr)(msg, field));
Eric Salo8809a112022-11-21 13:01:06 -08002823}
2824
Eric Salo10505992022-12-12 12:16:36 -08002825UPB_INLINE void _upb_Message_GetExtensionField(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002826 const struct upb_Message* msg, const upb_MiniTableExtension* mt_ext,
Eric Salo8809a112022-11-21 13:01:06 -08002827 const void* default_val, void* val) {
Protobuf Team Botc13512a2024-01-25 18:53:49 +00002828 const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getext)(msg, mt_ext);
Protobuf Team Botddc54062023-12-12 20:03:38 +00002829 const upb_MiniTableField* f = &mt_ext->UPB_PRIVATE(field);
2830 UPB_ASSUME(upb_MiniTableField_IsExtension(f));
2831
Eric Salo8809a112022-11-21 13:01:06 -08002832 if (ext) {
Protobuf Team Botddc54062023-12-12 20:03:38 +00002833 UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, val, &ext->data);
Eric Salo8809a112022-11-21 13:01:06 -08002834 } else {
Protobuf Team Botddc54062023-12-12 20:03:38 +00002835 UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, val, default_val);
Eric Salo8809a112022-11-21 13:01:06 -08002836 }
2837}
2838
Eric Salo10505992022-12-12 12:16:36 -08002839UPB_INLINE void _upb_Message_SetNonExtensionField(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002840 struct upb_Message* msg, const upb_MiniTableField* field, const void* val) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002841 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Eric Salo8809a112022-11-21 13:01:06 -08002842 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002843 UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
Protobuf Team Botddc54062023-12-12 20:03:38 +00002844 UPB_PRIVATE(_upb_MiniTableField_DataCopy)
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002845 (field, UPB_PRIVATE(_upb_Message_MutableDataPtr)(msg, field), val);
Eric Salo8809a112022-11-21 13:01:06 -08002846}
2847
Eric Salo10505992022-12-12 12:16:36 -08002848UPB_INLINE bool _upb_Message_SetExtensionField(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002849 struct upb_Message* msg, const upb_MiniTableExtension* mt_ext,
2850 const void* val, upb_Arena* a) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002851 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Eric Salo10505992022-12-12 12:16:36 -08002852 UPB_ASSERT(a);
Protobuf Team Botc13512a2024-01-25 18:53:49 +00002853 upb_Extension* ext =
Protobuf Team Bot9ffbe842024-01-23 04:41:30 +00002854 UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(msg, mt_ext, a);
Eric Salo8809a112022-11-21 13:01:06 -08002855 if (!ext) return false;
Protobuf Team Botddc54062023-12-12 20:03:38 +00002856 UPB_PRIVATE(_upb_MiniTableField_DataCopy)
2857 (&mt_ext->UPB_PRIVATE(field), &ext->data, val);
Eric Salo8809a112022-11-21 13:01:06 -08002858 return true;
2859}
2860
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002861UPB_API_INLINE void upb_Message_Clear(struct upb_Message* msg,
2862 const upb_MiniTable* m) {
2863 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00002864 memset(msg, 0, m->UPB_PRIVATE(size));
2865}
2866
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002867UPB_API_INLINE void upb_Message_ClearBaseField(struct upb_Message* msg,
2868 const upb_MiniTableField* f) {
2869 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00002870 if (UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f)) {
2871 UPB_PRIVATE(_upb_Message_ClearHasbit)(msg, f);
2872 } else if (upb_MiniTableField_IsInOneof(f)) {
2873 uint32_t* ptr = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, f);
2874 if (*ptr != upb_MiniTableField_Number(f)) return;
2875 *ptr = 0;
2876 }
2877 const char zeros[16] = {0};
2878 UPB_PRIVATE(_upb_MiniTableField_DataCopy)
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002879 (f, UPB_PRIVATE(_upb_Message_MutableDataPtr)(msg, f), zeros);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00002880}
2881
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002882UPB_API_INLINE void upb_Message_ClearExtension(
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00002883 struct upb_Message* msg, const upb_MiniTableExtension* e) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002884 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002885 upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
Protobuf Team Bot2b797382023-12-30 23:16:16 +00002886 if (!in) return;
Protobuf Team Botc13512a2024-01-25 18:53:49 +00002887 const upb_Extension* base = UPB_PTR_AT(in, in->ext_begin, upb_Extension);
2888 upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
Eric Salo10505992022-12-12 12:16:36 -08002889 if (ext) {
2890 *ext = *base;
Protobuf Team Botc13512a2024-01-25 18:53:49 +00002891 in->ext_begin += sizeof(upb_Extension);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002892 }
2893}
2894
Jie Luo3560e232023-06-12 00:33:50 -07002895UPB_INLINE void _upb_Message_AssertMapIsUntagged(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002896 const struct upb_Message* msg, const upb_MiniTableField* field) {
Adam Cozzette7d5592e2023-08-23 12:15:26 -07002897 UPB_UNUSED(msg);
Protobuf Team Bot42169722023-11-29 03:54:33 +00002898 UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
Jie Luo3560e232023-06-12 00:33:50 -07002899#ifndef NDEBUG
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00002900 uintptr_t default_val = 0;
2901 uintptr_t tagged;
Jie Luo3560e232023-06-12 00:33:50 -07002902 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002903 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged));
Jie Luo3560e232023-06-12 00:33:50 -07002904#endif
2905}
2906
Protobuf Team Bote9ea4a52023-12-28 02:56:22 +00002907UPB_INLINE struct upb_Map* _upb_Message_GetOrCreateMutableMap(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002908 struct upb_Message* msg, const upb_MiniTableField* field, size_t key_size,
Eric Salob7d54ac2022-12-29 11:59:42 -08002909 size_t val_size, upb_Arena* arena) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00002910 UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
Jie Luo3560e232023-06-12 00:33:50 -07002911 _upb_Message_AssertMapIsUntagged(msg, field);
Protobuf Team Bote9ea4a52023-12-28 02:56:22 +00002912 struct upb_Map* map = NULL;
2913 struct upb_Map* default_map_value = NULL;
Eric Salob7d54ac2022-12-29 11:59:42 -08002914 _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map);
2915 if (!map) {
2916 map = _upb_Map_New(arena, key_size, val_size);
2917 // Check again due to: https://godbolt.org/z/7WfaoKG1r
Protobuf Team Bot42169722023-11-29 03:54:33 +00002918 UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
Eric Salob7d54ac2022-12-29 11:59:42 -08002919 _upb_Message_SetNonExtensionField(msg, field, &map);
2920 }
2921 return map;
2922}
2923
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002924#ifdef __cplusplus
2925} /* extern "C" */
2926#endif
2927
2928#if defined(__GNUC__) && !defined(__clang__)
2929#pragma GCC diagnostic pop
2930#endif
2931
2932
Sandy Zhange3b09432023-08-07 09:30:02 -07002933#endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002934
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002935#ifndef UPB_MESSAGE_MAP_H_
2936#define UPB_MESSAGE_MAP_H_
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002937
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002938#include <stddef.h>
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002939
2940
2941// Must be last.
2942
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002943typedef struct upb_Map upb_Map;
Protobuf Team Botc9a8b462023-11-18 01:30:26 +00002944
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002945#ifdef __cplusplus
2946extern "C" {
2947#endif
2948
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002949// Creates a new map on the given arena with the given key/value size.
2950UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type,
2951 upb_CType value_type);
Protobuf Team Botc9a8b462023-11-18 01:30:26 +00002952
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002953// Returns the number of entries in the map.
2954UPB_API size_t upb_Map_Size(const upb_Map* map);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002955
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002956// Stores a value for the given key into |*val| (or the zero value if the key is
2957// not present). Returns whether the key was present. The |val| pointer may be
2958// NULL, in which case the function tests whether the given key is present.
2959UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key,
2960 upb_MessageValue* val);
2961
2962// Removes all entries in the map.
2963UPB_API void upb_Map_Clear(upb_Map* map);
2964
2965// Sets the given key to the given value, returning whether the key was inserted
2966// or replaced. If the key was inserted, then any existing iterators will be
2967// invalidated.
2968UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key,
2969 upb_MessageValue val,
2970 upb_Arena* arena);
2971
2972// Sets the given key to the given value. Returns false if memory allocation
2973// failed. If the key is newly inserted, then any existing iterators will be
2974// invalidated.
2975UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key,
2976 upb_MessageValue val, upb_Arena* arena) {
2977 return upb_Map_Insert(map, key, val, arena) !=
2978 kUpb_MapInsertStatus_OutOfMemory;
Protobuf Team Botc9a8b462023-11-18 01:30:26 +00002979}
2980
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002981// Deletes this key from the table. Returns true if the key was present.
2982// If present and |val| is non-NULL, stores the deleted value.
2983UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
2984 upb_MessageValue* val);
2985
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002986// Map iteration:
2987//
2988// size_t iter = kUpb_Map_Begin;
2989// upb_MessageValue key, val;
2990// while (upb_Map_Next(map, &key, &val, &iter)) {
2991// ...
2992// }
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002993
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002994#define kUpb_Map_Begin ((size_t) - 1)
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002995
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002996// Advances to the next entry. Returns false if no more entries are present.
2997// Otherwise returns true and populates both *key and *value.
2998UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key,
2999 upb_MessageValue* val, size_t* iter);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003000
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003001// Sets the value for the entry pointed to by iter.
3002// WARNING: this does not currently work for string values!
3003UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter,
3004 upb_MessageValue val);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003005
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003006// DEPRECATED iterator, slated for removal.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003007
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003008/* Map iteration:
3009 *
3010 * size_t iter = kUpb_Map_Begin;
3011 * while (upb_MapIterator_Next(map, &iter)) {
3012 * upb_MessageValue key = upb_MapIterator_Key(map, iter);
3013 * upb_MessageValue val = upb_MapIterator_Value(map, iter);
3014 * }
3015 */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003016
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003017// Advances to the next entry. Returns false if no more entries are present.
3018UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003019
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003020// Returns true if the iterator still points to a valid entry, or false if the
3021// iterator is past the last element. It is an error to call this function with
3022// kUpb_Map_Begin (you must call next() at least once first).
3023UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter);
3024
3025// Returns the key and value for this entry of the map.
3026UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter);
3027UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);
Protobuf Team Bot030ab8d2023-12-01 19:20:11 +00003028
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003029// Mark a map and all of its descendents as frozen/immutable.
3030// If the map values are messages then |m| must point to the minitable for
3031// those messages. Otherwise |m| must be NULL.
3032UPB_API void upb_Map_Freeze(upb_Map* map, const upb_MiniTable* m);
3033
3034// Returns whether a map has been frozen.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003035UPB_API_INLINE bool upb_Map_IsFrozen(const upb_Map* map);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003036
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003037#ifdef __cplusplus
3038} /* extern "C" */
3039#endif
3040
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003041
3042#endif /* UPB_MESSAGE_MAP_H_ */
3043
3044#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
3045#define UPB_MINI_TABLE_TAGGED_PTR_H_
3046
3047#include <stdint.h>
Protobuf Team Botc9a8b462023-11-18 01:30:26 +00003048
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003049
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003050// Public APIs for message operations that do not depend on the schema.
3051//
3052// MiniTable-based accessors live in accessors.h.
3053
3054#ifndef UPB_MESSAGE_MESSAGE_H_
3055#define UPB_MESSAGE_MESSAGE_H_
3056
3057#include <stddef.h>
3058
3059
3060// Must be last.
3061
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003062typedef struct upb_Message upb_Message;
3063
3064#ifdef __cplusplus
3065extern "C" {
3066#endif
3067
3068// Creates a new message with the given mini_table on the given arena.
3069UPB_API upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* arena);
3070
3071// Returns a reference to the message's unknown data.
3072const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len);
3073
3074// Removes partial unknown data from message.
3075void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len);
3076
3077// Returns the number of extensions present in this message.
3078size_t upb_Message_ExtensionCount(const upb_Message* msg);
3079
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003080// Mark a message and all of its descendents as frozen/immutable.
3081UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m);
3082
3083// Returns whether a message has been frozen.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003084UPB_API_INLINE bool upb_Message_IsFrozen(const upb_Message* msg);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003085
Protobuf Team Botfb08bca2024-03-14 15:21:13 +00003086#ifdef UPB_TRACING_ENABLED
3087UPB_INLINE void upb_Message_SetNewMessageTraceHandler(
3088 void (*newMessageTraceHandler)(const upb_MiniTable* mini_table,
3089 const upb_Arena* arena)) {
3090 UPB_PRIVATE(upb_Message_SetNewMessageTraceHandler)(newMessageTraceHandler);
3091}
3092UPB_INLINE void upb_Message_LogNewMessage(const upb_MiniTable* mini_table,
3093 const upb_Arena* arena) {
3094 UPB_PRIVATE(upb_Message_LogNewMessage)(mini_table, arena);
3095}
3096#endif
3097
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003098#ifdef __cplusplus
3099} /* extern "C" */
3100#endif
3101
3102
3103#endif /* UPB_MESSAGE_MESSAGE_H_ */
3104
3105// Must be last.
3106
3107// When a upb_Message* is stored in a message, array, or map, it is stored in a
3108// tagged form. If the tag bit is set, the referenced upb_Message is of type
3109// _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of
3110// that field's true message type. This forms the basis of what we call
3111// "dynamic tree shaking."
3112//
3113// See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for
3114// more information.
3115
3116typedef uintptr_t upb_TaggedMessagePtr;
3117
3118#ifdef __cplusplus
3119extern "C" {
3120#endif
3121
3122// Users who enable unlinked sub-messages must use this to test whether a
3123// message is empty before accessing it. If a message is empty, it must be
3124// first promoted using the interfaces in message/promote.h.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003125UPB_API_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr);
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003126
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003127UPB_API_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
3128 upb_TaggedMessagePtr ptr);
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003129
3130#ifdef __cplusplus
3131} /* extern "C" */
3132#endif
3133
3134
3135#endif /* UPB_MINI_TABLE_TAGGED_PTR_H_ */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003136
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003137#ifndef UPB_MINI_TABLE_SUB_H_
3138#define UPB_MINI_TABLE_SUB_H_
3139
3140
3141// Must be last.
3142
Protobuf Team Bot9b4aff22023-12-27 21:35:01 +00003143typedef union upb_MiniTableSub upb_MiniTableSub;
3144
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003145#ifdef __cplusplus
3146extern "C" {
3147#endif
3148
3149// Constructors
3150
3151UPB_API_INLINE upb_MiniTableSub
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003152upb_MiniTableSub_FromEnum(const upb_MiniTableEnum* subenum);
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003153
3154UPB_API_INLINE upb_MiniTableSub
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003155upb_MiniTableSub_FromMessage(const upb_MiniTable* submsg);
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003156
3157// Getters
3158
3159UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTableSub_Enum(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003160 upb_MiniTableSub sub);
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003161
3162UPB_API_INLINE const upb_MiniTable* upb_MiniTableSub_Message(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003163 upb_MiniTableSub sub);
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003164
3165#ifdef __cplusplus
3166} /* extern "C" */
3167#endif
3168
3169
3170#endif /* UPB_MINI_TABLE_SUB_H_ */
3171
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003172// Must be last.
3173
3174#ifdef __cplusplus
3175extern "C" {
3176#endif
Eric Salo10505992022-12-12 12:16:36 -08003177
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00003178// Functions ending in BaseField() take a (upb_MiniTableField*) argument
3179// and work only on non-extension fields.
3180//
3181// Functions ending in Extension() take a (upb_MiniTableExtension*) argument
3182// and work only on extensions.
Mike Kruskal3bc50492022-12-01 13:34:12 -08003183
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003184UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, const upb_MiniTable* m);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00003185
3186UPB_API_INLINE void upb_Message_ClearBaseField(upb_Message* msg,
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003187 const upb_MiniTableField* f);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00003188
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003189UPB_API_INLINE void upb_Message_ClearExtension(upb_Message* msg,
3190 const upb_MiniTableExtension* e);
Jie Luof36a5c62023-05-23 17:56:18 -07003191
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00003192UPB_API_INLINE bool upb_Message_HasBaseField(const upb_Message* msg,
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003193 const upb_MiniTableField* f);
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00003194
3195UPB_API_INLINE bool upb_Message_HasExtension(const upb_Message* msg,
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003196 const upb_MiniTableExtension* e);
Eric Salo8809a112022-11-21 13:01:06 -08003197
Eric Salob598b2d2022-12-22 23:14:27 -08003198UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
3199 const upb_Message* message, const upb_MiniTableField* oneof_field) {
Protobuf Team Bote81cda12023-11-21 18:23:13 +00003200 UPB_ASSUME(upb_MiniTableField_IsInOneof(oneof_field));
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00003201 return UPB_PRIVATE(_upb_Message_GetOneofCase)(message, oneof_field);
Eric Salob598b2d2022-12-22 23:14:27 -08003202}
3203
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003204// NOTE: The default_val is only used for fields that support presence.
3205// For repeated/map fields, the resulting upb_Array*/upb_Map* can be NULL if a
3206// upb_Array/upb_Map has not been allocated yet. Array/map fields do not have
3207// presence, so this is semantically identical to a pointer to an empty
3208// array/map, and must be treated the same for all semantic purposes.
3209UPB_INLINE upb_MessageValue
3210upb_Message_GetField(const upb_Message* msg, const upb_MiniTableField* field,
3211 upb_MessageValue default_val) {
3212 upb_MessageValue ret;
3213 if (upb_MiniTableField_IsExtension(field)) {
3214 _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field,
3215 &default_val, &ret);
3216 } else {
3217 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
3218 }
3219 return ret;
3220}
3221
Protobuf Team Bot5ec1e252024-03-05 22:36:44 +00003222// Sets the value of the given field in the given msg. The return value is true
3223// if the operation completed successfully, or false if memory allocation
3224// failed.
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003225UPB_INLINE bool upb_Message_SetField(upb_Message* msg,
3226 const upb_MiniTableField* field,
3227 upb_MessageValue val, upb_Arena* a) {
3228 if (upb_MiniTableField_IsExtension(field)) {
3229 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
3230 return _upb_Message_SetExtensionField(msg, ext, &val, a);
3231 } else {
3232 _upb_Message_SetNonExtensionField(msg, field, &val);
3233 return true;
3234 }
3235}
3236
Eric Salo10505992022-12-12 12:16:36 -08003237UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
3238 const upb_MiniTableField* field,
3239 bool default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003240 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003241 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3242 kUpb_FieldRep_1Byte);
3243 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003244 upb_MessageValue def;
3245 def.bool_val = default_val;
3246 return upb_Message_GetField(msg, field, def).bool_val;
Eric Salo8809a112022-11-21 13:01:06 -08003247}
3248
Eric Salo10505992022-12-12 12:16:36 -08003249UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
3250 const upb_MiniTableField* field,
3251 bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003252 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003253 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3254 kUpb_FieldRep_1Byte);
3255 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003256 upb_MessageValue val;
3257 val.bool_val = value;
3258 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003259}
3260
Eric Salo10505992022-12-12 12:16:36 -08003261UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
3262 const upb_MiniTableField* field,
3263 int32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003264 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
3265 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003266 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3267 kUpb_FieldRep_4Byte);
3268 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003269
3270 upb_MessageValue def;
3271 def.int32_val = default_val;
3272 return upb_Message_GetField(msg, field, def).int32_val;
Eric Salo8809a112022-11-21 13:01:06 -08003273}
3274
Eric Salo10505992022-12-12 12:16:36 -08003275UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
3276 const upb_MiniTableField* field,
3277 int32_t value, upb_Arena* a) {
Deanna Garciab26afb52023-04-25 13:37:18 -07003278 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
3279 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003280 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3281 kUpb_FieldRep_4Byte);
3282 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003283 upb_MessageValue val;
3284 val.int32_val = value;
3285 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003286}
3287
Eric Salo10505992022-12-12 12:16:36 -08003288UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
3289 const upb_MiniTableField* field,
3290 uint32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003291 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003292 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3293 kUpb_FieldRep_4Byte);
3294 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003295
3296 upb_MessageValue def;
3297 def.uint32_val = default_val;
3298 return upb_Message_GetField(msg, field, def).uint32_val;
Eric Salo8809a112022-11-21 13:01:06 -08003299}
3300
Eric Salo10505992022-12-12 12:16:36 -08003301UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
3302 const upb_MiniTableField* field,
3303 uint32_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003304 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003305 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3306 kUpb_FieldRep_4Byte);
3307 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003308 upb_MessageValue val;
3309 val.uint32_val = value;
3310 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003311}
3312
Deanna Garciab26afb52023-04-25 13:37:18 -07003313UPB_API_INLINE void upb_Message_SetClosedEnum(
Eric Salo3f36a912022-12-05 14:12:25 -08003314 upb_Message* msg, const upb_MiniTable* msg_mini_table,
3315 const upb_MiniTableField* field, int32_t value) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003316 UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field));
Protobuf Team Bot42169722023-11-29 03:54:33 +00003317 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3318 kUpb_FieldRep_4Byte);
3319 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Eric Salo8809a112022-11-21 13:01:06 -08003320 UPB_ASSERT(upb_MiniTableEnum_CheckValue(
3321 upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value));
Eric Salo10505992022-12-12 12:16:36 -08003322 _upb_Message_SetNonExtensionField(msg, field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08003323}
3324
Eric Salo10505992022-12-12 12:16:36 -08003325UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
3326 const upb_MiniTableField* field,
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003327 int64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003328 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003329 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3330 kUpb_FieldRep_8Byte);
3331 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003332
3333 upb_MessageValue def;
3334 def.int64_val = default_val;
3335 return upb_Message_GetField(msg, field, def).int64_val;
Eric Salo8809a112022-11-21 13:01:06 -08003336}
3337
Eric Salo10505992022-12-12 12:16:36 -08003338UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
3339 const upb_MiniTableField* field,
3340 int64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003341 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003342 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3343 kUpb_FieldRep_8Byte);
3344 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003345 upb_MessageValue val;
3346 val.int64_val = value;
3347 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003348}
3349
Eric Salo10505992022-12-12 12:16:36 -08003350UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
3351 const upb_MiniTableField* field,
3352 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003353 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003354 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3355 kUpb_FieldRep_8Byte);
3356 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003357
3358 upb_MessageValue def;
3359 def.uint64_val = default_val;
3360 return upb_Message_GetField(msg, field, def).uint64_val;
Eric Salo8809a112022-11-21 13:01:06 -08003361}
3362
Eric Salo10505992022-12-12 12:16:36 -08003363UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
3364 const upb_MiniTableField* field,
3365 uint64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003366 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003367 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3368 kUpb_FieldRep_8Byte);
3369 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003370 upb_MessageValue val;
3371 val.uint64_val = value;
3372 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003373}
3374
Eric Salo10505992022-12-12 12:16:36 -08003375UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
3376 const upb_MiniTableField* field,
3377 float default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003378 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003379 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3380 kUpb_FieldRep_4Byte);
3381 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003382
3383 upb_MessageValue def;
3384 def.float_val = default_val;
3385 return upb_Message_GetField(msg, field, def).float_val;
Eric Salo8809a112022-11-21 13:01:06 -08003386}
3387
Eric Salo10505992022-12-12 12:16:36 -08003388UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
3389 const upb_MiniTableField* field,
3390 float value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003391 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003392 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3393 kUpb_FieldRep_4Byte);
3394 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003395 upb_MessageValue val;
3396 val.float_val = value;
3397 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003398}
3399
Eric Salo10505992022-12-12 12:16:36 -08003400UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
3401 const upb_MiniTableField* field,
3402 double default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003403 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003404 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3405 kUpb_FieldRep_8Byte);
3406 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003407
3408 upb_MessageValue def;
3409 def.double_val = default_val;
3410 return upb_Message_GetField(msg, field, def).double_val;
Eric Salo8809a112022-11-21 13:01:06 -08003411}
3412
Eric Salo10505992022-12-12 12:16:36 -08003413UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
3414 const upb_MiniTableField* field,
3415 double value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003416 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003417 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3418 kUpb_FieldRep_8Byte);
3419 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003420 upb_MessageValue val;
3421 val.double_val = value;
3422 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003423}
3424
Eric Salo3f36a912022-12-05 14:12:25 -08003425UPB_API_INLINE upb_StringView
Eric Salo10505992022-12-12 12:16:36 -08003426upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003427 upb_StringView default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003428 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
3429 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003430 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3431 kUpb_FieldRep_StringView);
3432 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003433
3434 upb_MessageValue def;
3435 def.str_val = default_val;
3436 return upb_Message_GetField(msg, field, def).str_val;
Eric Salo8809a112022-11-21 13:01:06 -08003437}
3438
Protobuf Team Bot33f367d2024-03-06 18:26:18 +00003439// Sets the value of a `string` or `bytes` field. The bytes of the value are not
3440// copied, so it is the caller's responsibility to ensure that they remain valid
3441// for the lifetime of `msg`. That might be done by copying them into the given
3442// arena, or by fusing that arena with the arena the bytes live in, for example.
Eric Salo10505992022-12-12 12:16:36 -08003443UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
3444 const upb_MiniTableField* field,
3445 upb_StringView value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003446 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
3447 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003448 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3449 kUpb_FieldRep_StringView);
3450 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003451 upb_MessageValue val;
3452 val.str_val = value;
3453 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003454}
3455
Jie Luo3560e232023-06-12 00:33:50 -07003456UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
Eric Salo8809a112022-11-21 13:01:06 -08003457 const upb_Message* msg, const upb_MiniTableField* field,
3458 upb_Message* default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003459 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003460 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
Eric Salo8809a112022-11-21 13:01:06 -08003461 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Protobuf Team Bot42169722023-11-29 03:54:33 +00003462 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Jie Luo3560e232023-06-12 00:33:50 -07003463 upb_TaggedMessagePtr tagged;
3464 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
3465 return tagged;
Eric Salo8809a112022-11-21 13:01:06 -08003466}
3467
Jie Luo3560e232023-06-12 00:33:50 -07003468UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
Protobuf Team Bot4687ef32024-02-01 03:10:38 +00003469 const upb_Message* msg, const upb_MiniTableField* field) {
Jie Luo3560e232023-06-12 00:33:50 -07003470 upb_TaggedMessagePtr tagged =
Protobuf Team Bot4687ef32024-02-01 03:10:38 +00003471 upb_Message_GetTaggedMessagePtr(msg, field, NULL);
Jie Luo3560e232023-06-12 00:33:50 -07003472 return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged);
3473}
3474
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003475UPB_API_INLINE upb_Message* upb_Message_GetMutableMessage(
3476 upb_Message* msg, const upb_MiniTableField* field) {
Protobuf Team Bot4687ef32024-02-01 03:10:38 +00003477 return (upb_Message*)upb_Message_GetMessage(msg, field);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003478}
3479
Jie Luo3560e232023-06-12 00:33:50 -07003480// For internal use only; users cannot set tagged messages because only the
3481// parser and the message copier are allowed to directly create an empty
3482// message.
3483UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
3484 upb_Message* msg, const upb_MiniTable* mini_table,
3485 const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003486 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003487 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
Eric Salo8809a112022-11-21 13:01:06 -08003488 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Protobuf Team Bot42169722023-11-29 03:54:33 +00003489 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003490 UPB_ASSERT(upb_MiniTableSub_Message(
Protobuf Team Bot07194fc2023-11-30 05:43:03 +00003491 mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]));
Eric Salo10505992022-12-12 12:16:36 -08003492 _upb_Message_SetNonExtensionField(msg, field, &sub_message);
Eric Salo8809a112022-11-21 13:01:06 -08003493}
3494
Protobuf Team Botcdb03452024-03-08 01:14:01 +00003495// Sets the value of a message-typed field. The `mini_table` and `field`
3496// parameters belong to `msg`, not `sub_message`. The mini_tables of `msg` and
3497// `sub_message` must have been linked for this to work correctly.
Jie Luo3560e232023-06-12 00:33:50 -07003498UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
3499 const upb_MiniTable* mini_table,
3500 const upb_MiniTableField* field,
3501 upb_Message* sub_message) {
3502 _upb_Message_SetTaggedMessagePtr(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003503 msg, mini_table, field,
3504 UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(sub_message, false));
Jie Luo3560e232023-06-12 00:33:50 -07003505}
3506
Mike Kruskal232ecf42023-01-14 00:09:40 -08003507UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
Eric Salo8809a112022-11-21 13:01:06 -08003508 upb_Message* msg, const upb_MiniTable* mini_table,
3509 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003510 UPB_ASSERT(arena);
3511 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Protobuf Team Bota9a40062023-12-19 04:10:41 +00003512 upb_Message* sub_message =
3513 *UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*);
Eric Salo8809a112022-11-21 13:01:06 -08003514 if (!sub_message) {
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003515 const upb_MiniTable* sub_mini_table = upb_MiniTableSub_Message(
Protobuf Team Bot07194fc2023-11-30 05:43:03 +00003516 mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]);
Eric Salo8809a112022-11-21 13:01:06 -08003517 UPB_ASSERT(sub_mini_table);
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00003518 sub_message = _upb_Message_New(sub_mini_table, arena);
Protobuf Team Bota9a40062023-12-19 04:10:41 +00003519 *UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*) = sub_message;
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00003520 UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08003521 }
3522 return sub_message;
3523}
3524
Eric Salob598b2d2022-12-22 23:14:27 -08003525UPB_API_INLINE const upb_Array* upb_Message_GetArray(
Eric Salo8809a112022-11-21 13:01:06 -08003526 const upb_Message* msg, const upb_MiniTableField* field) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003527 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07003528 upb_Array* ret;
Eric Salo8809a112022-11-21 13:01:06 -08003529 const upb_Array* default_val = NULL;
Eric Salo10505992022-12-12 12:16:36 -08003530 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08003531 return ret;
3532}
3533
Eric Salob598b2d2022-12-22 23:14:27 -08003534UPB_API_INLINE upb_Array* upb_Message_GetMutableArray(
Eric Salo8809a112022-11-21 13:01:06 -08003535 upb_Message* msg, const upb_MiniTableField* field) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003536 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003537 return (upb_Array*)upb_Message_GetArray(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08003538}
3539
Eric Salob598b2d2022-12-22 23:14:27 -08003540UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
Eric Salob7d54ac2022-12-29 11:59:42 -08003541 upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003542 UPB_ASSERT(arena);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003543 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003544 upb_Array* array = upb_Message_GetMutableArray(msg, field);
3545 if (!array) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003546 array = UPB_PRIVATE(_upb_Array_New)(
3547 arena, 4, UPB_PRIVATE(_upb_MiniTableField_ElemSizeLg2)(field));
Eric Salob7d54ac2022-12-29 11:59:42 -08003548 // Check again due to: https://godbolt.org/z/7WfaoKG1r
Protobuf Team Bot42169722023-11-29 03:54:33 +00003549 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003550 upb_MessageValue val;
3551 val.array_val = array;
3552 upb_Message_SetField(msg, field, val, arena);
Eric Salob598b2d2022-12-22 23:14:27 -08003553 }
3554 return array;
3555}
3556
Jie Luof36a5c62023-05-23 17:56:18 -07003557UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized(
Eric Salob7d54ac2022-12-29 11:59:42 -08003558 upb_Message* msg, const upb_MiniTableField* field, size_t size,
3559 upb_Arena* arena) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003560 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Eric Salob7d54ac2022-12-29 11:59:42 -08003561 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00003562 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(arr, size, arena)) {
3563 return NULL;
3564 }
3565 return upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08003566}
Eric Salo10505992022-12-12 12:16:36 -08003567
Eric Salob7d54ac2022-12-29 11:59:42 -08003568UPB_API_INLINE const upb_Map* upb_Message_GetMap(
3569 const upb_Message* msg, const upb_MiniTableField* field) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003570 UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
Jie Luo3560e232023-06-12 00:33:50 -07003571 _upb_Message_AssertMapIsUntagged(msg, field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07003572 upb_Map* ret;
Eric Salob7d54ac2022-12-29 11:59:42 -08003573 const upb_Map* default_val = NULL;
3574 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
3575 return ret;
3576}
3577
Jie Luo3560e232023-06-12 00:33:50 -07003578UPB_API_INLINE upb_Map* upb_Message_GetMutableMap(
3579 upb_Message* msg, const upb_MiniTableField* field) {
3580 return (upb_Map*)upb_Message_GetMap(msg, field);
3581}
3582
Mike Kruskal232ecf42023-01-14 00:09:40 -08003583UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
Eric Salob598b2d2022-12-22 23:14:27 -08003584 upb_Message* msg, const upb_MiniTable* map_entry_mini_table,
3585 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003586 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salob7d54ac2022-12-29 11:59:42 -08003587 const upb_MiniTableField* map_entry_key_field =
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +00003588 &map_entry_mini_table->UPB_ONLYBITS(fields)[0];
Eric Salob7d54ac2022-12-29 11:59:42 -08003589 const upb_MiniTableField* map_entry_value_field =
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +00003590 &map_entry_mini_table->UPB_ONLYBITS(fields)[1];
Mike Kruskal232ecf42023-01-14 00:09:40 -08003591 return _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08003592 msg, field,
3593 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)),
3594 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)),
3595 arena);
Eric Salob598b2d2022-12-22 23:14:27 -08003596}
3597
3598// Updates a map entry given an entry message.
Protobuf Team Bot5b343372023-12-19 06:18:53 +00003599bool upb_Message_SetMapEntry(upb_Map* map, const upb_MiniTable* mini_table,
3600 const upb_MiniTableField* field,
3601 upb_Message* map_entry_message, upb_Arena* arena);
Eric Salob598b2d2022-12-22 23:14:27 -08003602
Eric Salo8809a112022-11-21 13:01:06 -08003603#ifdef __cplusplus
3604} /* extern "C" */
3605#endif
3606
3607
3608#endif // UPB_MESSAGE_ACCESSORS_H_
3609
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003610// These functions are only used by generated code.
3611
3612#ifndef UPB_MESSAGE_MAP_GENCODE_UTIL_H_
3613#define UPB_MESSAGE_MAP_GENCODE_UTIL_H_
3614
3615
3616// Must be last.
3617
3618#ifdef __cplusplus
3619extern "C" {
3620#endif
3621
3622// Message map operations, these get the map from the message first.
3623
3624UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
3625 const upb_tabent* ent = (const upb_tabent*)msg;
3626 uint32_t u32len;
3627 upb_StringView k;
3628 k.data = upb_tabstr(ent->key, &u32len);
3629 k.size = u32len;
3630 _upb_map_fromkey(k, key, size);
3631}
3632
3633UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
3634 const upb_tabent* ent = (const upb_tabent*)msg;
3635 upb_value v = {ent->val.val};
3636 _upb_map_fromvalue(v, val, size);
3637}
3638
3639UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
3640 size_t size) {
3641 upb_tabent* ent = (upb_tabent*)msg;
3642 // This is like _upb_map_tovalue() except the entry already exists
3643 // so we can reuse the allocated upb_StringView for string fields.
3644 if (size == UPB_MAPTYPE_STRING) {
3645 upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val;
3646 memcpy(strp, val, sizeof(*strp));
3647 } else {
3648 memcpy(&ent->val.val, val, size);
3649 }
3650}
3651
3652#ifdef __cplusplus
3653} /* extern "C" */
3654#endif
3655
3656
3657#endif /* UPB_MESSAGE_MAP_GENCODE_UTIL_H_ */
3658
Mike Kruskal9d435022023-07-11 12:45:07 -07003659#ifndef UPB_MINI_TABLE_DECODE_H_
3660#define UPB_MINI_TABLE_DECODE_H_
3661
3662
Mike Kruskal9d435022023-07-11 12:45:07 -07003663// Export the newer headers, for legacy users. New users should include the
3664// more specific headers directly.
3665// IWYU pragma: begin_exports
Mike Kruskal9d435022023-07-11 12:45:07 -07003666#ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3667#define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3668
3669
3670// Must be last.
3671
3672#ifdef __cplusplus
3673extern "C" {
3674#endif
3675
3676// Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor
3677// must be for an enum, not a message.
3678UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data,
3679 size_t len,
3680 upb_Arena* arena,
3681 upb_Status* status);
3682
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00003683// TODO: Deprecated name; update callers.
Mike Kruskal9d435022023-07-11 12:45:07 -07003684UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data,
3685 size_t len,
3686 upb_Arena* arena,
3687 upb_Status* status) {
3688 return upb_MiniDescriptor_BuildEnum(data, len, arena, status);
3689}
3690
3691#ifdef __cplusplus
3692} /* extern "C" */
3693#endif
3694
3695
3696#endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3697
3698// Functions for linking MiniTables together once they are built from a
3699// MiniDescriptor.
3700//
3701// These functions have names like upb_MiniTable_Link() because they operate on
3702// MiniTables. We put them here, rather than in the mini_table/ directory,
3703// because they are only needed when building MiniTables from MiniDescriptors.
3704// The interfaces in mini_table/ assume that MiniTables are immutable.
3705
3706#ifndef UPB_MINI_DESCRIPTOR_LINK_H_
3707#define UPB_MINI_DESCRIPTOR_LINK_H_
3708
3709
3710// Must be last.
3711
3712#ifdef __cplusplus
3713extern "C" {
3714#endif
3715
3716// Links a sub-message field to a MiniTable for that sub-message. If a
3717// sub-message field is not linked, it will be treated as an unknown field
3718// during parsing, and setting the field will not be allowed. It is possible
3719// to link the message field later, at which point it will no longer be treated
3720// as unknown. However there is no synchronization for this operation, which
3721// means parallel mutation requires external synchronization.
3722// Returns success/failure.
3723UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table,
3724 upb_MiniTableField* field,
3725 const upb_MiniTable* sub);
3726
3727// Links an enum field to a MiniTable for that enum.
3728// All enum fields must be linked prior to parsing.
3729// Returns success/failure.
3730UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table,
3731 upb_MiniTableField* field,
3732 const upb_MiniTableEnum* sub);
3733
3734// Returns a list of fields that require linking at runtime, to connect the
3735// MiniTable to its sub-messages and sub-enums. The list of fields will be
3736// written to the `subs` array, which must have been allocated by the caller
3737// and must be large enough to hold a list of all fields in the message.
3738//
3739// The order of the fields returned by this function is significant: it matches
3740// the order expected by upb_MiniTable_Link() below.
3741//
3742// The return value packs the sub-message count and sub-enum count into a single
3743// integer like so:
3744// return (msg_count << 16) | enum_count;
3745UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt,
3746 const upb_MiniTableField** subs);
3747
3748// Links a message to its sub-messages and sub-enums. The caller must pass
3749// arrays of sub-tables and sub-enums, in the same length and order as is
3750// returned by upb_MiniTable_GetSubList() above. However, individual elements
3751// of the sub_tables may be NULL if those sub-messages were tree shaken.
3752//
3753// Returns false if either array is too short, or if any of the tables fails
3754// to link.
3755UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt,
3756 const upb_MiniTable** sub_tables,
3757 size_t sub_table_count,
3758 const upb_MiniTableEnum** sub_enums,
3759 size_t sub_enum_count);
3760
3761#ifdef __cplusplus
3762} /* extern "C" */
3763#endif
3764
3765
3766#endif // UPB_MINI_DESCRIPTOR_LINK_H_
3767// IWYU pragma: end_exports
3768
3769// Must be last.
3770
3771typedef enum {
3772 kUpb_MiniTablePlatform_32Bit,
3773 kUpb_MiniTablePlatform_64Bit,
3774 kUpb_MiniTablePlatform_Native =
3775 UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit),
3776} upb_MiniTablePlatform;
3777
3778#ifdef __cplusplus
3779extern "C" {
3780#endif
3781
3782// Builds a mini table from the data encoded in the buffer [data, len]. If any
3783// errors occur, returns NULL and sets a status message. In the success case,
3784// the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum
3785// fields to link the table to the appropriate sub-tables.
3786upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len,
3787 upb_MiniTablePlatform platform,
3788 upb_Arena* arena, upb_Status* status);
3789
3790UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len,
3791 upb_Arena* arena,
3792 upb_Status* status) {
3793 return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena,
3794 status);
3795}
3796
3797// Initializes a MiniTableExtension buffer that has already been allocated.
3798// This is needed by upb_FileDef and upb_MessageDef, which allocate all of the
3799// extensions together in a single contiguous array.
3800const char* _upb_MiniTableExtension_Init(const char* data, size_t len,
3801 upb_MiniTableExtension* ext,
3802 const upb_MiniTable* extendee,
3803 upb_MiniTableSub sub,
3804 upb_MiniTablePlatform platform,
3805 upb_Status* status);
3806
3807UPB_API_INLINE const char* upb_MiniTableExtension_Init(
3808 const char* data, size_t len, upb_MiniTableExtension* ext,
3809 const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) {
3810 return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub,
3811 kUpb_MiniTablePlatform_Native, status);
3812}
3813
3814UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build(
3815 const char* data, size_t len, const upb_MiniTable* extendee,
3816 upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena,
3817 upb_Status* status);
3818
3819UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
3820 const char* data, size_t len, const upb_MiniTable* extendee,
3821 upb_Arena* arena, upb_Status* status) {
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003822 upb_MiniTableSub sub = upb_MiniTableSub_FromMessage(NULL);
Mike Kruskal9d435022023-07-11 12:45:07 -07003823 return _upb_MiniTableExtension_Build(
3824 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3825}
3826
3827UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
3828 const char* data, size_t len, const upb_MiniTable* extendee,
3829 upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) {
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003830 upb_MiniTableSub sub = upb_MiniTableSub_FromMessage(submsg);
Mike Kruskal9d435022023-07-11 12:45:07 -07003831 return _upb_MiniTableExtension_Build(
3832 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3833}
3834
3835UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum(
3836 const char* data, size_t len, const upb_MiniTable* extendee,
3837 upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) {
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003838 upb_MiniTableSub sub = upb_MiniTableSub_FromEnum(subenum);
Mike Kruskal9d435022023-07-11 12:45:07 -07003839 return _upb_MiniTableExtension_Build(
3840 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3841}
3842
3843// Like upb_MiniTable_Build(), but the user provides a buffer of layout data so
3844// it can be reused from call to call, avoiding repeated realloc()/free().
3845//
3846// The caller owns `*buf` both before and after the call, and must free() it
3847// when it is no longer in use. The function will realloc() `*buf` as
3848// necessary, updating `*size` accordingly.
3849upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
3850 upb_MiniTablePlatform platform,
3851 upb_Arena* arena, void** buf,
3852 size_t* buf_size, upb_Status* status);
3853
3854#ifdef __cplusplus
3855} /* extern "C" */
3856#endif
3857
3858
3859#endif /* UPB_MINI_TABLE_DECODE_H_ */
3860
Protobuf Team Bot4eeaa222023-12-04 05:00:05 +00003861#ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
3862#define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
3863
3864
3865// Must be last.
3866
3867#ifdef __cplusplus
3868extern "C" {
3869#endif
3870
3871/* Extension registry: a dynamic data structure that stores a map of:
3872 * (upb_MiniTable, number) -> extension info
3873 *
3874 * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing
3875 * binary format.
3876 *
3877 * upb_ExtensionRegistry is part of the mini-table (msglayout) family of
3878 * objects. Like all mini-table objects, it is suitable for reflection-less
3879 * builds that do not want to expose names into the binary.
3880 *
3881 * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory
3882 * allocation and dynamic initialization:
3883 * * If reflection is being used, then upb_DefPool will construct an appropriate
3884 * upb_ExtensionRegistry automatically.
3885 * * For a mini-table only build, the user must manually construct the
3886 * upb_ExtensionRegistry and populate it with all of the extensions the user
3887 * cares about.
3888 * * A third alternative is to manually unpack relevant extensions after the
3889 * main parse is complete, similar to how Any works. This is perhaps the
3890 * nicest solution from the perspective of reducing dependencies, avoiding
3891 * dynamic memory allocation, and avoiding the need to parse uninteresting
3892 * extensions. The downsides are:
3893 * (1) parse errors are not caught during the main parse
3894 * (2) the CPU hit of parsing comes during access, which could cause an
3895 * undesirable stutter in application performance.
3896 *
3897 * Users cannot directly get or put into this map. Users can only add the
3898 * extensions from a generated module and pass the extension registry to the
3899 * binary decoder.
3900 *
3901 * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use
3902 * reflection do not need to populate a upb_ExtensionRegistry directly.
3903 */
3904
3905typedef struct upb_ExtensionRegistry upb_ExtensionRegistry;
3906
3907// Creates a upb_ExtensionRegistry in the given arena.
3908// The arena must outlive any use of the extreg.
3909UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena);
3910
3911UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r,
3912 const upb_MiniTableExtension* e);
3913
3914// Adds the given extension info for the array |e| of size |count| into the
3915// registry. If there are any errors, the entire array is backed out.
3916// The extensions must outlive the registry.
3917// Possible errors include OOM or an extension number that already exists.
3918// TODO: There is currently no way to know the exact reason for failure.
3919bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r,
3920 const upb_MiniTableExtension** e,
3921 size_t count);
3922
3923// Looks up the extension (if any) defined for message type |t| and field
3924// number |num|. Returns the extension if found, otherwise NULL.
3925UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
3926 const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num);
3927
3928#ifdef __cplusplus
3929} /* extern "C" */
3930#endif
3931
3932
3933#endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */
3934
Mike Kruskal9d435022023-07-11 12:45:07 -07003935#ifndef UPB_MINI_TABLE_FILE_H_
3936#define UPB_MINI_TABLE_FILE_H_
3937
3938
3939#ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_
3940#define UPB_MINI_TABLE_INTERNAL_FILE_H_
3941
Mike Kruskal9d435022023-07-11 12:45:07 -07003942// Must be last.
3943
3944struct upb_MiniTableFile {
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003945 const struct upb_MiniTable** UPB_PRIVATE(msgs);
3946 const struct upb_MiniTableEnum** UPB_PRIVATE(enums);
3947 const struct upb_MiniTableExtension** UPB_PRIVATE(exts);
Protobuf Team Botff422002023-11-28 17:31:45 +00003948 int UPB_PRIVATE(msg_count);
3949 int UPB_PRIVATE(enum_count);
3950 int UPB_PRIVATE(ext_count);
Mike Kruskal9d435022023-07-11 12:45:07 -07003951};
3952
Protobuf Team Botff422002023-11-28 17:31:45 +00003953#ifdef __cplusplus
3954extern "C" {
3955#endif
3956
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003957UPB_API_INLINE int upb_MiniTableFile_EnumCount(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003958 const struct upb_MiniTableFile* f) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003959 return f->UPB_PRIVATE(enum_count);
3960}
3961
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003962UPB_API_INLINE int upb_MiniTableFile_ExtensionCount(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003963 const struct upb_MiniTableFile* f) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003964 return f->UPB_PRIVATE(ext_count);
3965}
3966
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003967UPB_API_INLINE int upb_MiniTableFile_MessageCount(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003968 const struct upb_MiniTableFile* f) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003969 return f->UPB_PRIVATE(msg_count);
3970}
3971
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003972UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableFile_Enum(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003973 const struct upb_MiniTableFile* f, int i) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003974 UPB_ASSERT(i < f->UPB_PRIVATE(enum_count));
3975 return f->UPB_PRIVATE(enums)[i];
3976}
3977
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003978UPB_API_INLINE const struct upb_MiniTableExtension* upb_MiniTableFile_Extension(
3979 const struct upb_MiniTableFile* f, int i) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003980 UPB_ASSERT(i < f->UPB_PRIVATE(ext_count));
3981 return f->UPB_PRIVATE(exts)[i];
3982}
3983
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003984UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableFile_Message(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003985 const struct upb_MiniTableFile* f, int i) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003986 UPB_ASSERT(i < f->UPB_PRIVATE(msg_count));
3987 return f->UPB_PRIVATE(msgs)[i];
3988}
3989
3990#ifdef __cplusplus
3991} /* extern "C" */
3992#endif
3993
Mike Kruskal9d435022023-07-11 12:45:07 -07003994
3995#endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */
3996
Protobuf Team Botff422002023-11-28 17:31:45 +00003997// Must be last.
3998
Protobuf Team Bot9b4aff22023-12-27 21:35:01 +00003999typedef struct upb_MiniTableFile upb_MiniTableFile;
4000
Protobuf Team Botff422002023-11-28 17:31:45 +00004001#ifdef __cplusplus
4002extern "C" {
4003#endif
4004
Protobuf Team Bot1db94652023-12-20 02:08:18 +00004005UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTableFile_Enum(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00004006 const upb_MiniTableFile* f, int i);
Protobuf Team Botff422002023-11-28 17:31:45 +00004007
Protobuf Team Botb3878b52024-02-08 21:50:53 +00004008UPB_API_INLINE int upb_MiniTableFile_EnumCount(const upb_MiniTableFile* f);
Protobuf Team Botff422002023-11-28 17:31:45 +00004009
Protobuf Team Bot1db94652023-12-20 02:08:18 +00004010UPB_API_INLINE const upb_MiniTableExtension* upb_MiniTableFile_Extension(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00004011 const upb_MiniTableFile* f, int i);
Protobuf Team Botff422002023-11-28 17:31:45 +00004012
Protobuf Team Botb3878b52024-02-08 21:50:53 +00004013UPB_API_INLINE int upb_MiniTableFile_ExtensionCount(const upb_MiniTableFile* f);
Protobuf Team Botff422002023-11-28 17:31:45 +00004014
Protobuf Team Bot1db94652023-12-20 02:08:18 +00004015UPB_API_INLINE const upb_MiniTable* upb_MiniTableFile_Message(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00004016 const upb_MiniTableFile* f, int i);
Protobuf Team Botff422002023-11-28 17:31:45 +00004017
Protobuf Team Botb3878b52024-02-08 21:50:53 +00004018UPB_API_INLINE int upb_MiniTableFile_MessageCount(const upb_MiniTableFile* f);
Protobuf Team Botff422002023-11-28 17:31:45 +00004019
4020#ifdef __cplusplus
4021} /* extern "C" */
4022#endif
4023
4024
Mike Kruskal9d435022023-07-11 12:45:07 -07004025#endif /* UPB_MINI_TABLE_FILE_H_ */
4026
Mike Kruskal9cf9db82022-11-04 21:22:31 -07004027// upb_decode: parsing into a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004028
Mike Kruskal9cf9db82022-11-04 21:22:31 -07004029#ifndef UPB_WIRE_DECODE_H_
4030#define UPB_WIRE_DECODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004031
Protobuf Team Bot743bf922023-09-14 01:12:11 +00004032#include <stddef.h>
4033#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004034
Adam Cozzette7d5592e2023-08-23 12:15:26 -07004035
Joshua Habermand3995ec2022-09-30 16:54:39 -07004036// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004037
4038#ifdef __cplusplus
4039extern "C" {
4040#endif
4041
4042enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004043 /* If set, strings will alias the input buffer instead of copying into the
4044 * arena. */
4045 kUpb_DecodeOption_AliasString = 1,
4046
4047 /* If set, the parse will return failure if any message is missing any
4048 * required fields when the message data ends. The parse will still continue,
4049 * and the failure will only be reported at the end.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004050 *
Joshua Habermand3995ec2022-09-30 16:54:39 -07004051 * IMPORTANT CAVEATS:
4052 *
4053 * 1. This can throw a false positive failure if an incomplete message is seen
4054 * on the wire but is later completed when the sub-message occurs again.
4055 * For this reason, a second pass is required to verify a failure, to be
4056 * truly robust.
4057 *
4058 * 2. This can return a false success if you are decoding into a message that
4059 * already has some sub-message fields present. If the sub-message does
4060 * not occur in the binary payload, we will never visit it and discover the
4061 * incomplete sub-message. For this reason, this check is only useful for
4062 * implemting ParseFromString() semantics. For MergeFromString(), a
4063 * post-parse validation step will always be necessary. */
4064 kUpb_DecodeOption_CheckRequired = 2,
Jie Luo3560e232023-06-12 00:33:50 -07004065
4066 /* EXPERIMENTAL:
4067 *
4068 * If set, the parser will allow parsing of sub-message fields that were not
4069 * previously linked using upb_MiniTable_SetSubMessage(). The data will be
4070 * parsed into an internal "empty" message type that cannot be accessed
4071 * directly, but can be later promoted into the true message type if the
4072 * sub-message fields are linked at a later time.
4073 *
4074 * Users should set this option if they intend to perform dynamic tree shaking
4075 * and promoting using the interfaces in message/promote.h. If this option is
4076 * enabled, it is important that the resulting messages are only accessed by
4077 * code that is aware of promotion rules:
4078 *
4079 * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented
4080 * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether
4081 * the message uses the internal "empty" type.
4082 *
4083 * 2. Any code *reading* these message pointers must test whether the "empty"
4084 * tag bit is set, using the interfaces in mini_table/types.h. However
4085 * writing of message pointers should always use plain upb_Message*, since
4086 * users are not allowed to create "empty" messages.
4087 *
4088 * 3. It is always safe to test whether a field is present or test the array
4089 * length; these interfaces will reflect that empty messages are present,
4090 * even though their data cannot be accessed without promoting first.
4091 *
4092 * 4. If a message pointer is indeed tagged as empty, the message may not be
4093 * accessed directly, only promoted through the interfaces in
4094 * message/promote.h.
4095 *
4096 * 5. Tagged/empty messages may never be created by the user. They may only
4097 * be created by the parser or the message-copying logic in message/copy.h.
4098 */
4099 kUpb_DecodeOption_ExperimentalAllowUnlinked = 4,
Protobuf Team Bot1610bf12024-01-10 21:45:42 +00004100
4101 /* EXPERIMENTAL:
4102 *
4103 * If set, decoding will enforce UTF-8 validation for string fields, even for
4104 * proto2 or fields with `features.utf8_validation = NONE`. Normally, only
4105 * proto3 string fields will be validated for UTF-8. Decoding will return
4106 * kUpb_DecodeStatus_BadUtf8 for non-UTF-8 strings, which is the same behavior
4107 * as non-UTF-8 proto3 string fields.
4108 */
4109 kUpb_DecodeOption_AlwaysValidateUtf8 = 8,
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004110};
4111
Deanna Garciac7d979d2023-04-14 17:22:13 -07004112UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) {
4113 return (uint32_t)depth << 16;
4114}
4115
4116UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) {
4117 return options >> 16;
4118}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004119
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07004120// Enforce an upper bound on recursion depth.
4121UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) {
Deanna Garciac7d979d2023-04-14 17:22:13 -07004122 uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07004123 if (max_depth > limit) max_depth = limit;
Deanna Garciac7d979d2023-04-14 17:22:13 -07004124 return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07004125}
4126
Joshua Habermand3995ec2022-09-30 16:54:39 -07004127typedef enum {
4128 kUpb_DecodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07004129 kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
4130 kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed
4131 kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8
4132 kUpb_DecodeStatus_MaxDepthExceeded =
4133 4, // Exceeded upb_DecodeOptions_MaxDepth
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004134
Joshua Habermand3995ec2022-09-30 16:54:39 -07004135 // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise
4136 // succeeded.
4137 kUpb_DecodeStatus_MissingRequired = 5,
Jie Luo3560e232023-06-12 00:33:50 -07004138
4139 // Unlinked sub-message field was present, but
4140 // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list
4141 // of options.
4142 kUpb_DecodeStatus_UnlinkedSubMessage = 6,
Joshua Habermand3995ec2022-09-30 16:54:39 -07004143} upb_DecodeStatus;
4144
Eric Salo10505992022-12-12 12:16:36 -08004145UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size,
Protobuf Team Botd86fe392024-04-03 14:19:48 +00004146 upb_Message* msg, const upb_MiniTable* mt,
Eric Salo10505992022-12-12 12:16:36 -08004147 const upb_ExtensionRegistry* extreg,
4148 int options, upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004149
Protobuf Team Botd86fe392024-04-03 14:19:48 +00004150// Same as upb_Decode but with a varint-encoded length prepended.
4151// On success 'num_bytes_read' will be set to the how many bytes were read,
4152// on failure the contents of num_bytes_read is undefined.
Protobuf Team Botb9bde6a2024-04-03 19:25:27 +00004153UPB_API upb_DecodeStatus upb_DecodeLengthPrefixed(
Protobuf Team Botd86fe392024-04-03 14:19:48 +00004154 const char* buf, size_t size, upb_Message* msg, size_t* num_bytes_read,
4155 const upb_MiniTable* mt, const upb_ExtensionRegistry* extreg, int options,
4156 upb_Arena* arena);
4157
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004158#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08004159} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004160#endif
4161
Joshua Habermandd69a482021-05-17 22:40:33 -07004162
Mike Kruskal9cf9db82022-11-04 21:22:31 -07004163#endif /* UPB_WIRE_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07004164
Protobuf Team Botda56def2023-12-26 19:08:52 +00004165// upb_Encode: parsing from a upb_Message using a upb_MiniTable.
4166
4167#ifndef UPB_WIRE_ENCODE_H_
4168#define UPB_WIRE_ENCODE_H_
4169
4170#include <stddef.h>
4171#include <stdint.h>
4172
4173
4174// Must be last.
4175
4176#ifdef __cplusplus
4177extern "C" {
4178#endif
4179
4180enum {
4181 /* If set, the results of serializing will be deterministic across all
4182 * instances of this binary. There are no guarantees across different
4183 * binary builds.
4184 *
4185 * If your proto contains maps, the encoder will need to malloc()/free()
4186 * memory during encode. */
4187 kUpb_EncodeOption_Deterministic = 1,
4188
4189 // When set, unknown fields are not printed.
4190 kUpb_EncodeOption_SkipUnknown = 2,
4191
4192 // When set, the encode will fail if any required fields are missing.
4193 kUpb_EncodeOption_CheckRequired = 4,
4194};
4195
4196typedef enum {
4197 kUpb_EncodeStatus_Ok = 0,
4198 kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
4199 kUpb_EncodeStatus_MaxDepthExceeded = 2,
4200
4201 // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
4202 kUpb_EncodeStatus_MissingRequired = 3,
4203} upb_EncodeStatus;
4204
4205UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
4206 return (uint32_t)depth << 16;
4207}
4208
4209UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) {
4210 return options >> 16;
4211}
4212
4213// Enforce an upper bound on recursion depth.
4214UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) {
4215 uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options);
4216 if (max_depth > limit) max_depth = limit;
4217 return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff);
4218}
4219
4220UPB_API upb_EncodeStatus upb_Encode(const upb_Message* msg,
4221 const upb_MiniTable* l, int options,
4222 upb_Arena* arena, char** buf, size_t* size);
4223
Protobuf Team Botd86fe392024-04-03 14:19:48 +00004224// Encodes the message prepended by a varint of the serialized length.
Protobuf Team Botb9bde6a2024-04-03 19:25:27 +00004225UPB_API upb_EncodeStatus upb_EncodeLengthPrefixed(const upb_Message* msg,
4226 const upb_MiniTable* l,
4227 int options, upb_Arena* arena,
4228 char** buf, size_t* size);
Protobuf Team Botd86fe392024-04-03 14:19:48 +00004229
Protobuf Team Botda56def2023-12-26 19:08:52 +00004230#ifdef __cplusplus
4231} /* extern "C" */
4232#endif
4233
4234
4235#endif /* UPB_WIRE_ENCODE_H_ */
4236
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004237// These are the specialized field parser functions for the fast parser.
4238// Generated tables will refer to these by name.
4239//
4240// The function names are encoded with names like:
4241//
4242// // 123 4
4243// upb_pss_1bt(); // Parse singular string, 1 byte tag.
4244//
4245// In position 1:
4246// - 'p' for parse, most function use this
4247// - 'c' for copy, for when we are copying strings instead of aliasing
4248//
4249// In position 2 (cardinality):
4250// - 's' for singular, with or without hasbit
4251// - 'o' for oneof
4252// - 'r' for non-packed repeated
4253// - 'p' for packed repeated
4254//
4255// In position 3 (type):
4256// - 'b1' for bool
4257// - 'v4' for 4-byte varint
4258// - 'v8' for 8-byte varint
4259// - 'z4' for zig-zag-encoded 4-byte varint
4260// - 'z8' for zig-zag-encoded 8-byte varint
4261// - 'f4' for 4-byte fixed
4262// - 'f8' for 8-byte fixed
4263// - 'm' for sub-message
4264// - 's' for string (validate UTF-8)
4265// - 'b' for bytes
4266//
4267// In position 4 (tag length):
4268// - '1' for one-byte tags (field numbers 1-15)
4269// - '2' for two-byte tags (field numbers 16-2048)
4270
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004271#ifndef UPB_WIRE_INTERNAL_DECODE_FAST_H_
4272#define UPB_WIRE_INTERNAL_DECODE_FAST_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004273
4274
Joshua Habermand3995ec2022-09-30 16:54:39 -07004275// Must be last.
4276
4277#ifdef __cplusplus
4278extern "C" {
4279#endif
4280
Joshua Habermanf41049a2022-01-21 14:41:25 -08004281struct upb_Decoder;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004282
4283// The fallback, generic parsing function that can handle any field type.
4284// This just uses the regular (non-fast) parser to parse a single field.
Joshua Habermand3995ec2022-09-30 16:54:39 -07004285const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d,
4286 const char* ptr, upb_Message* msg,
4287 intptr_t table, uint64_t hasbits,
4288 uint64_t data);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004289
Joshua Habermanf41049a2022-01-21 14:41:25 -08004290#define UPB_PARSE_PARAMS \
4291 struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004292 uint64_t hasbits, uint64_t data
4293
4294/* primitive fields ***********************************************************/
4295
4296#define F(card, type, valbytes, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004297 const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004298
4299#define TYPES(card, tagbytes) \
4300 F(card, b, 1, tagbytes) \
4301 F(card, v, 4, tagbytes) \
4302 F(card, v, 8, tagbytes) \
4303 F(card, z, 4, tagbytes) \
4304 F(card, z, 8, tagbytes) \
4305 F(card, f, 4, tagbytes) \
4306 F(card, f, 8, tagbytes)
4307
4308#define TAGBYTES(card) \
4309 TYPES(card, 1) \
4310 TYPES(card, 2)
4311
4312TAGBYTES(s)
4313TAGBYTES(o)
4314TAGBYTES(r)
4315TAGBYTES(p)
4316
4317#undef F
4318#undef TYPES
4319#undef TAGBYTES
4320
4321/* string fields **************************************************************/
4322
4323#define F(card, tagbytes, type) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004324 const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
4325 const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004326
4327#define UTF8(card, tagbytes) \
4328 F(card, tagbytes, s) \
4329 F(card, tagbytes, b)
4330
4331#define TAGBYTES(card) \
4332 UTF8(card, 1) \
4333 UTF8(card, 2)
4334
4335TAGBYTES(s)
4336TAGBYTES(o)
4337TAGBYTES(r)
4338
4339#undef F
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004340#undef UTF8
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004341#undef TAGBYTES
4342
4343/* sub-message fields *********************************************************/
4344
4345#define F(card, tagbytes, size_ceil, ceil_arg) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004346 const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004347
4348#define SIZES(card, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004349 F(card, tagbytes, 64, 64) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004350 F(card, tagbytes, 128, 128) \
4351 F(card, tagbytes, 192, 192) \
4352 F(card, tagbytes, 256, 256) \
4353 F(card, tagbytes, max, -1)
4354
4355#define TAGBYTES(card) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004356 SIZES(card, 1) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004357 SIZES(card, 2)
4358
4359TAGBYTES(s)
4360TAGBYTES(o)
4361TAGBYTES(r)
4362
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004363#undef F
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004364#undef SIZES
4365#undef TAGBYTES
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004366
4367#undef UPB_PARSE_PARAMS
4368
Joshua Habermand3995ec2022-09-30 16:54:39 -07004369#ifdef __cplusplus
4370} /* extern "C" */
4371#endif
4372
4373
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004374#endif /* UPB_WIRE_INTERNAL_DECODE_FAST_H_ */
Mike Kruskal9d435022023-07-11 12:45:07 -07004375// IWYU pragma: end_exports
4376
4377#endif // UPB_GENERATED_CODE_SUPPORT_H_
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00004378/* This file was generated by upb_generator from the input file:
Mike Kruskal9d435022023-07-11 12:45:07 -07004379 *
4380 * google/protobuf/descriptor.proto
4381 *
4382 * Do not edit -- your changes will be discarded when the file is
4383 * regenerated. */
4384
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004385#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
4386#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
4387
4388
4389// Must be last.
4390
4391#ifdef __cplusplus
4392extern "C" {
4393#endif
4394
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004395extern const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init;
4396extern const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init;
4397extern const upb_MiniTable google__protobuf__DescriptorProto_msg_init;
4398extern const upb_MiniTable google__protobuf__DescriptorProto__ExtensionRange_msg_init;
4399extern const upb_MiniTable google__protobuf__DescriptorProto__ReservedRange_msg_init;
4400extern const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init;
4401extern const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init;
4402extern const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init;
4403extern const upb_MiniTable google__protobuf__OneofDescriptorProto_msg_init;
4404extern const upb_MiniTable google__protobuf__EnumDescriptorProto_msg_init;
4405extern const upb_MiniTable google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init;
4406extern const upb_MiniTable google__protobuf__EnumValueDescriptorProto_msg_init;
4407extern const upb_MiniTable google__protobuf__ServiceDescriptorProto_msg_init;
4408extern const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init;
4409extern const upb_MiniTable google__protobuf__FileOptions_msg_init;
4410extern const upb_MiniTable google__protobuf__MessageOptions_msg_init;
4411extern const upb_MiniTable google__protobuf__FieldOptions_msg_init;
4412extern const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00004413extern const upb_MiniTable google__protobuf__FieldOptions__FeatureSupport_msg_init;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004414extern const upb_MiniTable google__protobuf__OneofOptions_msg_init;
4415extern const upb_MiniTable google__protobuf__EnumOptions_msg_init;
4416extern const upb_MiniTable google__protobuf__EnumValueOptions_msg_init;
4417extern const upb_MiniTable google__protobuf__ServiceOptions_msg_init;
4418extern const upb_MiniTable google__protobuf__MethodOptions_msg_init;
4419extern const upb_MiniTable google__protobuf__UninterpretedOption_msg_init;
4420extern const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init;
4421extern const upb_MiniTable google__protobuf__FeatureSet_msg_init;
4422extern const upb_MiniTable google__protobuf__FeatureSetDefaults_msg_init;
4423extern const upb_MiniTable google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init;
4424extern const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init;
4425extern const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init;
4426extern const upb_MiniTable google__protobuf__GeneratedCodeInfo_msg_init;
4427extern const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004428
4429extern const upb_MiniTableEnum google_protobuf_Edition_enum_init;
4430extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init;
4431extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init;
4432extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init;
4433extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init;
4434extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init;
4435extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init;
Protobuf Team Bot61127952023-09-26 20:07:33 +00004436extern const upb_MiniTableEnum google_protobuf_FeatureSet_Utf8Validation_enum_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004437extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init;
4438extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init;
4439extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init;
4440extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init;
4441extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init;
4442extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init;
4443extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init;
4444extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init;
4445extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init;
4446extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout;
4447
4448#ifdef __cplusplus
4449} /* extern "C" */
4450#endif
4451
4452
4453#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */
4454
4455#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4456#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4457
4458#include <string.h>
4459
4460
4461// Must be last.
4462
4463#ifdef __cplusplus
4464extern "C" {
4465#endif
4466
4467// The maximum number of bytes a single protobuf field can take up in the
4468// wire format. We only want to do one bounds check per field, so the input
4469// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called,
4470// the decoder can read this many bytes without performing another bounds
4471// check. The stream will copy into a patch buffer as necessary to guarantee
4472// this invariant.
4473#define kUpb_EpsCopyInputStream_SlopBytes 16
4474
4475enum {
4476 kUpb_EpsCopyInputStream_NoAliasing = 0,
4477 kUpb_EpsCopyInputStream_OnPatch = 1,
4478 kUpb_EpsCopyInputStream_NoDelta = 2
4479};
4480
4481typedef struct {
4482 const char* end; // Can read up to SlopBytes bytes beyond this.
4483 const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0)
4484 uintptr_t aliasing;
Protobuf Team Bot1d143b52024-01-25 20:29:43 +00004485 int limit; // Submessage limit relative to end
4486 bool error; // To distinguish between EOF and error.
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004487 char patch[kUpb_EpsCopyInputStream_SlopBytes * 2];
4488} upb_EpsCopyInputStream;
4489
4490// Returns true if the stream is in the error state. A stream enters the error
4491// state when the user reads past a limit (caught in IsDone()) or the
4492// ZeroCopyInputStream returns an error.
4493UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) {
4494 return e->error;
4495}
4496
4497typedef const char* upb_EpsCopyInputStream_BufferFlipCallback(
4498 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start);
4499
4500typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc(
4501 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
4502
4503// Initializes a upb_EpsCopyInputStream using the contents of the buffer
4504// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least
4505// kUpb_EpsCopyInputStream_SlopBytes are available to read.
4506UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e,
4507 const char** ptr, size_t size,
4508 bool enable_aliasing) {
4509 if (size <= kUpb_EpsCopyInputStream_SlopBytes) {
4510 memset(&e->patch, 0, 32);
4511 if (size) memcpy(&e->patch, *ptr, size);
4512 e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch
4513 : kUpb_EpsCopyInputStream_NoAliasing;
4514 *ptr = e->patch;
4515 e->end = *ptr + size;
4516 e->limit = 0;
4517 } else {
4518 e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes;
4519 e->limit = kUpb_EpsCopyInputStream_SlopBytes;
4520 e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta
4521 : kUpb_EpsCopyInputStream_NoAliasing;
4522 }
4523 e->limit_ptr = e->end;
4524 e->error = false;
4525}
4526
4527typedef enum {
4528 // The current stream position is at a limit.
4529 kUpb_IsDoneStatus_Done,
4530
4531 // The current stream position is not at a limit.
4532 kUpb_IsDoneStatus_NotDone,
4533
4534 // The current stream position is not at a limit, and the stream needs to
4535 // be flipped to a new buffer before more data can be read.
4536 kUpb_IsDoneStatus_NeedFallback,
4537} upb_IsDoneStatus;
4538
4539// Returns the status of the current stream position. This is a low-level
4540// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible.
4541UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus(
4542 upb_EpsCopyInputStream* e, const char* ptr, int* overrun) {
4543 *overrun = ptr - e->end;
4544 if (UPB_LIKELY(ptr < e->limit_ptr)) {
4545 return kUpb_IsDoneStatus_NotDone;
4546 } else if (UPB_LIKELY(*overrun == e->limit)) {
4547 return kUpb_IsDoneStatus_Done;
4548 } else {
4549 return kUpb_IsDoneStatus_NeedFallback;
4550 }
4551}
4552
4553// Returns true if the stream has hit a limit, either the current delimited
4554// limit or the overall end-of-stream. As a side effect, this function may flip
4555// the pointer to a new buffer if there are less than
4556// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer.
4557//
4558// Postcondition: if the function returns false, there are at least
4559// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr.
4560UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback(
4561 upb_EpsCopyInputStream* e, const char** ptr,
4562 upb_EpsCopyInputStream_IsDoneFallbackFunc* func) {
4563 int overrun;
4564 switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) {
4565 case kUpb_IsDoneStatus_Done:
4566 return true;
4567 case kUpb_IsDoneStatus_NotDone:
4568 return false;
4569 case kUpb_IsDoneStatus_NeedFallback:
4570 *ptr = func(e, *ptr, overrun);
4571 return *ptr == NULL;
4572 }
4573 UPB_UNREACHABLE();
4574}
4575
4576const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback(
4577 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
4578
4579// A simpler version of IsDoneWithCallback() that does not support a buffer flip
4580// callback. Useful in cases where we do not need to insert custom logic at
4581// every buffer flip.
4582//
4583// If this returns true, the user must call upb_EpsCopyInputStream_IsError()
4584// to distinguish between EOF and error.
4585UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e,
4586 const char** ptr) {
4587 return upb_EpsCopyInputStream_IsDoneWithCallback(
4588 e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback);
4589}
4590
4591// Returns the total number of bytes that are safe to read from the current
4592// buffer without reading uninitialized or unallocated memory.
4593//
4594// Note that this check does not respect any semantic limits on the stream,
4595// either limits from PushLimit() or the overall stream end, so some of these
4596// bytes may have unpredictable, nonsense values in them. The guarantee is only
4597// that the bytes are valid to read from the perspective of the C language
4598// (ie. you can read without triggering UBSAN or ASAN).
4599UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable(
4600 upb_EpsCopyInputStream* e, const char* ptr) {
4601 return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes;
4602}
4603
4604// Returns true if the given delimited field size is valid (it does not extend
4605// beyond any previously-pushed limits). `ptr` should point to the beginning
4606// of the field data, after the delimited size.
4607//
4608// Note that this does *not* guarantee that all of the data for this field is in
4609// the current buffer.
4610UPB_INLINE bool upb_EpsCopyInputStream_CheckSize(
4611 const upb_EpsCopyInputStream* e, const char* ptr, int size) {
4612 UPB_ASSERT(size >= 0);
4613 return ptr - e->end + size <= e->limit;
4614}
4615
4616UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable(
4617 upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) {
4618 // This is one extra branch compared to the more normal:
4619 // return (size_t)(end - ptr) < size;
4620 // However it is one less computation if we are just about to use "ptr + len":
4621 // https://godbolt.org/z/35YGPz
4622 // In microbenchmarks this shows a small improvement.
4623 uintptr_t uptr = (uintptr_t)ptr;
4624 uintptr_t uend = (uintptr_t)e->limit_ptr;
4625 uintptr_t res = uptr + (size_t)size;
4626 if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes;
4627 // NOTE: this check depends on having a linear address space. This is not
4628 // technically guaranteed by uintptr_t.
4629 bool ret = res >= uptr && res <= uend;
4630 if (size < 0) UPB_ASSERT(!ret);
4631 return ret;
4632}
4633
4634// Returns true if the given delimited field size is valid (it does not extend
4635// beyond any previously-pushed limited) *and* all of the data for this field is
4636// available to be read in the current buffer.
4637//
4638// If the size is negative, this function will always return false. This
4639// property can be useful in some cases.
4640UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable(
4641 upb_EpsCopyInputStream* e, const char* ptr, int size) {
4642 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false);
4643}
4644
4645// Returns true if the given sub-message size is valid (it does not extend
4646// beyond any previously-pushed limited) *and* all of the data for this
4647// sub-message is available to be parsed in the current buffer.
4648//
4649// This implies that all fields from the sub-message can be parsed from the
4650// current buffer while maintaining the invariant that we always have at least
4651// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of
4652// any individual field start.
4653//
4654// If the size is negative, this function will always return false. This
4655// property can be useful in some cases.
4656UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(
4657 upb_EpsCopyInputStream* e, const char* ptr, int size) {
4658 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true);
4659}
4660
4661// Returns true if aliasing_enabled=true was passed to
4662// upb_EpsCopyInputStream_Init() when this stream was initialized.
4663UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled(
4664 upb_EpsCopyInputStream* e) {
4665 return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing;
4666}
4667
4668// Returns true if aliasing_enabled=true was passed to
4669// upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can
4670// alias into the region [ptr, size] in an input buffer.
4671UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable(
4672 upb_EpsCopyInputStream* e, const char* ptr, size_t size) {
4673 // When EpsCopyInputStream supports streaming, this will need to become a
4674 // runtime check.
4675 return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) &&
4676 e->aliasing >= kUpb_EpsCopyInputStream_NoDelta;
4677}
4678
4679// Returns a pointer into an input buffer that corresponds to the parsing
4680// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may
4681// be different if we are currently parsing out of the patch buffer.
4682//
4683// REQUIRES: Aliasing must be available for the given pointer. If the input is a
4684// flat buffer and aliasing is enabled, then aliasing will always be available.
4685UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr(
4686 upb_EpsCopyInputStream* e, const char* ptr) {
4687 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0));
4688 uintptr_t delta =
4689 e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing;
4690 return (const char*)((uintptr_t)ptr + delta);
4691}
4692
4693// Reads string data from the input, aliasing into the input buffer instead of
4694// copying. The parsing pointer is passed in `*ptr`, and will be updated if
4695// necessary to point to the actual input buffer. Returns the new parsing
4696// pointer, which will be advanced past the string data.
4697//
4698// REQUIRES: Aliasing must be available for this data region (test with
4699// upb_EpsCopyInputStream_AliasingAvailable().
4700UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased(
4701 upb_EpsCopyInputStream* e, const char** ptr, size_t size) {
4702 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size));
4703 const char* ret = *ptr + size;
4704 *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr);
4705 UPB_ASSUME(ret != NULL);
4706 return ret;
4707}
4708
4709// Skips `size` bytes of data from the input and returns a pointer past the end.
4710// Returns NULL on end of stream or error.
4711UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e,
4712 const char* ptr, int size) {
4713 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
4714 return ptr + size;
4715}
4716
4717// Copies `size` bytes of data from the input `ptr` into the buffer `to`, and
4718// returns a pointer past the end. Returns NULL on end of stream or error.
4719UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e,
4720 const char* ptr, void* to,
4721 int size) {
4722 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
4723 memcpy(to, ptr, size);
4724 return ptr + size;
4725}
4726
4727// Reads string data from the stream and advances the pointer accordingly.
4728// If aliasing was enabled when the stream was initialized, then the returned
4729// pointer will point into the input buffer if possible, otherwise new data
4730// will be allocated from arena and copied into. We may be forced to copy even
4731// if aliasing was enabled if the input data spans input buffers.
4732//
4733// Returns NULL if memory allocation failed, or we reached a premature EOF.
4734UPB_INLINE const char* upb_EpsCopyInputStream_ReadString(
4735 upb_EpsCopyInputStream* e, const char** ptr, size_t size,
4736 upb_Arena* arena) {
4737 if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) {
4738 return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size);
4739 } else {
4740 // We need to allocate and copy.
4741 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) {
4742 return NULL;
4743 }
4744 UPB_ASSERT(arena);
4745 char* data = (char*)upb_Arena_Malloc(arena, size);
4746 if (!data) return NULL;
4747 const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size);
4748 *ptr = data;
4749 return ret;
4750 }
4751}
4752
4753UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) {
4754 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4755}
4756
4757// Pushes a limit onto the stack of limits for the current stream. The limit
4758// will extend for `size` bytes beyond the position in `ptr`. Future calls to
4759// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position
4760// reaches this limit.
4761//
4762// Returns a delta that the caller must store and supply to PopLimit() below.
4763UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e,
4764 const char* ptr, int size) {
4765 int limit = size + (int)(ptr - e->end);
4766 int delta = e->limit - limit;
4767 _upb_EpsCopyInputStream_CheckLimit(e);
4768 UPB_ASSERT(limit <= e->limit);
4769 e->limit = limit;
4770 e->limit_ptr = e->end + UPB_MIN(0, limit);
4771 _upb_EpsCopyInputStream_CheckLimit(e);
4772 return delta;
4773}
4774
4775// Pops the last limit that was pushed on this stream. This may only be called
4776// once IsDone() returns true. The user must pass the delta that was returned
4777// from PushLimit().
4778UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e,
4779 const char* ptr,
4780 int saved_delta) {
4781 UPB_ASSERT(ptr - e->end == e->limit);
4782 _upb_EpsCopyInputStream_CheckLimit(e);
4783 e->limit += saved_delta;
4784 e->limit_ptr = e->end + UPB_MIN(0, e->limit);
4785 _upb_EpsCopyInputStream_CheckLimit(e);
4786}
4787
4788UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline(
4789 upb_EpsCopyInputStream* e, const char* ptr, int overrun,
4790 upb_EpsCopyInputStream_BufferFlipCallback* callback) {
4791 if (overrun < e->limit) {
4792 // Need to copy remaining data into patch buffer.
4793 UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes);
4794 const char* old_end = ptr;
4795 const char* new_start = &e->patch[0] + overrun;
4796 memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0,
4797 kUpb_EpsCopyInputStream_SlopBytes);
4798 memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes);
4799 ptr = new_start;
4800 e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes];
4801 e->limit -= kUpb_EpsCopyInputStream_SlopBytes;
4802 e->limit_ptr = e->end + e->limit;
4803 UPB_ASSERT(ptr < e->limit_ptr);
4804 if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) {
4805 e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start;
4806 }
4807 return callback(e, old_end, new_start);
4808 } else {
4809 UPB_ASSERT(overrun > e->limit);
4810 e->error = true;
4811 return callback(e, NULL, NULL);
4812 }
4813}
4814
4815typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc(
4816 upb_EpsCopyInputStream* e, const char* ptr, void* ctx);
4817
4818// Tries to perform a fast-path handling of the given delimited message data.
4819// If the sub-message beginning at `*ptr` and extending for `len` is short and
4820// fits within this buffer, calls `func` with `ctx` as a parameter, where the
4821// pushing and popping of limits is handled automatically and with lower cost
4822// than the normal PushLimit()/PopLimit() sequence.
Protobuf Team Bot1d143b52024-01-25 20:29:43 +00004823UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004824 upb_EpsCopyInputStream* e, const char** ptr, int len,
4825 upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
4826 if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) {
4827 return false;
4828 }
4829
4830 // Fast case: Sub-message is <128 bytes and fits in the current buffer.
4831 // This means we can preserve limit/limit_ptr verbatim.
4832 const char* saved_limit_ptr = e->limit_ptr;
4833 int saved_limit = e->limit;
4834 e->limit_ptr = *ptr + len;
4835 e->limit = e->limit_ptr - e->end;
4836 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4837 *ptr = func(e, *ptr, ctx);
4838 e->limit_ptr = saved_limit_ptr;
4839 e->limit = saved_limit;
4840 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4841 return true;
4842}
4843
4844#ifdef __cplusplus
4845} /* extern "C" */
4846#endif
4847
4848
4849#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4850
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004851#ifndef UPB_JSON_DECODE_H_
4852#define UPB_JSON_DECODE_H_
4853
4854
4855#ifndef UPB_REFLECTION_DEF_H_
4856#define UPB_REFLECTION_DEF_H_
4857
4858// IWYU pragma: begin_exports
4859
Protobuf Team Bot06310352023-09-26 21:54:58 +00004860// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004861
4862#ifndef UPB_REFLECTION_DEF_POOL_H_
4863#define UPB_REFLECTION_DEF_POOL_H_
4864
4865
Protobuf Team Bot06310352023-09-26 21:54:58 +00004866// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004867
4868// Declarations common to all public def types.
4869
4870#ifndef UPB_REFLECTION_COMMON_H_
4871#define UPB_REFLECTION_COMMON_H_
4872
4873// begin:google_only
4874// #ifndef UPB_BOOTSTRAP_STAGE0
4875// #include "net/proto2/proto/descriptor.upb.h"
4876// #else
4877// #include "google/protobuf/descriptor.upb.h"
4878// #endif
4879// end:google_only
4880
4881// begin:github_only
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00004882/* This file was generated by upb_generator from the input file:
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004883 *
4884 * google/protobuf/descriptor.proto
4885 *
4886 * Do not edit -- your changes will be discarded when the file is
4887 * regenerated. */
4888
Mike Kruskal9d435022023-07-11 12:45:07 -07004889#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
4890#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07004891
Protobuf Team Bot111d6552023-09-15 21:07:08 +00004892
4893
4894// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004895
4896#ifdef __cplusplus
4897extern "C" {
4898#endif
4899
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00004900typedef struct google_protobuf_FileDescriptorSet { upb_Message UPB_PRIVATE(base); } google_protobuf_FileDescriptorSet;
4901typedef struct google_protobuf_FileDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_FileDescriptorProto;
4902typedef struct google_protobuf_DescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto;
4903typedef struct google_protobuf_DescriptorProto_ExtensionRange { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto_ExtensionRange;
4904typedef struct google_protobuf_DescriptorProto_ReservedRange { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto_ReservedRange;
4905typedef struct google_protobuf_ExtensionRangeOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_ExtensionRangeOptions;
4906typedef struct google_protobuf_ExtensionRangeOptions_Declaration { upb_Message UPB_PRIVATE(base); } google_protobuf_ExtensionRangeOptions_Declaration;
4907typedef struct google_protobuf_FieldDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldDescriptorProto;
4908typedef struct google_protobuf_OneofDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_OneofDescriptorProto;
4909typedef struct google_protobuf_EnumDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumDescriptorProto;
4910typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumDescriptorProto_EnumReservedRange;
4911typedef struct google_protobuf_EnumValueDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumValueDescriptorProto;
4912typedef struct google_protobuf_ServiceDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_ServiceDescriptorProto;
4913typedef struct google_protobuf_MethodDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_MethodDescriptorProto;
4914typedef struct google_protobuf_FileOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_FileOptions;
4915typedef struct google_protobuf_MessageOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_MessageOptions;
4916typedef struct google_protobuf_FieldOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions;
4917typedef struct google_protobuf_FieldOptions_EditionDefault { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions_EditionDefault;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00004918typedef struct google_protobuf_FieldOptions_FeatureSupport { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions_FeatureSupport;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00004919typedef struct google_protobuf_OneofOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_OneofOptions;
4920typedef struct google_protobuf_EnumOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumOptions;
4921typedef struct google_protobuf_EnumValueOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumValueOptions;
4922typedef struct google_protobuf_ServiceOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_ServiceOptions;
4923typedef struct google_protobuf_MethodOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_MethodOptions;
4924typedef struct google_protobuf_UninterpretedOption { upb_Message UPB_PRIVATE(base); } google_protobuf_UninterpretedOption;
4925typedef struct google_protobuf_UninterpretedOption_NamePart { upb_Message UPB_PRIVATE(base); } google_protobuf_UninterpretedOption_NamePart;
4926typedef struct google_protobuf_FeatureSet { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSet;
4927typedef struct google_protobuf_FeatureSetDefaults { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSetDefaults;
4928typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault;
4929typedef struct google_protobuf_SourceCodeInfo { upb_Message UPB_PRIVATE(base); } google_protobuf_SourceCodeInfo;
4930typedef struct google_protobuf_SourceCodeInfo_Location { upb_Message UPB_PRIVATE(base); } google_protobuf_SourceCodeInfo_Location;
4931typedef struct google_protobuf_GeneratedCodeInfo { upb_Message UPB_PRIVATE(base); } google_protobuf_GeneratedCodeInfo;
4932typedef struct google_protobuf_GeneratedCodeInfo_Annotation { upb_Message UPB_PRIVATE(base); } google_protobuf_GeneratedCodeInfo_Annotation;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004933
4934typedef enum {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004935 google_protobuf_EDITION_UNKNOWN = 0,
4936 google_protobuf_EDITION_1_TEST_ONLY = 1,
4937 google_protobuf_EDITION_2_TEST_ONLY = 2,
Protobuf Team Bot67038022023-10-04 04:14:37 +00004938 google_protobuf_EDITION_PROTO2 = 998,
4939 google_protobuf_EDITION_PROTO3 = 999,
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004940 google_protobuf_EDITION_2023 = 1000,
Protobuf Team Bot41c8f2a2024-01-11 00:10:17 +00004941 google_protobuf_EDITION_2024 = 1001,
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004942 google_protobuf_EDITION_99997_TEST_ONLY = 99997,
4943 google_protobuf_EDITION_99998_TEST_ONLY = 99998,
Protobuf Team Botde57b672023-11-30 22:16:47 +00004944 google_protobuf_EDITION_99999_TEST_ONLY = 99999,
4945 google_protobuf_EDITION_MAX = 2147483647
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004946} google_protobuf_Edition;
4947
4948typedef enum {
Protobuf Team Bot469f0272023-04-21 18:12:45 -07004949 google_protobuf_ExtensionRangeOptions_DECLARATION = 0,
4950 google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1
4951} google_protobuf_ExtensionRangeOptions_VerificationState;
4952
4953typedef enum {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004954 google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0,
4955 google_protobuf_FeatureSet_OPEN = 1,
4956 google_protobuf_FeatureSet_CLOSED = 2
4957} google_protobuf_FeatureSet_EnumType;
4958
4959typedef enum {
4960 google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0,
4961 google_protobuf_FeatureSet_EXPLICIT = 1,
4962 google_protobuf_FeatureSet_IMPLICIT = 2,
4963 google_protobuf_FeatureSet_LEGACY_REQUIRED = 3
4964} google_protobuf_FeatureSet_FieldPresence;
4965
4966typedef enum {
4967 google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0,
4968 google_protobuf_FeatureSet_ALLOW = 1,
4969 google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2
4970} google_protobuf_FeatureSet_JsonFormat;
4971
4972typedef enum {
4973 google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0,
4974 google_protobuf_FeatureSet_LENGTH_PREFIXED = 1,
4975 google_protobuf_FeatureSet_DELIMITED = 2
4976} google_protobuf_FeatureSet_MessageEncoding;
4977
4978typedef enum {
4979 google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0,
4980 google_protobuf_FeatureSet_PACKED = 1,
4981 google_protobuf_FeatureSet_EXPANDED = 2
4982} google_protobuf_FeatureSet_RepeatedFieldEncoding;
4983
4984typedef enum {
Protobuf Team Bot61127952023-09-26 20:07:33 +00004985 google_protobuf_FeatureSet_UTF8_VALIDATION_UNKNOWN = 0,
Protobuf Team Bot5b8b87f2023-11-30 05:12:08 +00004986 google_protobuf_FeatureSet_VERIFY = 2,
4987 google_protobuf_FeatureSet_NONE = 3
Protobuf Team Bot61127952023-09-26 20:07:33 +00004988} google_protobuf_FeatureSet_Utf8Validation;
4989
4990typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004991 google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
4992 google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
4993 google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
4994} google_protobuf_FieldDescriptorProto_Label;
4995
4996typedef enum {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004997 google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
4998 google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
4999 google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
5000 google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
5001 google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
5002 google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
5003 google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
5004 google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
5005 google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
5006 google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
5007 google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
5008 google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
5009 google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
5010 google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
5011 google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
5012 google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
5013 google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
5014 google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
5015} google_protobuf_FieldDescriptorProto_Type;
5016
5017typedef enum {
5018 google_protobuf_FieldOptions_STRING = 0,
5019 google_protobuf_FieldOptions_CORD = 1,
5020 google_protobuf_FieldOptions_STRING_PIECE = 2
5021} google_protobuf_FieldOptions_CType;
5022
5023typedef enum {
5024 google_protobuf_FieldOptions_JS_NORMAL = 0,
5025 google_protobuf_FieldOptions_JS_STRING = 1,
5026 google_protobuf_FieldOptions_JS_NUMBER = 2
5027} google_protobuf_FieldOptions_JSType;
5028
5029typedef enum {
Adam Cozzette90ff32c2023-01-21 15:04:56 -08005030 google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0,
5031 google_protobuf_FieldOptions_RETENTION_RUNTIME = 1,
5032 google_protobuf_FieldOptions_RETENTION_SOURCE = 2
5033} google_protobuf_FieldOptions_OptionRetention;
5034
5035typedef enum {
5036 google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0,
5037 google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1,
5038 google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2,
5039 google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3,
5040 google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4,
5041 google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5,
5042 google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6,
5043 google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7,
5044 google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8,
5045 google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9
5046} google_protobuf_FieldOptions_OptionTargetType;
5047
5048typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08005049 google_protobuf_FileOptions_SPEED = 1,
5050 google_protobuf_FileOptions_CODE_SIZE = 2,
5051 google_protobuf_FileOptions_LITE_RUNTIME = 3
5052} google_protobuf_FileOptions_OptimizeMode;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005053
5054typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005055 google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0,
5056 google_protobuf_GeneratedCodeInfo_Annotation_SET = 1,
5057 google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2
5058} google_protobuf_GeneratedCodeInfo_Annotation_Semantic;
5059
Mike Kruskalccbdaa72023-02-02 20:42:14 -08005060typedef enum {
5061 google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
5062 google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
5063 google_protobuf_MethodOptions_IDEMPOTENT = 2
5064} google_protobuf_MethodOptions_IdempotencyLevel;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005065
Mike Kruskalccbdaa72023-02-02 20:42:14 -08005066
Joshua Habermanf41049a2022-01-21 14:41:25 -08005067
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005068/* google.protobuf.FileDescriptorSet */
5069
Joshua Habermanf41049a2022-01-21 14:41:25 -08005070UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005071 return (google_protobuf_FileDescriptorSet*)_upb_Message_New(&google__protobuf__FileDescriptorSet_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005072}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005073UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) {
5074 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005075 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005076 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorSet_msg_init, NULL, 0, arena) !=
5077 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005078 return NULL;
5079 }
5080 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005081}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005082UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size,
5083 const upb_ExtensionRegistry* extreg,
5084 int options, upb_Arena* arena) {
5085 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
5086 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005087 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorSet_msg_init, extreg, options,
5088 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005089 return NULL;
5090 }
5091 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005092}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005093UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005094 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005095 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorSet_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005096 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005097}
5098UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options,
5099 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005100 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005101 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorSet_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005102 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005103}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005104UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005105 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005106 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005107}
Eric Salob7d54ac2022-12-29 11:59:42 -08005108UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005109 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005110 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005111 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005112 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005113 return (const google_protobuf_FileDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005114 } else {
5115 if (size) *size = 0;
5116 return NULL;
5117 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005118}
Deanna Garciab26afb52023-04-25 13:37:18 -07005119UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorSet_file_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005120 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005121 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005122 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005123 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005124 }
5125 return arr;
5126}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005127UPB_INLINE upb_Array* _google_protobuf_FileDescriptorSet_file_mutable_upb_array(google_protobuf_FileDescriptorSet* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005128 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005129 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5130 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005131 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005132 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005133 }
5134 return arr;
5135}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005136
Eric Salob7d54ac2022-12-29 11:59:42 -08005137UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005138 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005139 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005140 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005141 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005142 return (google_protobuf_FileDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005143 } else {
5144 if (size) *size = 0;
5145 return NULL;
5146 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005147}
Eric Salob7d54ac2022-12-29 11:59:42 -08005148UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005149 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005150 return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5151 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005152}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005153UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005154 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005155 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5156 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005157 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005158 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005159 return NULL;
5160 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005161 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 -08005162 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005163 UPB_PRIVATE(_upb_Array_Set)
5164 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005165 return sub;
5166}
5167
5168/* google.protobuf.FileDescriptorProto */
5169
Joshua Habermanf41049a2022-01-21 14:41:25 -08005170UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005171 return (google_protobuf_FileDescriptorProto*)_upb_Message_New(&google__protobuf__FileDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005172}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005173UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5174 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005175 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005176 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorProto_msg_init, NULL, 0, arena) !=
5177 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005178 return NULL;
5179 }
5180 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005181}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005182UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size,
5183 const upb_ExtensionRegistry* extreg,
5184 int options, upb_Arena* arena) {
5185 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
5186 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005187 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorProto_msg_init, extreg, options,
5188 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005189 return NULL;
5190 }
5191 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005192}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005193UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005194 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005195 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005196 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005197}
5198UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options,
5199 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005200 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005201 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005202 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005203}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005204UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005205 const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005206 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005207}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005208UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005209 upb_StringView default_val = upb_StringView_FromString("");
5210 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005211 const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005212 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5213 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005214 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005215}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005216UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005217 const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005218 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005219}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005220UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005221 const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005222 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005223}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005224UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005225 upb_StringView default_val = upb_StringView_FromString("");
5226 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005227 const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005228 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5229 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005230 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005231}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005232UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005233 const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005234 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005235}
5236UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005237 const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005238 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005239}
Eric Salob7d54ac2022-12-29 11:59:42 -08005240UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005241 const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005242 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005243 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005244 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005245 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005246 } else {
5247 if (size) *size = 0;
5248 return NULL;
5249 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005250}
Deanna Garciab26afb52023-04-25 13:37:18 -07005251UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005252 const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005253 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005254 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005255 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005256 }
5257 return arr;
5258}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005259UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005260 const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005261 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5262 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005263 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005264 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005265 }
5266 return arr;
5267}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005268UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005269 const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005270 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005271}
Eric Salob7d54ac2022-12-29 11:59:42 -08005272UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005273 const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005274 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005275 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005276 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005277 return (const google_protobuf_DescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005278 } else {
5279 if (size) *size = 0;
5280 return NULL;
5281 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005282}
Deanna Garciab26afb52023-04-25 13:37:18 -07005283UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005284 const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005285 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005286 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005287 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005288 }
5289 return arr;
5290}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005291UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005292 const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005293 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5294 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005295 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005296 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005297 }
5298 return arr;
5299}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005300UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005301 const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005302 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005303}
Eric Salob7d54ac2022-12-29 11:59:42 -08005304UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005305 const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005306 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005307 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005308 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005309 return (const google_protobuf_EnumDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005310 } else {
5311 if (size) *size = 0;
5312 return NULL;
5313 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005314}
Deanna Garciab26afb52023-04-25 13:37:18 -07005315UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005316 const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005317 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005318 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005319 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005320 }
5321 return arr;
5322}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005323UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005324 const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005325 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5326 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005327 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005328 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005329 }
5330 return arr;
5331}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005332UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005333 const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005334 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005335}
Eric Salob7d54ac2022-12-29 11:59:42 -08005336UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005337 const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005338 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005339 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005340 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005341 return (const google_protobuf_ServiceDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005342 } else {
5343 if (size) *size = 0;
5344 return NULL;
5345 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005346}
Deanna Garciab26afb52023-04-25 13:37:18 -07005347UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005348 const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005349 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005350 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005351 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005352 }
5353 return arr;
5354}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005355UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005356 const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005357 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5358 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005359 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005360 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005361 }
5362 return arr;
5363}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005364UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005365 const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005366 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005367}
Eric Salob7d54ac2022-12-29 11:59:42 -08005368UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005369 const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005370 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005371 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005372 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005373 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005374 } else {
5375 if (size) *size = 0;
5376 return NULL;
5377 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005378}
Deanna Garciab26afb52023-04-25 13:37:18 -07005379UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005380 const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005381 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005382 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005383 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005384 }
5385 return arr;
5386}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005387UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005388 const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005389 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5390 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005391 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005392 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005393 }
5394 return arr;
5395}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005396UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005397 const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005398 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005399}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005400UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005401 const google_protobuf_FileOptions* default_val = NULL;
5402 const google_protobuf_FileOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005403 const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005404 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5405 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005406 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005407}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005408UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005409 const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005410 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005411}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005412UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005413 const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005414 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005415}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005416UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005417 const google_protobuf_SourceCodeInfo* default_val = NULL;
5418 const google_protobuf_SourceCodeInfo* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005419 const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005420 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5421 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005422 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005423}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005424UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005425 const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005426 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005427}
5428UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005429 const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005430 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08005431}
Eric Salob7d54ac2022-12-29 11:59:42 -08005432UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005433 const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005434 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005435 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005436 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005437 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005438 } else {
5439 if (size) *size = 0;
5440 return NULL;
5441 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005442}
Deanna Garciab26afb52023-04-25 13:37:18 -07005443UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005444 const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005445 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005446 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005447 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005448 }
5449 return arr;
5450}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005451UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005452 const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005453 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5454 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005455 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005456 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005457 }
5458 return arr;
5459}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005460UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005461 const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005462 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005463}
Eric Salob7d54ac2022-12-29 11:59:42 -08005464UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005465 const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005466 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005467 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005468 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005469 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005470 } else {
5471 if (size) *size = 0;
5472 return NULL;
5473 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005474}
Deanna Garciab26afb52023-04-25 13:37:18 -07005475UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005476 const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005477 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005478 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005479 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005480 }
5481 return arr;
5482}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005483UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005484 const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005485 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5486 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005487 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005488 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005489 }
5490 return arr;
5491}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005492UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005493 const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005494 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005495}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005496UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005497 upb_StringView default_val = upb_StringView_FromString("");
5498 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005499 const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005500 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5501 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005502 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005503}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005504UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005505 const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005506 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005507}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005508UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005509 const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005510 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005511}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00005512UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) {
5513 int32_t default_val = 0;
5514 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005515 const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005516 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5517 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005518 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005519}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005520UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005521 const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005522 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005523}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005524
Joshua Habermanf41049a2022-01-21 14:41:25 -08005525UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005526 const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005527 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005528}
5529UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005530 const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005531 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005532}
5533UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005534 upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005535 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005536 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005537 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005538 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005539 } else {
5540 if (size) *size = 0;
5541 return NULL;
5542 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005543}
Eric Salob7d54ac2022-12-29 11:59:42 -08005544UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005545 upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005546 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5547 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005548}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005549UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005550 upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005551 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5552 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005553 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005554 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005555 return false;
5556 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005557 UPB_PRIVATE(_upb_Array_Set)
5558 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005559 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005560}
Eric Salob7d54ac2022-12-29 11:59:42 -08005561UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005562 upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005563 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005564 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005565 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005566 return (google_protobuf_DescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005567 } else {
5568 if (size) *size = 0;
5569 return NULL;
5570 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005571}
Eric Salob7d54ac2022-12-29 11:59:42 -08005572UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005573 upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005574 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5575 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005576}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005577UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005578 upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005579 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5580 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005581 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005582 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005583 return NULL;
5584 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005585 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 -08005586 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005587 UPB_PRIVATE(_upb_Array_Set)
5588 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005589 return sub;
5590}
Eric Salob7d54ac2022-12-29 11:59:42 -08005591UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005592 upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005593 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005594 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005595 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005596 return (google_protobuf_EnumDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005597 } else {
5598 if (size) *size = 0;
5599 return NULL;
5600 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005601}
Eric Salob7d54ac2022-12-29 11:59:42 -08005602UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005603 upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005604 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5605 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005606}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005607UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005608 upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005609 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5610 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005611 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005612 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005613 return NULL;
5614 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005615 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 -08005616 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005617 UPB_PRIVATE(_upb_Array_Set)
5618 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005619 return sub;
5620}
Eric Salob7d54ac2022-12-29 11:59:42 -08005621UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005622 upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005623 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005624 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005625 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005626 return (google_protobuf_ServiceDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005627 } else {
5628 if (size) *size = 0;
5629 return NULL;
5630 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005631}
Eric Salob7d54ac2022-12-29 11:59:42 -08005632UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005633 upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005634 return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5635 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005636}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005637UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005638 upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005639 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5640 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005641 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005642 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005643 return NULL;
5644 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005645 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 -08005646 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005647 UPB_PRIVATE(_upb_Array_Set)
5648 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005649 return sub;
5650}
Eric Salob7d54ac2022-12-29 11:59:42 -08005651UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005652 upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005653 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005654 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005655 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005656 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005657 } else {
5658 if (size) *size = 0;
5659 return NULL;
5660 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005661}
Eric Salob7d54ac2022-12-29 11:59:42 -08005662UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005663 upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005664 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5665 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005666}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005667UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005668 upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005669 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5670 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005671 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005672 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005673 return NULL;
5674 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005675 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google__protobuf__FieldDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005676 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005677 UPB_PRIVATE(_upb_Array_Set)
5678 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005679 return sub;
5680}
5681UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005682 const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005683 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005684}
5685UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005686 struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
5687 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005688 sub = (struct google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005689 if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005690 }
5691 return sub;
5692}
5693UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005694 const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005695 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005696}
5697UPB_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 -08005698 struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
5699 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005700 sub = (struct google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005701 if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005702 }
5703 return sub;
5704}
Eric Salob7d54ac2022-12-29 11:59:42 -08005705UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005706 upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005707 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005708 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005709 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005710 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005711 } else {
5712 if (size) *size = 0;
5713 return NULL;
5714 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005715}
Eric Salob7d54ac2022-12-29 11:59:42 -08005716UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005717 upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005718 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5719 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005720}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005721UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005722 upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005723 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5724 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005725 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005726 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005727 return false;
5728 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005729 UPB_PRIVATE(_upb_Array_Set)
5730 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005731 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005732}
Eric Salob7d54ac2022-12-29 11:59:42 -08005733UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005734 upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005735 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005736 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005737 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005738 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005739 } else {
5740 if (size) *size = 0;
5741 return NULL;
5742 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005743}
Eric Salob7d54ac2022-12-29 11:59:42 -08005744UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005745 upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005746 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5747 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005748}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005749UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005750 upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005751 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5752 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005753 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005754 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005755 return false;
5756 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005757 UPB_PRIVATE(_upb_Array_Set)
5758 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005759 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005760}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005761UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005762 const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005763 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005764}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00005765UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005766 const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005767 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005768}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005769
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005770/* google.protobuf.DescriptorProto */
5771
Joshua Habermanf41049a2022-01-21 14:41:25 -08005772UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005773 return (google_protobuf_DescriptorProto*)_upb_Message_New(&google__protobuf__DescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005774}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005775UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5776 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005777 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005778 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto_msg_init, NULL, 0, arena) !=
5779 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005780 return NULL;
5781 }
5782 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005783}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005784UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size,
5785 const upb_ExtensionRegistry* extreg,
5786 int options, upb_Arena* arena) {
5787 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
5788 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005789 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto_msg_init, extreg, options,
5790 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005791 return NULL;
5792 }
5793 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005794}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005795UPB_INLINE char* google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005796 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005797 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005798 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005799}
5800UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options,
5801 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005802 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005803 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005804 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005805}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005806UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005807 const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005808 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005809}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005810UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005811 upb_StringView default_val = upb_StringView_FromString("");
5812 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005813 const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005814 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5815 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005816 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005817}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005818UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005819 const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005820 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005821}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005822UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005823 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005824 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005825}
Eric Salob7d54ac2022-12-29 11:59:42 -08005826UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005827 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005828 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005829 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005830 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005831 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005832 } else {
5833 if (size) *size = 0;
5834 return NULL;
5835 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005836}
Deanna Garciab26afb52023-04-25 13:37:18 -07005837UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_field_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005838 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005839 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005840 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005841 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005842 }
5843 return arr;
5844}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005845UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_field_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005846 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005847 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5848 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005849 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005850 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005851 }
5852 return arr;
5853}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005854UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005855 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005856 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005857}
Eric Salob7d54ac2022-12-29 11:59:42 -08005858UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005859 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005860 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005861 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005862 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005863 return (const google_protobuf_DescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005864 } else {
5865 if (size) *size = 0;
5866 return NULL;
5867 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005868}
Deanna Garciab26afb52023-04-25 13:37:18 -07005869UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_nested_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005870 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005871 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005872 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005873 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005874 }
5875 return arr;
5876}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005877UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_nested_type_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005878 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005879 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5880 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005881 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005882 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005883 }
5884 return arr;
5885}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005886UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005887 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005888 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005889}
Eric Salob7d54ac2022-12-29 11:59:42 -08005890UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005891 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005892 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005893 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005894 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005895 return (const google_protobuf_EnumDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005896 } else {
5897 if (size) *size = 0;
5898 return NULL;
5899 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005900}
Deanna Garciab26afb52023-04-25 13:37:18 -07005901UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_enum_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005902 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005903 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005904 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005905 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005906 }
5907 return arr;
5908}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005909UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_enum_type_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005910 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005911 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5912 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005913 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005914 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005915 }
5916 return arr;
5917}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005918UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005919 const upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005920 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005921}
Eric Salob7d54ac2022-12-29 11:59:42 -08005922UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005923 const upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005924 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005925 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005926 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005927 return (const google_protobuf_DescriptorProto_ExtensionRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005928 } else {
5929 if (size) *size = 0;
5930 return NULL;
5931 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005932}
Deanna Garciab26afb52023-04-25 13:37:18 -07005933UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005934 const upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005935 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005936 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005937 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005938 }
5939 return arr;
5940}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005941UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_range_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005942 const upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005943 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5944 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005945 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005946 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005947 }
5948 return arr;
5949}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005950UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005951 const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005952 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005953}
Eric Salob7d54ac2022-12-29 11:59:42 -08005954UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005955 const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005956 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005957 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005958 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005959 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005960 } else {
5961 if (size) *size = 0;
5962 return NULL;
5963 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005964}
Deanna Garciab26afb52023-04-25 13:37:18 -07005965UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005966 const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005967 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005968 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005969 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005970 }
5971 return arr;
5972}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005973UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005974 const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005975 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5976 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005977 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005978 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005979 }
5980 return arr;
5981}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005982UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005983 const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005984 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005985}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005986UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005987 const google_protobuf_MessageOptions* default_val = NULL;
5988 const google_protobuf_MessageOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005989 const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005990 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5991 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005992 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005993}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005994UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005995 const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005996 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005997}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005998UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005999 const upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006000 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006001}
Eric Salob7d54ac2022-12-29 11:59:42 -08006002UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006003 const upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006004 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006005 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006006 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006007 return (const google_protobuf_OneofDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006008 } else {
6009 if (size) *size = 0;
6010 return NULL;
6011 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006012}
Deanna Garciab26afb52023-04-25 13:37:18 -07006013UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_oneof_decl_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006014 const upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006015 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006016 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006017 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006018 }
6019 return arr;
6020}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006021UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_oneof_decl_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006022 const upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006023 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6024 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006025 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006026 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006027 }
6028 return arr;
6029}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006030UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006031 const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006032 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006033}
Eric Salob7d54ac2022-12-29 11:59:42 -08006034UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006035 const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006036 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006037 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006038 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006039 return (const google_protobuf_DescriptorProto_ReservedRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006040 } else {
6041 if (size) *size = 0;
6042 return NULL;
6043 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006044}
Deanna Garciab26afb52023-04-25 13:37:18 -07006045UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006046 const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006047 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006048 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006049 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006050 }
6051 return arr;
6052}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006053UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_range_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006054 const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006055 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6056 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006057 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006058 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006059 }
6060 return arr;
6061}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006062UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006063 const upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006064 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006065}
Eric Salob7d54ac2022-12-29 11:59:42 -08006066UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006067 const upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006068 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006069 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006070 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006071 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006072 } else {
6073 if (size) *size = 0;
6074 return NULL;
6075 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006076}
Deanna Garciab26afb52023-04-25 13:37:18 -07006077UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_name_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006078 const upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006079 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006080 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006081 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006082 }
6083 return arr;
6084}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006085UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_name_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006086 const upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006087 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6088 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006089 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006090 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006091 }
6092 return arr;
6093}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006094
Joshua Habermanf41049a2022-01-21 14:41:25 -08006095UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006096 const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006097 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006098}
6099UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006100 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006101 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006102 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006103 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006104 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006105 } else {
6106 if (size) *size = 0;
6107 return NULL;
6108 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006109}
Eric Salob7d54ac2022-12-29 11:59:42 -08006110UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006111 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006112 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6113 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006114}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006115UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006116 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006117 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6118 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006119 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006120 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006121 return NULL;
6122 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006123 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 -08006124 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006125 UPB_PRIVATE(_upb_Array_Set)
6126 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006127 return sub;
6128}
Eric Salob7d54ac2022-12-29 11:59:42 -08006129UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006130 upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006131 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006132 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006133 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006134 return (google_protobuf_DescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006135 } else {
6136 if (size) *size = 0;
6137 return NULL;
6138 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006139}
Eric Salob7d54ac2022-12-29 11:59:42 -08006140UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006141 upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006142 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6143 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006144}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006145UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006146 upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006147 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6148 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006149 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006150 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006151 return NULL;
6152 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006153 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 -08006154 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006155 UPB_PRIVATE(_upb_Array_Set)
6156 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006157 return sub;
6158}
Eric Salob7d54ac2022-12-29 11:59:42 -08006159UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006160 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006161 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006162 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006163 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006164 return (google_protobuf_EnumDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006165 } else {
6166 if (size) *size = 0;
6167 return NULL;
6168 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006169}
Eric Salob7d54ac2022-12-29 11:59:42 -08006170UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006171 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006172 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6173 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006174}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006175UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006176 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006177 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6178 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006179 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006180 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006181 return NULL;
6182 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006183 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 -08006184 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006185 UPB_PRIVATE(_upb_Array_Set)
6186 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006187 return sub;
6188}
Eric Salob7d54ac2022-12-29 11:59:42 -08006189UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006190 upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006191 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006192 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006193 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006194 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006195 } else {
6196 if (size) *size = 0;
6197 return NULL;
6198 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006199}
Eric Salob7d54ac2022-12-29 11:59:42 -08006200UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006201 upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006202 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6203 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006204}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006205UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006206 upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006207 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6208 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006209 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006210 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006211 return NULL;
6212 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006213 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 -08006214 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006215 UPB_PRIVATE(_upb_Array_Set)
6216 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006217 return sub;
6218}
Eric Salob7d54ac2022-12-29 11:59:42 -08006219UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006220 upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006221 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006222 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006223 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006224 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006225 } else {
6226 if (size) *size = 0;
6227 return NULL;
6228 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006229}
Eric Salob7d54ac2022-12-29 11:59:42 -08006230UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006231 upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006232 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6233 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006234}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006235UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006236 upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006237 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6238 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006239 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006240 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006241 return NULL;
6242 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006243 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 -08006244 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006245 UPB_PRIVATE(_upb_Array_Set)
6246 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006247 return sub;
6248}
6249UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006250 const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006251 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006252}
6253UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006254 struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
6255 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006256 sub = (struct google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006257 if (sub) google_protobuf_DescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006258 }
6259 return sub;
6260}
Eric Salob7d54ac2022-12-29 11:59:42 -08006261UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006262 upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006263 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006264 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006265 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006266 return (google_protobuf_OneofDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006267 } else {
6268 if (size) *size = 0;
6269 return NULL;
6270 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006271}
Eric Salob7d54ac2022-12-29 11:59:42 -08006272UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006273 upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006274 return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6275 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006276}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006277UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006278 upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006279 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6280 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006281 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006282 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006283 return NULL;
6284 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006285 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 -08006286 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006287 UPB_PRIVATE(_upb_Array_Set)
6288 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006289 return sub;
6290}
Eric Salob7d54ac2022-12-29 11:59:42 -08006291UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006292 upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006293 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006294 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006295 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006296 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006297 } else {
6298 if (size) *size = 0;
6299 return NULL;
6300 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006301}
Eric Salob7d54ac2022-12-29 11:59:42 -08006302UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006303 upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006304 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6305 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006306}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006307UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006308 upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006309 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6310 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006311 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006312 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006313 return NULL;
6314 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006315 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 -08006316 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006317 UPB_PRIVATE(_upb_Array_Set)
6318 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006319 return sub;
6320}
Eric Salob7d54ac2022-12-29 11:59:42 -08006321UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006322 upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006323 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006324 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006325 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006326 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006327 } else {
6328 if (size) *size = 0;
6329 return NULL;
6330 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006331}
Eric Salob7d54ac2022-12-29 11:59:42 -08006332UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006333 upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006334 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6335 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006336}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006337UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006338 upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006339 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6340 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006341 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006342 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006343 return false;
6344 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006345 UPB_PRIVATE(_upb_Array_Set)
6346 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08006347 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006348}
6349
6350/* google.protobuf.DescriptorProto.ExtensionRange */
6351
Joshua Habermanf41049a2022-01-21 14:41:25 -08006352UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006353 return (google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ExtensionRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006354}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006355UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6356 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006357 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006358 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, NULL, 0, arena) !=
6359 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006360 return NULL;
6361 }
6362 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006363}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006364UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size,
6365 const upb_ExtensionRegistry* extreg,
6366 int options, upb_Arena* arena) {
6367 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
6368 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006369 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, extreg, options,
6370 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006371 return NULL;
6372 }
6373 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006374}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006375UPB_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 -07006376 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006377 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006378 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006379}
6380UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options,
6381 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006382 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006383 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006384 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006385}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006386UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006387 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006388 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006389}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006390UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006391 int32_t default_val = (int32_t)0;
6392 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006393 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006394 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6395 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006396 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006397}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006398UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006399 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006400 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006401}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006402UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006403 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006404 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006405}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006406UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006407 int32_t default_val = (int32_t)0;
6408 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006409 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006410 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6411 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006412 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006413}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006414UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006415 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006416 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006417}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006418UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006419 const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006420 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006421}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006422UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006423 const google_protobuf_ExtensionRangeOptions* default_val = NULL;
6424 const google_protobuf_ExtensionRangeOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006425 const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006426 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6427 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006428 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006429}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006430UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006431 const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006432 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006433}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006434
6435UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006436 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006437 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006438}
6439UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006440 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006441 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006442}
6443UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006444 const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006445 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006446}
6447UPB_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 -08006448 struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
6449 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006450 sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006451 if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006452 }
6453 return sub;
6454}
6455
6456/* google.protobuf.DescriptorProto.ReservedRange */
6457
Joshua Habermanf41049a2022-01-21 14:41:25 -08006458UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006459 return (google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006460}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006461UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6462 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006463 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006464 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ReservedRange_msg_init, NULL, 0, arena) !=
6465 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006466 return NULL;
6467 }
6468 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006469}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006470UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size,
6471 const upb_ExtensionRegistry* extreg,
6472 int options, upb_Arena* arena) {
6473 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
6474 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006475 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ReservedRange_msg_init, extreg, options,
6476 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006477 return NULL;
6478 }
6479 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006480}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006481UPB_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 -07006482 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006483 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006484 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006485}
6486UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options,
6487 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006488 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006489 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006490 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006491}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006492UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006493 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006494 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006495}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006496UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006497 int32_t default_val = (int32_t)0;
6498 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006499 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006500 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6501 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006502 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006503}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006504UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006505 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006506 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006507}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006508UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006509 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006510 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006511}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006512UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006513 int32_t default_val = (int32_t)0;
6514 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006515 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006516 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6517 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006518 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006519}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006520UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006521 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006522 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006523}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006524
6525UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006526 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006527 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006528}
6529UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006530 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006531 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006532}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006533
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006534/* google.protobuf.ExtensionRangeOptions */
6535
Joshua Habermanf41049a2022-01-21 14:41:25 -08006536UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006537 return (google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006538}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006539UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
6540 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006541 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006542 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions_msg_init, NULL, 0, arena) !=
6543 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006544 return NULL;
6545 }
6546 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006547}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006548UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size,
6549 const upb_ExtensionRegistry* extreg,
6550 int options, upb_Arena* arena) {
6551 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
6552 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006553 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions_msg_init, extreg, options,
6554 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006555 return NULL;
6556 }
6557 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006558}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006559UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006560 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006561 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006562 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006563}
6564UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options,
6565 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006566 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006567 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006568 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006569}
Mike Kruskal145900f2023-03-27 09:55:52 -07006570UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006571 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006572 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006573}
6574UPB_INLINE const google_protobuf_ExtensionRangeOptions_Declaration* const* google_protobuf_ExtensionRangeOptions_declaration(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006575 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006576 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006577 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006578 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006579 return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)upb_Array_DataPtr(arr);
Mike Kruskal145900f2023-03-27 09:55:52 -07006580 } else {
6581 if (size) *size = 0;
6582 return NULL;
6583 }
6584}
Deanna Garciab26afb52023-04-25 13:37:18 -07006585UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006586 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006587 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006588 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006589 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006590 }
6591 return arr;
6592}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006593UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_mutable_upb_array(google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006594 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006595 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6596 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006597 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006598 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006599 }
6600 return arr;
6601}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006602UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006603 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006604 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006605}
6606UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) {
6607 int32_t default_val = 1;
6608 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006609 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006610 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6611 &default_val, &ret);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006612 return ret;
6613}
6614UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006615 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006616 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006617}
6618UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006619 const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006620 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006621}
6622UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) {
6623 const google_protobuf_FeatureSet* default_val = NULL;
6624 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006625 const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006626 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6627 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006628 return ret;
6629}
6630UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006631 const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006632 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006633}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006634UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006635 const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006636 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006637}
Eric Salob7d54ac2022-12-29 11:59:42 -08006638UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006639 const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006640 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006641 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006642 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006643 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006644 } else {
6645 if (size) *size = 0;
6646 return NULL;
6647 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006648}
Deanna Garciab26afb52023-04-25 13:37:18 -07006649UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006650 const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006651 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006652 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006653 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006654 }
6655 return arr;
6656}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006657UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_mutable_upb_array(google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006658 const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006659 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6660 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006661 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006662 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006663 }
6664 return arr;
6665}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006666
Mike Kruskal145900f2023-03-27 09:55:52 -07006667UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_mutable_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006668 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006669 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006670 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006671 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006672 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Array_MutableDataPtr(arr);
Mike Kruskal145900f2023-03-27 09:55:52 -07006673 } else {
6674 if (size) *size = 0;
6675 return NULL;
6676 }
6677}
6678UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_resize_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006679 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006680 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6681 &field, size, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006682}
6683UPB_INLINE struct google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_add_declaration(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006684 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006685 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6686 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006687 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006688 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006689 return NULL;
6690 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006691 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 -07006692 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006693 UPB_PRIVATE(_upb_Array_Set)
6694 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskal145900f2023-03-27 09:55:52 -07006695 return sub;
6696}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006697UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006698 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006699 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006700}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006701UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006702 const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006703 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006704}
6705UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
6706 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg);
6707 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006708 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006709 if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub);
6710 }
6711 return sub;
6712}
Eric Salob7d54ac2022-12-29 11:59:42 -08006713UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006714 upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006715 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006716 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006717 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006718 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006719 } else {
6720 if (size) *size = 0;
6721 return NULL;
6722 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006723}
Eric Salob7d54ac2022-12-29 11:59:42 -08006724UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006725 upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006726 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6727 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006728}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006729UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006730 upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006731 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6732 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006733 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006734 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006735 return NULL;
6736 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006737 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 -08006738 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006739 UPB_PRIVATE(_upb_Array_Set)
6740 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006741 return sub;
6742}
6743
Mike Kruskal145900f2023-03-27 09:55:52 -07006744/* google.protobuf.ExtensionRangeOptions.Declaration */
6745
6746UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006747 return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006748}
6749UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) {
6750 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6751 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006752 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, NULL, 0, arena) !=
6753 kUpb_DecodeStatus_Ok) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006754 return NULL;
6755 }
6756 return ret;
6757}
6758UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size,
6759 const upb_ExtensionRegistry* extreg,
6760 int options, upb_Arena* arena) {
6761 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6762 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006763 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, extreg, options,
6764 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006765 return NULL;
6766 }
6767 return ret;
6768}
6769UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) {
6770 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006771 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, 0, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006772 return ptr;
6773}
6774UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options,
6775 upb_Arena* arena, size_t* len) {
6776 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006777 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, options, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006778 return ptr;
6779}
6780UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006781 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006782 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006783}
6784UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6785 int32_t default_val = (int32_t)0;
6786 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006787 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006788 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6789 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006790 return ret;
6791}
6792UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006793 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006794 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006795}
6796UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006797 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006798 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006799}
6800UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6801 upb_StringView default_val = upb_StringView_FromString("");
6802 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006803 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006804 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6805 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006806 return ret;
6807}
6808UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006809 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006810 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006811}
6812UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006813 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006814 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006815}
6816UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6817 upb_StringView default_val = upb_StringView_FromString("");
6818 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006819 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006820 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6821 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006822 return ret;
6823}
6824UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006825 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006826 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006827}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006828UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006829 const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006830 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006831}
6832UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6833 bool default_val = false;
6834 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006835 const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006836 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6837 &default_val, &ret);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006838 return ret;
6839}
6840UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006841 const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006842 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006843}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006844UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006845 const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006846 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006847}
6848UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6849 bool default_val = false;
6850 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006851 const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006852 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6853 &default_val, &ret);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006854 return ret;
6855}
6856UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006857 const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006858 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006859}
Mike Kruskal145900f2023-03-27 09:55:52 -07006860
6861UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006862 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006863 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006864}
6865UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006866 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006867 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006868}
6869UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006870 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006871 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006872}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006873UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006874 const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006875 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006876}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006877UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006878 const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006879 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006880}
Mike Kruskal145900f2023-03-27 09:55:52 -07006881
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006882/* google.protobuf.FieldDescriptorProto */
6883
Joshua Habermanf41049a2022-01-21 14:41:25 -08006884UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006885 return (google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google__protobuf__FieldDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006886}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006887UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6888 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006889 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006890 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldDescriptorProto_msg_init, NULL, 0, arena) !=
6891 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006892 return NULL;
6893 }
6894 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006895}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006896UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size,
6897 const upb_ExtensionRegistry* extreg,
6898 int options, upb_Arena* arena) {
6899 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
6900 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006901 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldDescriptorProto_msg_init, extreg, options,
6902 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006903 return NULL;
6904 }
6905 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006906}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006907UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006908 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006909 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006910 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006911}
6912UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options,
6913 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006914 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006915 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006916 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006917}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006918UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006919 const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006920 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006921}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006922UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006923 upb_StringView default_val = upb_StringView_FromString("");
6924 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006925 const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006926 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6927 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006928 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006929}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006930UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006931 const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006932 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006933}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006934UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006935 const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006936 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006937}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006938UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006939 upb_StringView default_val = upb_StringView_FromString("");
6940 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006941 const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006942 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6943 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006944 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006945}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006946UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006947 const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006948 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006949}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006950UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006951 const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006952 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006953}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006954UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006955 int32_t default_val = (int32_t)0;
6956 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006957 const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006958 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6959 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006960 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006961}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006962UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006963 const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006964 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006965}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006966UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006967 const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006968 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006969}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006970UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006971 int32_t default_val = 1;
6972 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006973 const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006974 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6975 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006976 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006977}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006978UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006979 const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006980 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006981}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006982UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006983 const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006984 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006985}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006986UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006987 int32_t default_val = 1;
6988 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006989 const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006990 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6991 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006992 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006993}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006994UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006995 const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006996 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006997}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006998UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006999 const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007000 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007001}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007002UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007003 upb_StringView default_val = upb_StringView_FromString("");
7004 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007005 const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007006 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7007 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007008 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007009}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007010UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007011 const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007012 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007013}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007014UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007015 const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007016 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007017}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007018UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007019 upb_StringView default_val = upb_StringView_FromString("");
7020 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007021 const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007022 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7023 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007024 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007025}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007026UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007027 const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007028 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007029}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007030UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007031 const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007032 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007033}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007034UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007035 const google_protobuf_FieldOptions* default_val = NULL;
7036 const google_protobuf_FieldOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007037 const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007038 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7039 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007040 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007041}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007042UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007043 const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007044 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007045}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007046UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007047 const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007048 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007049}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007050UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007051 int32_t default_val = (int32_t)0;
7052 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007053 const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007054 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7055 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007056 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007057}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007058UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007059 const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007060 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007061}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007062UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007063 const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007064 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007065}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007066UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007067 upb_StringView default_val = upb_StringView_FromString("");
7068 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007069 const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007070 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7071 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007072 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007073}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007074UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007075 const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007076 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007077}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007078UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007079 const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007080 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007081}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007082UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007083 bool default_val = false;
7084 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007085 const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007086 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7087 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007088 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007089}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007090UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007091 const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007092 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007093}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007094
7095UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007096 const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007097 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007098}
7099UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007100 const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007101 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007102}
7103UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007104 const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007105 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007106}
7107UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007108 const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007109 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007110}
7111UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007112 const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007113 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007114}
7115UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007116 const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007117 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007118}
7119UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007120 const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007121 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007122}
7123UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007124 const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007125 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007126}
7127UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007128 struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
7129 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007130 sub = (struct google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007131 if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007132 }
7133 return sub;
7134}
7135UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007136 const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007137 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007138}
7139UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007140 const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007141 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007142}
7143UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007144 const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007145 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007146}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007147
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007148/* google.protobuf.OneofDescriptorProto */
7149
Joshua Habermanf41049a2022-01-21 14:41:25 -08007150UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007151 return (google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google__protobuf__OneofDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007152}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007153UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7154 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007155 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007156 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofDescriptorProto_msg_init, NULL, 0, arena) !=
7157 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007158 return NULL;
7159 }
7160 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007161}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007162UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size,
7163 const upb_ExtensionRegistry* extreg,
7164 int options, upb_Arena* arena) {
7165 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
7166 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007167 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofDescriptorProto_msg_init, extreg, options,
7168 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007169 return NULL;
7170 }
7171 return ret;
7172}
7173UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007174 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007175 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007176 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007177}
7178UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options,
7179 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007180 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007181 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007182 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007183}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007184UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007185 const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007186 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007187}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007188UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007189 upb_StringView default_val = upb_StringView_FromString("");
7190 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007191 const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007192 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7193 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007194 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007195}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007196UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007197 const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007198 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007199}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007200UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007201 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007202 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007203}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007204UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007205 const google_protobuf_OneofOptions* default_val = NULL;
7206 const google_protobuf_OneofOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007207 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007208 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7209 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007210 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007211}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007212UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007213 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007214 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007215}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007216
Joshua Habermanf41049a2022-01-21 14:41:25 -08007217UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007218 const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007219 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007220}
7221UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007222 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007223 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007224}
7225UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007226 struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
7227 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007228 sub = (struct google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007229 if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007230 }
7231 return sub;
7232}
7233
7234/* google.protobuf.EnumDescriptorProto */
7235
Joshua Habermanf41049a2022-01-21 14:41:25 -08007236UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007237 return (google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google__protobuf__EnumDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007238}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007239UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7240 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007241 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007242 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto_msg_init, NULL, 0, arena) !=
7243 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007244 return NULL;
7245 }
7246 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007247}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007248UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size,
7249 const upb_ExtensionRegistry* extreg,
7250 int options, upb_Arena* arena) {
7251 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
7252 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007253 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto_msg_init, extreg, options,
7254 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007255 return NULL;
7256 }
7257 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007258}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007259UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007260 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007261 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007262 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007263}
7264UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options,
7265 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007266 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007267 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007268 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007269}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007270UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007271 const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007272 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007273}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007274UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007275 upb_StringView default_val = upb_StringView_FromString("");
7276 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007277 const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007278 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7279 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007280 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007281}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007282UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007283 const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007284 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007285}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007286UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007287 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007288 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007289}
Eric Salob7d54ac2022-12-29 11:59:42 -08007290UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007291 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007292 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007293 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007294 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007295 return (const google_protobuf_EnumValueDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007296 } else {
7297 if (size) *size = 0;
7298 return NULL;
7299 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007300}
Deanna Garciab26afb52023-04-25 13:37:18 -07007301UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_value_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007302 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007303 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007304 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007305 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007306 }
7307 return arr;
7308}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007309UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_value_mutable_upb_array(google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007310 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007311 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7312 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007313 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007314 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007315 }
7316 return arr;
7317}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007318UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007319 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007320 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007321}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007322UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007323 const google_protobuf_EnumOptions* default_val = NULL;
7324 const google_protobuf_EnumOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007325 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007326 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7327 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007328 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007329}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007330UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007331 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007332 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007333}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007334UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007335 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007336 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007337}
Eric Salob7d54ac2022-12-29 11:59:42 -08007338UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007339 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007340 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007341 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007342 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007343 return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007344 } else {
7345 if (size) *size = 0;
7346 return NULL;
7347 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007348}
Deanna Garciab26afb52023-04-25 13:37:18 -07007349UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007350 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007351 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007352 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007353 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007354 }
7355 return arr;
7356}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007357UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_mutable_upb_array(google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007358 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007359 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7360 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007361 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007362 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007363 }
7364 return arr;
7365}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007366UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007367 const upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007368 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007369}
Eric Salob7d54ac2022-12-29 11:59:42 -08007370UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007371 const upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007372 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007373 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007374 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007375 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007376 } else {
7377 if (size) *size = 0;
7378 return NULL;
7379 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007380}
Deanna Garciab26afb52023-04-25 13:37:18 -07007381UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007382 const upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007383 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007384 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007385 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007386 }
7387 return arr;
7388}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007389UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_mutable_upb_array(google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007390 const upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007391 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7392 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007393 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007394 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007395 }
7396 return arr;
7397}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007398
Joshua Habermanf41049a2022-01-21 14:41:25 -08007399UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007400 const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007401 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007402}
7403UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007404 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007405 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007406 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007407 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007408 return (google_protobuf_EnumValueDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007409 } else {
7410 if (size) *size = 0;
7411 return NULL;
7412 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007413}
Eric Salob7d54ac2022-12-29 11:59:42 -08007414UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007415 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007416 return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7417 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007418}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007419UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007420 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007421 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7422 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007423 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007424 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007425 return NULL;
7426 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007427 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 -08007428 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007429 UPB_PRIVATE(_upb_Array_Set)
7430 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007431 return sub;
7432}
7433UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007434 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007435 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007436}
7437UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007438 struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
7439 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007440 sub = (struct google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007441 if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007442 }
7443 return sub;
7444}
Eric Salob7d54ac2022-12-29 11:59:42 -08007445UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007446 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007447 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007448 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007449 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007450 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007451 } else {
7452 if (size) *size = 0;
7453 return NULL;
7454 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007455}
Eric Salob7d54ac2022-12-29 11:59:42 -08007456UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007457 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007458 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7459 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007460}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007461UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007462 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007463 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7464 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007465 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007466 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007467 return NULL;
7468 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007469 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 -08007470 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007471 UPB_PRIVATE(_upb_Array_Set)
7472 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007473 return sub;
7474}
Eric Salob7d54ac2022-12-29 11:59:42 -08007475UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007476 upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007477 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007478 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007479 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007480 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007481 } else {
7482 if (size) *size = 0;
7483 return NULL;
7484 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007485}
Eric Salob7d54ac2022-12-29 11:59:42 -08007486UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007487 upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007488 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7489 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007490}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007491UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007492 upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007493 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7494 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007495 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007496 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007497 return false;
7498 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007499 UPB_PRIVATE(_upb_Array_Set)
7500 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08007501 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007502}
7503
7504/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
7505
Joshua Habermanf41049a2022-01-21 14:41:25 -08007506UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007507 return (google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007508}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007509UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
7510 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007511 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007512 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, NULL, 0, arena) !=
7513 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007514 return NULL;
7515 }
7516 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007517}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007518UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size,
7519 const upb_ExtensionRegistry* extreg,
7520 int options, upb_Arena* arena) {
7521 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
7522 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007523 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, extreg, options,
7524 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007525 return NULL;
7526 }
7527 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007528}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007529UPB_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 -07007530 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007531 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007532 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007533}
7534UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options,
7535 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007536 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007537 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007538 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007539}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007540UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007541 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007542 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007543}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007544UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007545 int32_t default_val = (int32_t)0;
7546 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007547 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007548 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7549 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007550 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007551}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007552UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007553 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007554 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007555}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007556UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007557 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007558 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007559}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007560UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007561 int32_t default_val = (int32_t)0;
7562 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007563 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007564 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7565 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007566 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007567}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007568UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007569 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007570 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007571}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007572
7573UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007574 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007575 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007576}
7577UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007578 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007579 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007580}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007581
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007582/* google.protobuf.EnumValueDescriptorProto */
7583
Joshua Habermanf41049a2022-01-21 14:41:25 -08007584UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007585 return (google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google__protobuf__EnumValueDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007586}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007587UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7588 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007589 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007590 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueDescriptorProto_msg_init, NULL, 0, arena) !=
7591 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007592 return NULL;
7593 }
7594 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007595}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007596UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size,
7597 const upb_ExtensionRegistry* extreg,
7598 int options, upb_Arena* arena) {
7599 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
7600 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007601 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueDescriptorProto_msg_init, extreg, options,
7602 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007603 return NULL;
7604 }
7605 return ret;
7606}
7607UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007608 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007609 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007610 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007611}
7612UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options,
7613 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007614 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007615 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007616 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007617}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007618UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007619 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007620 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007621}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007622UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007623 upb_StringView default_val = upb_StringView_FromString("");
7624 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007625 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007626 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7627 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007628 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007629}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007630UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007631 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007632 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007633}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007634UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007635 const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007636 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007637}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007638UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007639 int32_t default_val = (int32_t)0;
7640 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007641 const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007642 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7643 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007644 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007645}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007646UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007647 const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007648 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007649}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007650UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007651 const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007652 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007653}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007654UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007655 const google_protobuf_EnumValueOptions* default_val = NULL;
7656 const google_protobuf_EnumValueOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007657 const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007658 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7659 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007660 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007661}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007662UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007663 const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007664 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007665}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007666
Joshua Habermanf41049a2022-01-21 14:41:25 -08007667UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007668 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007669 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007670}
7671UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007672 const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007673 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007674}
7675UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007676 const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007677 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007678}
7679UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007680 struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
7681 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007682 sub = (struct google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007683 if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007684 }
7685 return sub;
7686}
7687
7688/* google.protobuf.ServiceDescriptorProto */
7689
Joshua Habermanf41049a2022-01-21 14:41:25 -08007690UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007691 return (google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google__protobuf__ServiceDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007692}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007693UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7694 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007695 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007696 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceDescriptorProto_msg_init, NULL, 0, arena) !=
7697 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007698 return NULL;
7699 }
7700 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007701}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007702UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size,
7703 const upb_ExtensionRegistry* extreg,
7704 int options, upb_Arena* arena) {
7705 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
7706 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007707 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceDescriptorProto_msg_init, extreg, options,
7708 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007709 return NULL;
7710 }
7711 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007712}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007713UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007714 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007715 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007716 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007717}
7718UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options,
7719 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007720 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007721 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007722 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007723}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007724UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007725 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007726 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007727}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007728UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007729 upb_StringView default_val = upb_StringView_FromString("");
7730 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007731 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007732 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7733 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007734 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007735}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007736UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007737 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007738 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007739}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007740UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007741 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007742 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007743}
Eric Salob7d54ac2022-12-29 11:59:42 -08007744UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007745 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007746 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007747 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007748 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007749 return (const google_protobuf_MethodDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007750 } else {
7751 if (size) *size = 0;
7752 return NULL;
7753 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007754}
Deanna Garciab26afb52023-04-25 13:37:18 -07007755UPB_INLINE const upb_Array* _google_protobuf_ServiceDescriptorProto_method_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007756 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007757 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007758 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007759 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007760 }
7761 return arr;
7762}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007763UPB_INLINE upb_Array* _google_protobuf_ServiceDescriptorProto_method_mutable_upb_array(google_protobuf_ServiceDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007764 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007765 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7766 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007767 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007768 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007769 }
7770 return arr;
7771}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007772UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007773 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007774 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007775}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007776UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007777 const google_protobuf_ServiceOptions* default_val = NULL;
7778 const google_protobuf_ServiceOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007779 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007780 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7781 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007782 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007783}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007784UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007785 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007786 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007787}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007788
Joshua Habermanf41049a2022-01-21 14:41:25 -08007789UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007790 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007791 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007792}
7793UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007794 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007795 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007796 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007797 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007798 return (google_protobuf_MethodDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007799 } else {
7800 if (size) *size = 0;
7801 return NULL;
7802 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007803}
Eric Salob7d54ac2022-12-29 11:59:42 -08007804UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007805 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007806 return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7807 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007808}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007809UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007810 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007811 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7812 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007813 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007814 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007815 return NULL;
7816 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007817 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 -08007818 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007819 UPB_PRIVATE(_upb_Array_Set)
7820 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007821 return sub;
7822}
7823UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007824 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007825 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007826}
7827UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007828 struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
7829 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007830 sub = (struct google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007831 if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007832 }
7833 return sub;
7834}
7835
7836/* google.protobuf.MethodDescriptorProto */
7837
Joshua Habermanf41049a2022-01-21 14:41:25 -08007838UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007839 return (google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google__protobuf__MethodDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007840}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007841UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7842 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007843 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007844 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodDescriptorProto_msg_init, NULL, 0, arena) !=
7845 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007846 return NULL;
7847 }
7848 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007849}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007850UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size,
7851 const upb_ExtensionRegistry* extreg,
7852 int options, upb_Arena* arena) {
7853 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
7854 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007855 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodDescriptorProto_msg_init, extreg, options,
7856 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007857 return NULL;
7858 }
7859 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007860}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007861UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007862 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007863 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007864 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007865}
7866UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options,
7867 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007868 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007869 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007870 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007871}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007872UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007873 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007874 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007875}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007876UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007877 upb_StringView default_val = upb_StringView_FromString("");
7878 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007879 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007880 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7881 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007882 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007883}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007884UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007885 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007886 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007887}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007888UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007889 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007890 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007891}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007892UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007893 upb_StringView default_val = upb_StringView_FromString("");
7894 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007895 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007896 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7897 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007898 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007899}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007900UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007901 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007902 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007903}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007904UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007905 const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007906 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007907}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007908UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007909 upb_StringView default_val = upb_StringView_FromString("");
7910 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007911 const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007912 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7913 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007914 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007915}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007916UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007917 const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007918 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007919}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007920UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007921 const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007922 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007923}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007924UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007925 const google_protobuf_MethodOptions* default_val = NULL;
7926 const google_protobuf_MethodOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007927 const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007928 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7929 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007930 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007931}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007932UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007933 const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007934 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007935}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007936UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007937 const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007938 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007939}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007940UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007941 bool default_val = false;
7942 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007943 const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007944 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7945 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007946 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007947}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007948UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007949 const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007950 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007951}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007952UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007953 const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007954 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007955}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007956UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007957 bool default_val = false;
7958 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007959 const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007960 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7961 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007962 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007963}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007964UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007965 const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007966 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007967}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007968
Joshua Habermanf41049a2022-01-21 14:41:25 -08007969UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007970 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007971 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007972}
7973UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007974 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007975 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007976}
7977UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007978 const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007979 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007980}
7981UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007982 const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007983 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007984}
7985UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007986 struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
7987 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007988 sub = (struct google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007989 if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007990 }
7991 return sub;
7992}
7993UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007994 const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007995 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007996}
7997UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007998 const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007999 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008000}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008001
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008002/* google.protobuf.FileOptions */
8003
Joshua Habermanf41049a2022-01-21 14:41:25 -08008004UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008005 return (google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008006}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008007UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8008 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008009 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008010 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileOptions_msg_init, NULL, 0, arena) !=
8011 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008012 return NULL;
8013 }
8014 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008015}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008016UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size,
8017 const upb_ExtensionRegistry* extreg,
8018 int options, upb_Arena* arena) {
8019 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
8020 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008021 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileOptions_msg_init, extreg, options,
8022 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08008023 return NULL;
8024 }
8025 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008026}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008027UPB_INLINE char* google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008028 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008029 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008030 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008031}
8032UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options,
8033 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008034 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008035 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008036 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008037}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008038UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008039 const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008040 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008041}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008042UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008043 upb_StringView default_val = upb_StringView_FromString("");
8044 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008045 const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008046 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8047 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008048 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008049}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008050UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008051 const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008052 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008053}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008054UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008055 const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008056 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008057}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008058UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008059 upb_StringView default_val = upb_StringView_FromString("");
8060 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008061 const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008062 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8063 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008064 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008065}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008066UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008067 const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008068 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008069}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008070UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008071 const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008072 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008073}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008074UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008075 int32_t default_val = 1;
8076 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008077 const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008078 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8079 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008080 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008081}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008082UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008083 const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008084 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008085}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008086UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008087 const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008088 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008089}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008090UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008091 bool default_val = false;
8092 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008093 const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008094 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8095 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008096 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008097}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008098UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008099 const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008100 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008101}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008102UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008103 const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008104 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008105}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008106UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008107 upb_StringView default_val = upb_StringView_FromString("");
8108 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008109 const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008110 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8111 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008112 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008113}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008114UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008115 const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008116 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008117}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008118UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008119 const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008120 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008121}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008122UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008123 bool default_val = false;
8124 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008125 const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008126 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8127 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008128 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008129}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008130UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008131 const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008132 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008133}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008134UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008135 const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008136 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008137}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008138UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008139 bool default_val = false;
8140 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008141 const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008142 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8143 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008144 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008145}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008146UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008147 const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008148 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008149}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008150UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008151 const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008152 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008153}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008154UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008155 bool default_val = false;
8156 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008157 const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008158 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8159 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008160 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008161}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008162UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008163 const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008164 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008165}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008166UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008167 const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008168 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008169}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008170UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008171 bool default_val = false;
8172 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008173 const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008174 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8175 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008176 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008177}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008178UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008179 const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008180 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008181}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008182UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008183 const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008184 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008185}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008186UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008187 bool default_val = false;
8188 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008189 const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008190 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8191 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008192 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008193}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008194UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008195 const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008196 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008197}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008198UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008199 const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008200 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008201}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008202UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008203 bool default_val = false;
8204 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008205 const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008206 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8207 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008208 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008209}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008210UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008211 const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008212 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008213}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008214UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008215 const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008216 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008217}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008218UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008219 bool default_val = true;
8220 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008221 const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008222 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8223 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008224 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008225}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008226UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008227 const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008228 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008229}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008230UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008231 const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008232 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008233}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008234UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008235 upb_StringView default_val = upb_StringView_FromString("");
8236 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008237 const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008238 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8239 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008240 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008241}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008242UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008243 const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008244 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008245}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008246UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008247 const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008248 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008249}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008250UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008251 upb_StringView default_val = upb_StringView_FromString("");
8252 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008253 const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008254 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8255 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008256 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008257}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008258UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008259 const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008260 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008261}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008262UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008263 const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008264 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008265}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008266UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008267 upb_StringView default_val = upb_StringView_FromString("");
8268 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008269 const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008270 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8271 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008272 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008273}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008274UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008275 const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008276 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008277}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008278UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008279 const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008280 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008281}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008282UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008283 upb_StringView default_val = upb_StringView_FromString("");
8284 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008285 const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008286 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8287 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008288 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008289}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008290UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008291 const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008292 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008293}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008294UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008295 const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008296 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008297}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008298UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008299 upb_StringView default_val = upb_StringView_FromString("");
8300 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008301 const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008302 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8303 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008304 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008305}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008306UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008307 const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008308 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008309}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008310UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008311 const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008312 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008313}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008314UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008315 upb_StringView default_val = upb_StringView_FromString("");
8316 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008317 const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008318 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8319 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008320 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008321}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008322UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008323 const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008324 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008325}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008326UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008327 const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008328 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008329}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008330UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008331 upb_StringView default_val = upb_StringView_FromString("");
8332 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008333 const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008334 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8335 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008336 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008337}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008338UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008339 const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008340 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008341}
8342UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008343 const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008344 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008345}
8346UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) {
8347 const google_protobuf_FeatureSet* default_val = NULL;
8348 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008349 const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008350 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8351 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008352 return ret;
8353}
8354UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008355 const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008356 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008357}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008358UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008359 const upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008360 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008361}
Eric Salob7d54ac2022-12-29 11:59:42 -08008362UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008363 const upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008364 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008365 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008366 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008367 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008368 } else {
8369 if (size) *size = 0;
8370 return NULL;
8371 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008372}
Deanna Garciab26afb52023-04-25 13:37:18 -07008373UPB_INLINE const upb_Array* _google_protobuf_FileOptions_uninterpreted_option_upb_array(const google_protobuf_FileOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008374 const upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008375 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008376 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008377 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008378 }
8379 return arr;
8380}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008381UPB_INLINE upb_Array* _google_protobuf_FileOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FileOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008382 const upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008383 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8384 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008385 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008386 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008387 }
8388 return arr;
8389}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008390
Joshua Habermanf41049a2022-01-21 14:41:25 -08008391UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008392 const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008393 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008394}
8395UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008396 const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008397 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008398}
8399UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008400 const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008401 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008402}
8403UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008404 const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008405 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008406}
8407UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008408 const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008409 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008410}
8411UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008412 const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008413 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008414}
8415UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008416 const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008417 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008418}
8419UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008420 const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008421 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008422}
8423UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008424 const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008425 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008426}
8427UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008428 const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008429 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008430}
8431UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008432 const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008433 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008434}
8435UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008436 const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008437 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008438}
8439UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008440 const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008441 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008442}
8443UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008444 const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008445 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008446}
8447UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008448 const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008449 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008450}
8451UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008452 const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008453 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008454}
8455UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008456 const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008457 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008458}
8459UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008460 const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008461 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008462}
8463UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008464 const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008465 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008466}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008467UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008468 const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008469 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008470}
8471UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) {
8472 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg);
8473 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008474 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008475 if (sub) google_protobuf_FileOptions_set_features(msg, sub);
8476 }
8477 return sub;
8478}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008479UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008480 upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008481 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008482 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008483 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008484 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008485 } else {
8486 if (size) *size = 0;
8487 return NULL;
8488 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008489}
Eric Salob7d54ac2022-12-29 11:59:42 -08008490UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008491 upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008492 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
8493 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008494}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008495UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008496 upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008497 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8498 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008499 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008500 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08008501 return NULL;
8502 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008503 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 -08008504 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008505 UPB_PRIVATE(_upb_Array_Set)
8506 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008507 return sub;
8508}
8509
8510/* google.protobuf.MessageOptions */
8511
Joshua Habermanf41049a2022-01-21 14:41:25 -08008512UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008513 return (google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008514}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008515UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8516 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008517 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008518 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MessageOptions_msg_init, NULL, 0, arena) !=
8519 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008520 return NULL;
8521 }
8522 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008523}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008524UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size,
8525 const upb_ExtensionRegistry* extreg,
8526 int options, upb_Arena* arena) {
8527 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
8528 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008529 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MessageOptions_msg_init, extreg, options,
8530 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08008531 return NULL;
8532 }
8533 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008534}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008535UPB_INLINE char* google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008536 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008537 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MessageOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008538 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008539}
8540UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options,
8541 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008542 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008543 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MessageOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008544 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008545}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008546UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008547 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008548 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008549}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008550UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008551 bool default_val = false;
8552 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008553 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008554 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8555 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008556 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008557}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008558UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008559 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008560 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008561}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008562UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008563 const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008564 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008565}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008566UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008567 bool default_val = false;
8568 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008569 const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008570 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8571 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008572 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008573}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008574UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008575 const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008576 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008577}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008578UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008579 const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008580 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008581}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008582UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008583 bool default_val = false;
8584 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008585 const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008586 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8587 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008588 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008589}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008590UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008591 const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008592 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008593}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008594UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008595 const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008596 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008597}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008598UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008599 bool default_val = false;
8600 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008601 const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008602 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8603 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008604 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008605}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008606UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008607 const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008608 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008609}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008610UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008611 const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008612 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008613}
8614UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
8615 bool default_val = false;
8616 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008617 const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008618 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8619 &default_val, &ret);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008620 return ret;
8621}
8622UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008623 const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008624 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008625}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008626UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008627 const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008628 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008629}
8630UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) {
8631 const google_protobuf_FeatureSet* default_val = NULL;
8632 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008633 const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008634 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8635 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008636 return ret;
8637}
8638UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008639 const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008640 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008641}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008642UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008643 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008644 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008645}
Eric Salob7d54ac2022-12-29 11:59:42 -08008646UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008647 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008648 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008649 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008650 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008651 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008652 } else {
8653 if (size) *size = 0;
8654 return NULL;
8655 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008656}
Deanna Garciab26afb52023-04-25 13:37:18 -07008657UPB_INLINE const upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_upb_array(const google_protobuf_MessageOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008658 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008659 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008660 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008661 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008662 }
8663 return arr;
8664}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008665UPB_INLINE upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_mutable_upb_array(google_protobuf_MessageOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008666 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008667 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8668 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008669 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008670 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008671 }
8672 return arr;
8673}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008674
8675UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008676 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008677 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008678}
8679UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008680 const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008681 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008682}
8683UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008684 const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008685 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008686}
8687UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008688 const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008689 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008690}
8691UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008692 const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008693 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008694}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008695UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008696 const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008697 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008698}
8699UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
8700 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg);
8701 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008702 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008703 if (sub) google_protobuf_MessageOptions_set_features(msg, sub);
8704 }
8705 return sub;
8706}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008707UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008708 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008709 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008710 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008711 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008712 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008713 } else {
8714 if (size) *size = 0;
8715 return NULL;
8716 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008717}
Eric Salob7d54ac2022-12-29 11:59:42 -08008718UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008719 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008720 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
8721 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008722}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008723UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008724 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008725 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8726 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008727 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008728 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08008729 return NULL;
8730 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008731 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 -08008732 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008733 UPB_PRIVATE(_upb_Array_Set)
8734 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008735 return sub;
8736}
8737
8738/* google.protobuf.FieldOptions */
8739
Joshua Habermanf41049a2022-01-21 14:41:25 -08008740UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008741 return (google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008742}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008743UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8744 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008745 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008746 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions_msg_init, NULL, 0, arena) !=
8747 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008748 return NULL;
8749 }
8750 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008751}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008752UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size,
8753 const upb_ExtensionRegistry* extreg,
8754 int options, upb_Arena* arena) {
8755 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
8756 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008757 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions_msg_init, extreg, options,
8758 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08008759 return NULL;
8760 }
8761 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008762}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008763UPB_INLINE char* google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008764 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008765 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008766 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008767}
8768UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options,
8769 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008770 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008771 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008772 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008773}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008774UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008775 const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008776 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008777}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008778UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008779 int32_t default_val = 0;
8780 int32_t ret;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008781 const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008782 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8783 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008784 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008785}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008786UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008787 const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008788 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008789}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008790UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008791 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008792 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008793}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008794UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008795 bool default_val = false;
8796 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008797 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008798 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8799 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008800 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008801}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008802UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008803 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008804 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008805}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008806UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008807 const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008808 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008809}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008810UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008811 bool default_val = false;
8812 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008813 const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008814 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8815 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008816 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008817}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008818UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008819 const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008820 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008821}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008822UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008823 const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008824 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008825}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008826UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008827 bool default_val = false;
8828 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008829 const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008830 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8831 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008832 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008833}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008834UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008835 const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008836 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008837}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008838UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008839 const upb_MiniTableField field = {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008840 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008841}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008842UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008843 int32_t default_val = 0;
8844 int32_t ret;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008845 const upb_MiniTableField field = {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008846 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8847 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008848 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008849}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008850UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008851 const upb_MiniTableField field = {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008852 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008853}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008854UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008855 const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008856 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008857}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008858UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008859 bool default_val = false;
8860 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008861 const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008862 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8863 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008864 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008865}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008866UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008867 const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008868 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008869}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008870UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008871 const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008872 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008873}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008874UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008875 bool default_val = false;
8876 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008877 const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008878 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8879 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008880 return ret;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008881}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008882UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008883 const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008884 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008885}
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008886UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008887 const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008888 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008889}
8890UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) {
8891 bool default_val = false;
8892 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008893 const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008894 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8895 &default_val, &ret);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008896 return ret;
8897}
8898UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008899 const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008900 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008901}
Adam Cozzette5a568372023-01-24 20:35:59 -08008902UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008903 const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008904 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008905}
8906UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) {
8907 int32_t default_val = 0;
8908 int32_t ret;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008909 const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008910 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8911 &default_val, &ret);
Adam Cozzette5a568372023-01-24 20:35:59 -08008912 return ret;
8913}
8914UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008915 const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008916 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008917}
Mike Kruskal0c121392023-03-18 00:05:41 -07008918UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008919 const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008920 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008921}
Mike Kruskal0c121392023-03-18 00:05:41 -07008922UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008923 const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008924 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal0c121392023-03-18 00:05:41 -07008925 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008926 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008927 return (int32_t const*)upb_Array_DataPtr(arr);
Mike Kruskal0c121392023-03-18 00:05:41 -07008928 } else {
8929 if (size) *size = 0;
8930 return NULL;
8931 }
Adam Cozzette5a568372023-01-24 20:35:59 -08008932}
Deanna Garciab26afb52023-04-25 13:37:18 -07008933UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008934 const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008935 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008936 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008937 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008938 }
8939 return arr;
8940}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008941UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008942 const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008943 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8944 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008945 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008946 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008947 }
8948 return arr;
8949}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008950UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008951 const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008952 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008953}
8954UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008955 const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008956 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008957 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008958 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008959 return (const google_protobuf_FieldOptions_EditionDefault* const*)upb_Array_DataPtr(arr);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008960 } else {
8961 if (size) *size = 0;
8962 return NULL;
8963 }
8964}
8965UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008966 const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008967 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008968 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008969 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008970 }
8971 return arr;
8972}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008973UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008974 const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008975 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8976 &field, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008977 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008978 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008979 }
8980 return arr;
8981}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008982UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008983 const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008984 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008985}
8986UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) {
8987 const google_protobuf_FeatureSet* default_val = NULL;
8988 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008989 const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008990 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8991 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008992 return ret;
8993}
8994UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008995 const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008996 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008997}
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008998UPB_INLINE void google_protobuf_FieldOptions_clear_feature_support(google_protobuf_FieldOptions* msg) {
8999 const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9000 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9001}
9002UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_feature_support(const google_protobuf_FieldOptions* msg) {
9003 const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL;
9004 const google_protobuf_FieldOptions_FeatureSupport* ret;
9005 const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9006 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9007 &default_val, &ret);
9008 return ret;
9009}
9010UPB_INLINE bool google_protobuf_FieldOptions_has_feature_support(const google_protobuf_FieldOptions* msg) {
9011 const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9012 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9013}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009014UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009015 const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009016 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009017}
Eric Salob7d54ac2022-12-29 11:59:42 -08009018UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009019 const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009020 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009021 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009022 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009023 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009024 } else {
9025 if (size) *size = 0;
9026 return NULL;
9027 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009028}
Deanna Garciab26afb52023-04-25 13:37:18 -07009029UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009030 const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009031 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009032 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009033 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009034 }
9035 return arr;
9036}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009037UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009038 const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009039 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9040 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009041 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009042 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009043 }
9044 return arr;
9045}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009046
9047UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009048 const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009049 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009050}
9051UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009052 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009053 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009054}
9055UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009056 const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009057 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009058}
9059UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009060 const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009061 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009062}
9063UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009064 const upb_MiniTableField field = {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009065 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009066}
9067UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009068 const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009069 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009070}
9071UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009072 const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009073 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009074}
9075UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009076 const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009077 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009078}
Adam Cozzette5a568372023-01-24 20:35:59 -08009079UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009080 const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009081 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Adam Cozzette5a568372023-01-24 20:35:59 -08009082}
Mike Kruskal0c121392023-03-18 00:05:41 -07009083UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009084 upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009085 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal0c121392023-03-18 00:05:41 -07009086 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009087 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009088 return (int32_t*)upb_Array_MutableDataPtr(arr);
Mike Kruskal0c121392023-03-18 00:05:41 -07009089 } else {
9090 if (size) *size = 0;
9091 return NULL;
9092 }
9093}
9094UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009095 upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009096 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9097 &field, size, arena);
Mike Kruskal0c121392023-03-18 00:05:41 -07009098}
9099UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009100 upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009101 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9102 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009103 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009104 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal0c121392023-03-18 00:05:41 -07009105 return false;
9106 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009107 UPB_PRIVATE(_upb_Array_Set)
9108 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Mike Kruskal0c121392023-03-18 00:05:41 -07009109 return true;
Adam Cozzette5a568372023-01-24 20:35:59 -08009110}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009111UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009112 upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009113 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009114 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009115 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009116 return (google_protobuf_FieldOptions_EditionDefault**)upb_Array_MutableDataPtr(arr);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009117 } else {
9118 if (size) *size = 0;
9119 return NULL;
9120 }
9121}
9122UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009123 upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009124 return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9125 &field, size, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009126}
9127UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009128 upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009129 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9130 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009131 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009132 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009133 return NULL;
9134 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009135 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 -07009136 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009137 UPB_PRIVATE(_upb_Array_Set)
9138 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009139 return sub;
9140}
9141UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009142 const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009143 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009144}
9145UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
9146 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg);
9147 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009148 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009149 if (sub) google_protobuf_FieldOptions_set_features(msg, sub);
9150 }
9151 return sub;
9152}
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009153UPB_INLINE void google_protobuf_FieldOptions_set_feature_support(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) {
9154 const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9155 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9156}
9157UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_mutable_feature_support(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
9158 struct google_protobuf_FieldOptions_FeatureSupport* sub = (struct google_protobuf_FieldOptions_FeatureSupport*)google_protobuf_FieldOptions_feature_support(msg);
9159 if (sub == NULL) {
9160 sub = (struct google_protobuf_FieldOptions_FeatureSupport*)_upb_Message_New(&google__protobuf__FieldOptions__FeatureSupport_msg_init, arena);
9161 if (sub) google_protobuf_FieldOptions_set_feature_support(msg, sub);
9162 }
9163 return sub;
9164}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009165UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009166 upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009167 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009168 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009169 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009170 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009171 } else {
9172 if (size) *size = 0;
9173 return NULL;
9174 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009175}
Eric Salob7d54ac2022-12-29 11:59:42 -08009176UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009177 upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009178 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9179 &field, size, arena);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009180}
9181UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009182 upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009183 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9184 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009185 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009186 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009187 return NULL;
9188 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009189 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 -08009190 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009191 UPB_PRIVATE(_upb_Array_Set)
9192 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009193 return sub;
9194}
9195
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009196/* google.protobuf.FieldOptions.EditionDefault */
9197
9198UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009199 return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009200}
9201UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
9202 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
9203 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009204 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__EditionDefault_msg_init, NULL, 0, arena) !=
9205 kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009206 return NULL;
9207 }
9208 return ret;
9209}
9210UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size,
9211 const upb_ExtensionRegistry* extreg,
9212 int options, upb_Arena* arena) {
9213 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
9214 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009215 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__EditionDefault_msg_init, extreg, options,
9216 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009217 return NULL;
9218 }
9219 return ret;
9220}
9221UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) {
9222 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009223 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__EditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009224 return ptr;
9225}
9226UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options,
9227 upb_Arena* arena, size_t* len) {
9228 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009229 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__EditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009230 return ptr;
9231}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009232UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009233 const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009234 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009235}
9236UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
9237 upb_StringView default_val = upb_StringView_FromString("");
9238 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009239 const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009240 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9241 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009242 return ret;
9243}
9244UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009245 const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009246 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009247}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009248UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009249 const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009250 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009251}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009252UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009253 int32_t default_val = 0;
9254 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009255 const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009256 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9257 &default_val, &ret);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009258 return ret;
9259}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009260UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009261 const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009262 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009263}
9264
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009265UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009266 const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009267 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009268}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009269UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009270 const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009271 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009272}
9273
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009274/* google.protobuf.FieldOptions.FeatureSupport */
9275
9276UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_new(upb_Arena* arena) {
9277 return (google_protobuf_FieldOptions_FeatureSupport*)_upb_Message_New(&google__protobuf__FieldOptions__FeatureSupport_msg_init, arena);
9278}
9279UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_parse(const char* buf, size_t size, upb_Arena* arena) {
9280 google_protobuf_FieldOptions_FeatureSupport* ret = google_protobuf_FieldOptions_FeatureSupport_new(arena);
9281 if (!ret) return NULL;
9282 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__FeatureSupport_msg_init, NULL, 0, arena) !=
9283 kUpb_DecodeStatus_Ok) {
9284 return NULL;
9285 }
9286 return ret;
9287}
9288UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_parse_ex(const char* buf, size_t size,
9289 const upb_ExtensionRegistry* extreg,
9290 int options, upb_Arena* arena) {
9291 google_protobuf_FieldOptions_FeatureSupport* ret = google_protobuf_FieldOptions_FeatureSupport_new(arena);
9292 if (!ret) return NULL;
9293 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__FeatureSupport_msg_init, extreg, options,
9294 arena) != kUpb_DecodeStatus_Ok) {
9295 return NULL;
9296 }
9297 return ret;
9298}
9299UPB_INLINE char* google_protobuf_FieldOptions_FeatureSupport_serialize(const google_protobuf_FieldOptions_FeatureSupport* msg, upb_Arena* arena, size_t* len) {
9300 char* ptr;
9301 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__FeatureSupport_msg_init, 0, arena, &ptr, len);
9302 return ptr;
9303}
9304UPB_INLINE char* google_protobuf_FieldOptions_FeatureSupport_serialize_ex(const google_protobuf_FieldOptions_FeatureSupport* msg, int options,
9305 upb_Arena* arena, size_t* len) {
9306 char* ptr;
9307 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__FeatureSupport_msg_init, options, arena, &ptr, len);
9308 return ptr;
9309}
9310UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_introduced(google_protobuf_FieldOptions_FeatureSupport* msg) {
9311 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9312 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9313}
9314UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_introduced(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9315 int32_t default_val = 0;
9316 int32_t ret;
9317 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9318 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9319 &default_val, &ret);
9320 return ret;
9321}
9322UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_introduced(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9323 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9324 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9325}
9326UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_deprecated(google_protobuf_FieldOptions_FeatureSupport* msg) {
9327 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9328 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9329}
9330UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_deprecated(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9331 int32_t default_val = 0;
9332 int32_t ret;
9333 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9334 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9335 &default_val, &ret);
9336 return ret;
9337}
9338UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_deprecated(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9339 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9340 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9341}
9342UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_deprecation_warning(google_protobuf_FieldOptions_FeatureSupport* msg) {
9343 const upb_MiniTableField field = {3, 24, 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9344 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9345}
9346UPB_INLINE upb_StringView google_protobuf_FieldOptions_FeatureSupport_deprecation_warning(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9347 upb_StringView default_val = upb_StringView_FromString("");
9348 upb_StringView ret;
9349 const upb_MiniTableField field = {3, 24, 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9350 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9351 &default_val, &ret);
9352 return ret;
9353}
9354UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_deprecation_warning(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9355 const upb_MiniTableField field = {3, 24, 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9356 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9357}
9358UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_removed(google_protobuf_FieldOptions_FeatureSupport* msg) {
9359 const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9360 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9361}
9362UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_removed(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9363 int32_t default_val = 0;
9364 int32_t ret;
9365 const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9366 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9367 &default_val, &ret);
9368 return ret;
9369}
9370UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_removed(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9371 const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9372 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9373}
9374
9375UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_introduced(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9376 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9377 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9378}
9379UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_deprecated(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9380 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9381 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9382}
9383UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_deprecation_warning(google_protobuf_FieldOptions_FeatureSupport *msg, upb_StringView value) {
9384 const upb_MiniTableField field = {3, 24, 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9385 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9386}
9387UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_removed(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9388 const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9389 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9390}
9391
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009392/* google.protobuf.OneofOptions */
9393
Joshua Habermanf41049a2022-01-21 14:41:25 -08009394UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009395 return (google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009396}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009397UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9398 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009399 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009400 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofOptions_msg_init, NULL, 0, arena) !=
9401 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009402 return NULL;
9403 }
9404 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009405}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009406UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size,
9407 const upb_ExtensionRegistry* extreg,
9408 int options, upb_Arena* arena) {
9409 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
9410 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009411 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofOptions_msg_init, extreg, options,
9412 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009413 return NULL;
9414 }
9415 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009416}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009417UPB_INLINE char* google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009418 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009419 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009420 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009421}
9422UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options,
9423 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009424 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009425 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009426 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009427}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009428UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009429 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009430 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009431}
9432UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) {
9433 const google_protobuf_FeatureSet* default_val = NULL;
9434 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009435 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009436 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9437 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009438 return ret;
9439}
9440UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009441 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009442 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009443}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009444UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009445 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009446 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009447}
Eric Salob7d54ac2022-12-29 11:59:42 -08009448UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009449 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009450 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009451 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009452 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009453 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009454 } else {
9455 if (size) *size = 0;
9456 return NULL;
9457 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009458}
Deanna Garciab26afb52023-04-25 13:37:18 -07009459UPB_INLINE const upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_upb_array(const google_protobuf_OneofOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009460 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009461 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009462 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009463 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009464 }
9465 return arr;
9466}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009467UPB_INLINE upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_mutable_upb_array(google_protobuf_OneofOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009468 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009469 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9470 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009471 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009472 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009473 }
9474 return arr;
9475}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009476
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009477UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009478 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009479 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009480}
9481UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
9482 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg);
9483 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009484 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009485 if (sub) google_protobuf_OneofOptions_set_features(msg, sub);
9486 }
9487 return sub;
9488}
Eric Salob7d54ac2022-12-29 11:59:42 -08009489UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009490 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009491 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009492 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009493 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009494 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009495 } else {
9496 if (size) *size = 0;
9497 return NULL;
9498 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009499}
Eric Salob7d54ac2022-12-29 11:59:42 -08009500UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009501 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009502 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9503 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009504}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009505UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009506 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009507 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9508 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009509 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009510 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009511 return NULL;
9512 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009513 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 -08009514 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009515 UPB_PRIVATE(_upb_Array_Set)
9516 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009517 return sub;
9518}
9519
9520/* google.protobuf.EnumOptions */
9521
Joshua Habermanf41049a2022-01-21 14:41:25 -08009522UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009523 return (google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009524}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009525UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9526 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009527 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009528 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumOptions_msg_init, NULL, 0, arena) !=
9529 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009530 return NULL;
9531 }
9532 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009533}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009534UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size,
9535 const upb_ExtensionRegistry* extreg,
9536 int options, upb_Arena* arena) {
9537 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
9538 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009539 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumOptions_msg_init, extreg, options,
9540 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009541 return NULL;
9542 }
9543 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009544}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009545UPB_INLINE char* google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009546 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009547 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009548 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009549}
9550UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options,
9551 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009552 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009553 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009554 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009555}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009556UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009557 const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009558 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009559}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009560UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009561 bool default_val = false;
9562 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009563 const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009564 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9565 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009566 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009567}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009568UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009569 const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009570 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009571}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009572UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009573 const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009574 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009575}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009576UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009577 bool default_val = false;
9578 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009579 const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009580 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9581 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009582 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009583}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009584UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009585 const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009586 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009587}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009588UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009589 const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009590 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009591}
9592UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
9593 bool default_val = false;
9594 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009595 const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009596 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9597 &default_val, &ret);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009598 return ret;
9599}
9600UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009601 const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009602 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009603}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009604UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009605 const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009606 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009607}
9608UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) {
9609 const google_protobuf_FeatureSet* default_val = NULL;
9610 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009611 const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009612 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9613 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009614 return ret;
9615}
9616UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009617 const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009618 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009619}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009620UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009621 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009622 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009623}
Eric Salob7d54ac2022-12-29 11:59:42 -08009624UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009625 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009626 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009627 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009628 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009629 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009630 } else {
9631 if (size) *size = 0;
9632 return NULL;
9633 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009634}
Deanna Garciab26afb52023-04-25 13:37:18 -07009635UPB_INLINE const upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_upb_array(const google_protobuf_EnumOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009636 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009637 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009638 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009639 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009640 }
9641 return arr;
9642}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009643UPB_INLINE upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009644 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009645 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9646 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009647 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009648 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009649 }
9650 return arr;
9651}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009652
9653UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009654 const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009655 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009656}
9657UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009658 const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009659 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009660}
9661UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009662 const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009663 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009664}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009665UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009666 const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009667 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009668}
9669UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
9670 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg);
9671 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009672 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009673 if (sub) google_protobuf_EnumOptions_set_features(msg, sub);
9674 }
9675 return sub;
9676}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009677UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009678 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009679 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009680 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009681 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009682 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009683 } else {
9684 if (size) *size = 0;
9685 return NULL;
9686 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009687}
Eric Salob7d54ac2022-12-29 11:59:42 -08009688UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009689 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009690 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9691 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009692}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009693UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009694 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009695 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9696 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009697 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009698 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009699 return NULL;
9700 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009701 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 -08009702 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009703 UPB_PRIVATE(_upb_Array_Set)
9704 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009705 return sub;
9706}
9707
9708/* google.protobuf.EnumValueOptions */
9709
Joshua Habermanf41049a2022-01-21 14:41:25 -08009710UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009711 return (google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009712}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009713UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9714 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009715 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009716 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueOptions_msg_init, NULL, 0, arena) !=
9717 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009718 return NULL;
9719 }
9720 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009721}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009722UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size,
9723 const upb_ExtensionRegistry* extreg,
9724 int options, upb_Arena* arena) {
9725 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
9726 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009727 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueOptions_msg_init, extreg, options,
9728 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009729 return NULL;
9730 }
9731 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009732}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009733UPB_INLINE char* google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009734 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009735 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009736 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009737}
9738UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options,
9739 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009740 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009741 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009742 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009743}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009744UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009745 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009746 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009747}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009748UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009749 bool default_val = false;
9750 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009751 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009752 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9753 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009754 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009755}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009756UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009757 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009758 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009759}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009760UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009761 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009762 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009763}
9764UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) {
9765 const google_protobuf_FeatureSet* default_val = NULL;
9766 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009767 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009768 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9769 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009770 return ret;
9771}
9772UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009773 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009774 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009775}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009776UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009777 const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009778 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009779}
9780UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) {
9781 bool default_val = false;
9782 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009783 const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009784 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9785 &default_val, &ret);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009786 return ret;
9787}
9788UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009789 const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009790 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009791}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009792UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009793 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009794 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009795}
Eric Salob7d54ac2022-12-29 11:59:42 -08009796UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009797 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009798 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009799 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009800 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009801 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009802 } else {
9803 if (size) *size = 0;
9804 return NULL;
9805 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009806}
Deanna Garciab26afb52023-04-25 13:37:18 -07009807UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009808 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009809 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009810 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009811 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009812 }
9813 return arr;
9814}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009815UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009816 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009817 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9818 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009819 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009820 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009821 }
9822 return arr;
9823}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009824
9825UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009826 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009827 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009828}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009829UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009830 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009831 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009832}
9833UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
9834 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg);
9835 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009836 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009837 if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub);
9838 }
9839 return sub;
9840}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009841UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009842 const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009843 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009844}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009845UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009846 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009847 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009848 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009849 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009850 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009851 } else {
9852 if (size) *size = 0;
9853 return NULL;
9854 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009855}
Eric Salob7d54ac2022-12-29 11:59:42 -08009856UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009857 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009858 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9859 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009860}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009861UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009862 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009863 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9864 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009865 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009866 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009867 return NULL;
9868 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009869 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 -08009870 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009871 UPB_PRIVATE(_upb_Array_Set)
9872 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009873 return sub;
9874}
9875
9876/* google.protobuf.ServiceOptions */
9877
Joshua Habermanf41049a2022-01-21 14:41:25 -08009878UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009879 return (google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009880}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009881UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9882 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009883 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009884 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceOptions_msg_init, NULL, 0, arena) !=
9885 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009886 return NULL;
9887 }
9888 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009889}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009890UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size,
9891 const upb_ExtensionRegistry* extreg,
9892 int options, upb_Arena* arena) {
9893 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
9894 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009895 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceOptions_msg_init, extreg, options,
9896 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009897 return NULL;
9898 }
9899 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009900}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009901UPB_INLINE char* google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009902 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009903 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009904 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009905}
9906UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options,
9907 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009908 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009909 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009910 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009911}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009912UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009913 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009914 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009915}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009916UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009917 bool default_val = false;
9918 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009919 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009920 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9921 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009922 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009923}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009924UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009925 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009926 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009927}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009928UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009929 const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009930 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009931}
9932UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) {
9933 const google_protobuf_FeatureSet* default_val = NULL;
9934 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009935 const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009936 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9937 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009938 return ret;
9939}
9940UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009941 const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009942 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009943}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009944UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009945 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009946 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009947}
Eric Salob7d54ac2022-12-29 11:59:42 -08009948UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009949 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009950 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009951 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009952 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009953 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009954 } else {
9955 if (size) *size = 0;
9956 return NULL;
9957 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009958}
Deanna Garciab26afb52023-04-25 13:37:18 -07009959UPB_INLINE const upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009960 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009961 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009962 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009963 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009964 }
9965 return arr;
9966}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009967UPB_INLINE upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_mutable_upb_array(google_protobuf_ServiceOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009968 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009969 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9970 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009971 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009972 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009973 }
9974 return arr;
9975}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009976
9977UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009978 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009979 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009980}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009981UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009982 const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009983 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009984}
9985UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
9986 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg);
9987 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009988 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009989 if (sub) google_protobuf_ServiceOptions_set_features(msg, sub);
9990 }
9991 return sub;
9992}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009993UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009994 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009995 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009996 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009997 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009998 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009999 } else {
10000 if (size) *size = 0;
10001 return NULL;
10002 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010003}
Eric Salob7d54ac2022-12-29 11:59:42 -080010004UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010005 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010006 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10007 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010008}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010009UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010010 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010011 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10012 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010013 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010014 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010015 return NULL;
10016 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010017 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 -080010018 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010019 UPB_PRIVATE(_upb_Array_Set)
10020 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010021 return sub;
10022}
10023
10024/* google.protobuf.MethodOptions */
10025
Joshua Habermanf41049a2022-01-21 14:41:25 -080010026UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010027 return (google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010028}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010029UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
10030 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010031 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010032 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodOptions_msg_init, NULL, 0, arena) !=
10033 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010034 return NULL;
10035 }
10036 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010037}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010038UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size,
10039 const upb_ExtensionRegistry* extreg,
10040 int options, upb_Arena* arena) {
10041 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
10042 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010043 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodOptions_msg_init, extreg, options,
10044 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010045 return NULL;
10046 }
10047 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010048}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010049UPB_INLINE char* google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010050 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010051 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010052 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010053}
10054UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options,
10055 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010056 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010057 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010058 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010059}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010060UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010061 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010062 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010063}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010064UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010065 bool default_val = false;
10066 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010067 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010068 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10069 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010070 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010071}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010072UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010073 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010074 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010075}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010076UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010077 const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010078 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010079}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010080UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010081 int32_t default_val = 0;
10082 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010083 const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010084 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10085 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010086 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010087}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010088UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010089 const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010090 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010091}
10092UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010093 const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010094 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010095}
10096UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) {
10097 const google_protobuf_FeatureSet* default_val = NULL;
10098 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010099 const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010100 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10101 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010102 return ret;
10103}
10104UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010105 const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010106 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010107}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010108UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010109 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010110 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010111}
Eric Salob7d54ac2022-12-29 11:59:42 -080010112UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010113 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010114 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010115 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010116 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010117 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010118 } else {
10119 if (size) *size = 0;
10120 return NULL;
10121 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010122}
Deanna Garciab26afb52023-04-25 13:37:18 -070010123UPB_INLINE const upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_upb_array(const google_protobuf_MethodOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010124 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010125 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010126 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010127 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010128 }
10129 return arr;
10130}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010131UPB_INLINE upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_mutable_upb_array(google_protobuf_MethodOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010132 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010133 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10134 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010135 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010136 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010137 }
10138 return arr;
10139}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010140
10141UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010142 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010143 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010144}
10145UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010146 const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010147 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010148}
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010149UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010150 const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010151 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010152}
10153UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
10154 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg);
10155 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010156 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010157 if (sub) google_protobuf_MethodOptions_set_features(msg, sub);
10158 }
10159 return sub;
10160}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010161UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010162 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010163 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010164 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010165 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010166 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010167 } else {
10168 if (size) *size = 0;
10169 return NULL;
10170 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010171}
Eric Salob7d54ac2022-12-29 11:59:42 -080010172UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010173 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010174 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10175 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010176}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010177UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010178 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010179 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10180 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010181 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010182 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010183 return NULL;
10184 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010185 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 -080010186 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010187 UPB_PRIVATE(_upb_Array_Set)
10188 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010189 return sub;
10190}
10191
10192/* google.protobuf.UninterpretedOption */
10193
Joshua Habermanf41049a2022-01-21 14:41:25 -080010194UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010195 return (google_protobuf_UninterpretedOption*)_upb_Message_New(&google__protobuf__UninterpretedOption_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010196}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010197UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) {
10198 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010199 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010200 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption_msg_init, NULL, 0, arena) !=
10201 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010202 return NULL;
10203 }
10204 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010205}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010206UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size,
10207 const upb_ExtensionRegistry* extreg,
10208 int options, upb_Arena* arena) {
10209 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
10210 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010211 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption_msg_init, extreg, options,
10212 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010213 return NULL;
10214 }
10215 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010216}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010217UPB_INLINE char* google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010218 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010219 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010220 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010221}
10222UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options,
10223 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010224 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010225 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010226 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010227}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010228UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010229 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010230 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010231}
Eric Salob7d54ac2022-12-29 11:59:42 -080010232UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010233 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010234 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010235 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010236 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010237 return (const google_protobuf_UninterpretedOption_NamePart* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010238 } else {
10239 if (size) *size = 0;
10240 return NULL;
10241 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010242}
Deanna Garciab26afb52023-04-25 13:37:18 -070010243UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010244 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010245 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010246 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010247 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010248 }
10249 return arr;
10250}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010251UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010252 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010253 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10254 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010255 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010256 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010257 }
10258 return arr;
10259}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010260UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010261 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010262 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010263}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010264UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010265 upb_StringView default_val = upb_StringView_FromString("");
10266 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010267 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010268 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10269 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010270 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010271}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010272UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010273 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010274 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010275}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010276UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010277 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010278 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010279}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010280UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010281 uint64_t default_val = (uint64_t)0ull;
10282 uint64_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010283 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010284 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10285 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010286 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010287}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010288UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010289 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010290 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010291}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010292UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010293 const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010294 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010295}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010296UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010297 int64_t default_val = (int64_t)0ll;
10298 int64_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010299 const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010300 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10301 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010302 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010303}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010304UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010305 const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010306 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010307}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010308UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010309 const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010310 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010311}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010312UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010313 double default_val = 0;
10314 double ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010315 const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010316 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10317 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010318 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010319}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010320UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010321 const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010322 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010323}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010324UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010325 const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010326 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010327}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010328UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010329 upb_StringView default_val = upb_StringView_FromString("");
10330 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010331 const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010332 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10333 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010334 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010335}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010336UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010337 const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010338 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010339}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010340UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010341 const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010342 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010343}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010344UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010345 upb_StringView default_val = upb_StringView_FromString("");
10346 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010347 const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010348 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10349 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010350 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010351}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010352UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010353 const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010354 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010355}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010356
Eric Salob7d54ac2022-12-29 11:59:42 -080010357UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010358 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010359 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010360 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010361 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010362 return (google_protobuf_UninterpretedOption_NamePart**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010363 } else {
10364 if (size) *size = 0;
10365 return NULL;
10366 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010367}
Eric Salob7d54ac2022-12-29 11:59:42 -080010368UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010369 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010370 return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10371 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010372}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010373UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010374 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010375 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10376 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010377 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010378 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010379 return NULL;
10380 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010381 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 -080010382 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010383 UPB_PRIVATE(_upb_Array_Set)
10384 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010385 return sub;
10386}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010387UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010388 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010389 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010390}
10391UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010392 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010393 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010394}
10395UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010396 const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010397 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010398}
10399UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010400 const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010401 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010402}
10403UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010404 const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010405 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010406}
10407UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010408 const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010409 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010410}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010411
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010412/* google.protobuf.UninterpretedOption.NamePart */
10413
Joshua Habermanf41049a2022-01-21 14:41:25 -080010414UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010415 return (google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google__protobuf__UninterpretedOption__NamePart_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010416}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010417UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) {
10418 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010419 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010420 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption__NamePart_msg_init, NULL, 0, arena) !=
10421 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010422 return NULL;
10423 }
10424 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010425}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010426UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size,
10427 const upb_ExtensionRegistry* extreg,
10428 int options, upb_Arena* arena) {
10429 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
10430 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010431 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption__NamePart_msg_init, extreg, options,
10432 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010433 return NULL;
10434 }
10435 return ret;
10436}
10437UPB_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 -070010438 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010439 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption__NamePart_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010440 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010441}
10442UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options,
10443 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010444 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010445 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption__NamePart_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010446 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010447}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010448UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010449 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010450 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010451}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010452UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010453 upb_StringView default_val = upb_StringView_FromString("");
10454 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010455 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010456 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10457 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010458 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010459}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010460UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010461 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010462 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010463}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010464UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010465 const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010466 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010467}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010468UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010469 bool default_val = false;
10470 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010471 const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010472 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10473 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010474 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010475}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010476UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010477 const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010478 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010479}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010480
Joshua Habermanf41049a2022-01-21 14:41:25 -080010481UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010482 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010483 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010484}
10485UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010486 const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010487 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010488}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010489
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010490/* google.protobuf.FeatureSet */
10491
10492UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010493 return (google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010494}
10495UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) {
10496 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
10497 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010498 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSet_msg_init, NULL, 0, arena) !=
10499 kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010500 return NULL;
10501 }
10502 return ret;
10503}
10504UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size,
10505 const upb_ExtensionRegistry* extreg,
10506 int options, upb_Arena* arena) {
10507 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
10508 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010509 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSet_msg_init, extreg, options,
10510 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010511 return NULL;
10512 }
10513 return ret;
10514}
10515UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) {
10516 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010517 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSet_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010518 return ptr;
10519}
10520UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options,
10521 upb_Arena* arena, size_t* len) {
10522 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010523 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSet_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010524 return ptr;
10525}
10526UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010527 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010528 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010529}
10530UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) {
10531 int32_t default_val = 0;
10532 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010533 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010534 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10535 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010536 return ret;
10537}
10538UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010539 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010540 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010541}
10542UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010543 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010544 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010545}
10546UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) {
10547 int32_t default_val = 0;
10548 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010549 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010550 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10551 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010552 return ret;
10553}
10554UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010555 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010556 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010557}
10558UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010559 const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010560 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010561}
10562UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
10563 int32_t default_val = 0;
10564 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010565 const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010566 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10567 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010568 return ret;
10569}
10570UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010571 const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010572 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010573}
Protobuf Team Bot61127952023-09-26 20:07:33 +000010574UPB_INLINE void google_protobuf_FeatureSet_clear_utf8_validation(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010575 const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010576 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010577}
10578UPB_INLINE int32_t google_protobuf_FeatureSet_utf8_validation(const google_protobuf_FeatureSet* msg) {
10579 int32_t default_val = 0;
10580 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010581 const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010582 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10583 &default_val, &ret);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010584 return ret;
10585}
10586UPB_INLINE bool google_protobuf_FeatureSet_has_utf8_validation(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010587 const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010588 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010589}
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010590UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010591 const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010592 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010593}
10594UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) {
10595 int32_t default_val = 0;
10596 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010597 const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010598 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10599 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010600 return ret;
10601}
10602UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010603 const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010604 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010605}
10606UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010607 const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010608 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010609}
10610UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) {
10611 int32_t default_val = 0;
10612 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010613 const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010614 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10615 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010616 return ret;
10617}
10618UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010619 const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010620 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010621}
10622
10623UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010624 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010625 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010626}
10627UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010628 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010629 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010630}
10631UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010632 const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010633 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010634}
Protobuf Team Bot61127952023-09-26 20:07:33 +000010635UPB_INLINE void google_protobuf_FeatureSet_set_utf8_validation(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010636 const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010637 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010638}
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010639UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010640 const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010641 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010642}
10643UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010644 const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010645 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010646}
10647
Mike Kruskalba964702023-08-22 17:37:48 -070010648/* google.protobuf.FeatureSetDefaults */
10649
10650UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010651 return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google__protobuf__FeatureSetDefaults_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010652}
10653UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) {
10654 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
10655 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010656 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults_msg_init, NULL, 0, arena) !=
10657 kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010658 return NULL;
10659 }
10660 return ret;
10661}
10662UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size,
10663 const upb_ExtensionRegistry* extreg,
10664 int options, upb_Arena* arena) {
10665 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
10666 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010667 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults_msg_init, extreg, options,
10668 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010669 return NULL;
10670 }
10671 return ret;
10672}
10673UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) {
10674 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010675 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010676 return ptr;
10677}
10678UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options,
10679 upb_Arena* arena, size_t* len) {
10680 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010681 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010682 return ptr;
10683}
10684UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_defaults(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010685 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010686 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010687}
10688UPB_INLINE const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const* google_protobuf_FeatureSetDefaults_defaults(const google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010689 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010690 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010691 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010692 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010693 return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)upb_Array_DataPtr(arr);
Mike Kruskalba964702023-08-22 17:37:48 -070010694 } else {
10695 if (size) *size = 0;
10696 return NULL;
10697 }
10698}
10699UPB_INLINE const upb_Array* _google_protobuf_FeatureSetDefaults_defaults_upb_array(const google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010700 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010701 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010702 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010703 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskalba964702023-08-22 17:37:48 -070010704 }
10705 return arr;
10706}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010707UPB_INLINE upb_Array* _google_protobuf_FeatureSetDefaults_defaults_mutable_upb_array(google_protobuf_FeatureSetDefaults* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010708 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010709 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10710 &field, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010711 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010712 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskalba964702023-08-22 17:37:48 -070010713 }
10714 return arr;
10715}
Mike Kruskalba964702023-08-22 17:37:48 -070010716UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010717 const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010718 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010719}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010720UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
10721 int32_t default_val = 0;
10722 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010723 const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010724 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10725 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010726 return ret;
10727}
10728UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010729 const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010730 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010731}
10732UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010733 const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010734 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010735}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010736UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
10737 int32_t default_val = 0;
10738 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010739 const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010740 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10741 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010742 return ret;
10743}
10744UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010745 const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010746 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010747}
10748
10749UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_mutable_defaults(google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010750 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010751 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010752 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010753 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010754 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Array_MutableDataPtr(arr);
Mike Kruskalba964702023-08-22 17:37:48 -070010755 } else {
10756 if (size) *size = 0;
10757 return NULL;
10758 }
10759}
10760UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_resize_defaults(google_protobuf_FeatureSetDefaults* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010761 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010762 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10763 &field, size, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010764}
10765UPB_INLINE struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_add_defaults(google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010766 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010767 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10768 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010769 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010770 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskalba964702023-08-22 17:37:48 -070010771 return NULL;
10772 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010773 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 -070010774 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010775 UPB_PRIVATE(_upb_Array_Set)
10776 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskalba964702023-08-22 17:37:48 -070010777 return sub;
10778}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010779UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010780 const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010781 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010782}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010783UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010784 const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010785 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010786}
10787
10788/* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */
10789
10790UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010791 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010792}
10793UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
10794 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
10795 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010796 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, NULL, 0, arena) !=
10797 kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010798 return NULL;
10799 }
10800 return ret;
10801}
10802UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size,
10803 const upb_ExtensionRegistry* extreg,
10804 int options, upb_Arena* arena) {
10805 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
10806 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010807 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, extreg, options,
10808 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010809 return NULL;
10810 }
10811 return ret;
10812}
10813UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) {
10814 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010815 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010816 return ptr;
10817}
10818UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options,
10819 upb_Arena* arena, size_t* len) {
10820 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010821 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010822 return ptr;
10823}
Mike Kruskalba964702023-08-22 17:37:48 -070010824UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010825 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010826 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010827}
10828UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10829 const google_protobuf_FeatureSet* default_val = NULL;
10830 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010831 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010832 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10833 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010834 return ret;
10835}
10836UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010837 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010838 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010839}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010840UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010841 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010842 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010843}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010844UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010845 int32_t default_val = 0;
10846 int32_t ret;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010847 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010848 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10849 &default_val, &ret);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010850 return ret;
10851}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010852UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010853 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10854 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
10855}
10856UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10857 const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 66, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10858 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
10859}
10860UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_overridable_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10861 const google_protobuf_FeatureSet* default_val = NULL;
10862 const google_protobuf_FeatureSet* ret;
10863 const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 66, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10864 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10865 &default_val, &ret);
10866 return ret;
10867}
10868UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_overridable_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10869 const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 66, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10870 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
10871}
10872UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10873 const upb_MiniTableField field = {5, UPB_SIZE(24, 32), 67, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10874 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
10875}
10876UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_fixed_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10877 const google_protobuf_FeatureSet* default_val = NULL;
10878 const google_protobuf_FeatureSet* ret;
10879 const upb_MiniTableField field = {5, UPB_SIZE(24, 32), 67, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10880 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10881 &default_val, &ret);
10882 return ret;
10883}
10884UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_fixed_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10885 const upb_MiniTableField field = {5, UPB_SIZE(24, 32), 67, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010886 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010887}
Mike Kruskalba964702023-08-22 17:37:48 -070010888
Mike Kruskalba964702023-08-22 17:37:48 -070010889UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010890 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010891 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010892}
10893UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10894 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg);
10895 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010896 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010897 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub);
10898 }
10899 return sub;
10900}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010901UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010902 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010903 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010904}
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010905UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
10906 const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 66, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10907 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10908}
10909UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10910 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_overridable_features(msg);
10911 if (sub == NULL) {
10912 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
10913 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_overridable_features(msg, sub);
10914 }
10915 return sub;
10916}
10917UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
10918 const upb_MiniTableField field = {5, UPB_SIZE(24, 32), 67, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
10919 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10920}
10921UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10922 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_fixed_features(msg);
10923 if (sub == NULL) {
10924 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
10925 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_fixed_features(msg, sub);
10926 }
10927 return sub;
10928}
Mike Kruskalba964702023-08-22 17:37:48 -070010929
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010930/* google.protobuf.SourceCodeInfo */
10931
Joshua Habermanf41049a2022-01-21 14:41:25 -080010932UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010933 return (google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010934}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010935UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
10936 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010937 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010938 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo_msg_init, NULL, 0, arena) !=
10939 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010940 return NULL;
10941 }
10942 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010943}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010944UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size,
10945 const upb_ExtensionRegistry* extreg,
10946 int options, upb_Arena* arena) {
10947 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
10948 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010949 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo_msg_init, extreg, options,
10950 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010951 return NULL;
10952 }
10953 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010954}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010955UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010956 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010957 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010958 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010959}
10960UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options,
10961 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010962 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010963 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010964 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010965}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010966UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010967 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010968 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010969}
Eric Salob7d54ac2022-12-29 11:59:42 -080010970UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010971 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010972 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010973 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010974 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010975 return (const google_protobuf_SourceCodeInfo_Location* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010976 } else {
10977 if (size) *size = 0;
10978 return NULL;
10979 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010980}
Deanna Garciab26afb52023-04-25 13:37:18 -070010981UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_location_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010982 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010983 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010984 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010985 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010986 }
10987 return arr;
10988}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010989UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_location_mutable_upb_array(google_protobuf_SourceCodeInfo* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010990 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010991 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10992 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010993 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010994 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010995 }
10996 return arr;
10997}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010998
Eric Salob7d54ac2022-12-29 11:59:42 -080010999UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011000 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011001 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011002 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011003 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011004 return (google_protobuf_SourceCodeInfo_Location**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011005 } else {
11006 if (size) *size = 0;
11007 return NULL;
11008 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011009}
Eric Salob7d54ac2022-12-29 11:59:42 -080011010UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011011 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011012 return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11013 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011014}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011015UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011016 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011017 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11018 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011019 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011020 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011021 return NULL;
11022 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011023 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 -080011024 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011025 UPB_PRIVATE(_upb_Array_Set)
11026 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011027 return sub;
11028}
11029
11030/* google.protobuf.SourceCodeInfo.Location */
11031
Joshua Habermanf41049a2022-01-21 14:41:25 -080011032UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011033 return (google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google__protobuf__SourceCodeInfo__Location_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011034}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011035UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) {
11036 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070011037 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011038 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo__Location_msg_init, NULL, 0, arena) !=
11039 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070011040 return NULL;
11041 }
11042 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011043}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011044UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size,
11045 const upb_ExtensionRegistry* extreg,
11046 int options, upb_Arena* arena) {
11047 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
11048 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011049 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo__Location_msg_init, extreg, options,
11050 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080011051 return NULL;
11052 }
11053 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011054}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011055UPB_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 -070011056 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011057 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo__Location_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011058 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011059}
11060UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options,
11061 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011062 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011063 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo__Location_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011064 return ptr;
11065}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011066UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011067 const upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011068 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080011069}
Eric Salob7d54ac2022-12-29 11:59:42 -080011070UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011071 const upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011072 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011073 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011074 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011075 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011076 } else {
11077 if (size) *size = 0;
11078 return NULL;
11079 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070011080}
Deanna Garciab26afb52023-04-25 13:37:18 -070011081UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011082 const upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011083 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011084 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011085 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011086 }
11087 return arr;
11088}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011089UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011090 const upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011091 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11092 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011093 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011094 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011095 }
11096 return arr;
11097}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011098UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011099 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011100 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011101}
Eric Salob7d54ac2022-12-29 11:59:42 -080011102UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011103 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011104 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011105 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011106 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011107 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011108 } else {
11109 if (size) *size = 0;
11110 return NULL;
11111 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011112}
Deanna Garciab26afb52023-04-25 13:37:18 -070011113UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011114 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011115 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011116 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011117 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011118 }
11119 return arr;
11120}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011121UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011122 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011123 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11124 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011125 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011126 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011127 }
11128 return arr;
11129}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011130UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011131 const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011132 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011133}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011134UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011135 upb_StringView default_val = upb_StringView_FromString("");
11136 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011137 const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011138 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11139 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011140 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011141}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011142UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011143 const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011144 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011145}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011146UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011147 const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011148 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011149}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011150UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011151 upb_StringView default_val = upb_StringView_FromString("");
11152 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011153 const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011154 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11155 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011156 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011157}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011158UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011159 const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011160 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080011161}
11162UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011163 const upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011164 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080011165}
Eric Salob7d54ac2022-12-29 11:59:42 -080011166UPB_INLINE upb_StringView const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011167 const upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011168 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011169 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011170 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011171 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011172 } else {
11173 if (size) *size = 0;
11174 return NULL;
11175 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011176}
Deanna Garciab26afb52023-04-25 13:37:18 -070011177UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011178 const upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011179 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011180 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011181 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011182 }
11183 return arr;
11184}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011185UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011186 const upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011187 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11188 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011189 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011190 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011191 }
11192 return arr;
11193}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011194
Eric Salob7d54ac2022-12-29 11:59:42 -080011195UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011196 upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011197 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011198 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011199 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011200 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011201 } else {
11202 if (size) *size = 0;
11203 return NULL;
11204 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011205}
Eric Salob7d54ac2022-12-29 11:59:42 -080011206UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011207 upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011208 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11209 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011210}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011211UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011212 upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011213 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11214 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011215 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011216 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011217 return false;
11218 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011219 UPB_PRIVATE(_upb_Array_Set)
11220 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011221 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011222}
Eric Salob7d54ac2022-12-29 11:59:42 -080011223UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011224 upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011225 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011226 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011227 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011228 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011229 } else {
11230 if (size) *size = 0;
11231 return NULL;
11232 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011233}
Eric Salob7d54ac2022-12-29 11:59:42 -080011234UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011235 upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011236 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11237 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011238}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011239UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011240 upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011241 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11242 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011243 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011244 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011245 return false;
11246 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011247 UPB_PRIVATE(_upb_Array_Set)
11248 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011249 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011250}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011251UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011252 const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011253 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011254}
11255UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011256 const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011257 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011258}
11259UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011260 upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011261 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011262 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011263 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011264 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011265 } else {
11266 if (size) *size = 0;
11267 return NULL;
11268 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011269}
Eric Salob7d54ac2022-12-29 11:59:42 -080011270UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011271 upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011272 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11273 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011274}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011275UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, upb_StringView val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011276 upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011277 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11278 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011279 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011280 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011281 return false;
11282 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011283 UPB_PRIVATE(_upb_Array_Set)
11284 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011285 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011286}
11287
11288/* google.protobuf.GeneratedCodeInfo */
11289
Joshua Habermanf41049a2022-01-21 14:41:25 -080011290UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011291 return (google_protobuf_GeneratedCodeInfo*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011292}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011293UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
11294 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070011295 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011296 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo_msg_init, NULL, 0, arena) !=
11297 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070011298 return NULL;
11299 }
11300 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011301}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011302UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size,
11303 const upb_ExtensionRegistry* extreg,
11304 int options, upb_Arena* arena) {
11305 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
11306 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011307 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo_msg_init, extreg, options,
11308 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080011309 return NULL;
11310 }
11311 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011312}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011313UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011314 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011315 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011316 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011317}
11318UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options,
11319 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011320 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011321 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011322 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011323}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011324UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011325 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011326 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011327}
Eric Salob7d54ac2022-12-29 11:59:42 -080011328UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011329 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011330 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011331 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011332 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011333 return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011334 } else {
11335 if (size) *size = 0;
11336 return NULL;
11337 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011338}
Deanna Garciab26afb52023-04-25 13:37:18 -070011339UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011340 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011341 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011342 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011343 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011344 }
11345 return arr;
11346}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011347UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_mutable_upb_array(google_protobuf_GeneratedCodeInfo* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011348 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011349 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11350 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011351 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011352 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011353 }
11354 return arr;
11355}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011356
Eric Salob7d54ac2022-12-29 11:59:42 -080011357UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011358 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011359 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011360 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011361 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011362 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011363 } else {
11364 if (size) *size = 0;
11365 return NULL;
11366 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011367}
Eric Salob7d54ac2022-12-29 11:59:42 -080011368UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011369 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011370 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11371 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011372}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011373UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011374 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011375 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11376 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011377 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011378 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011379 return NULL;
11380 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011381 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 -080011382 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011383 UPB_PRIVATE(_upb_Array_Set)
11384 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011385 return sub;
11386}
11387
11388/* google.protobuf.GeneratedCodeInfo.Annotation */
11389
Joshua Habermanf41049a2022-01-21 14:41:25 -080011390UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011391 return (google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo__Annotation_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011392}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011393UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) {
11394 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070011395 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011396 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, NULL, 0, arena) !=
11397 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070011398 return NULL;
11399 }
11400 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011401}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011402UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size,
11403 const upb_ExtensionRegistry* extreg,
11404 int options, upb_Arena* arena) {
11405 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
11406 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011407 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, extreg, options,
11408 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080011409 return NULL;
11410 }
11411 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011412}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011413UPB_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 -070011414 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011415 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011416 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011417}
11418UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options,
11419 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011420 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011421 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011422 return ptr;
11423}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011424UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011425 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011426 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080011427}
Eric Salob7d54ac2022-12-29 11:59:42 -080011428UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011429 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011430 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011431 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011432 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011433 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011434 } else {
11435 if (size) *size = 0;
11436 return NULL;
11437 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011438}
Deanna Garciab26afb52023-04-25 13:37:18 -070011439UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011440 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011441 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011442 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011443 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011444 }
11445 return arr;
11446}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011447UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011448 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011449 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11450 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011451 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011452 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011453 }
11454 return arr;
11455}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011456UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011457 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011458 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011459}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011460UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011461 upb_StringView default_val = upb_StringView_FromString("");
11462 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011463 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011464 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11465 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011466 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011467}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011468UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011469 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011470 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011471}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011472UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011473 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011474 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011475}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011476UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011477 int32_t default_val = (int32_t)0;
11478 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011479 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011480 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11481 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011482 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011483}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011484UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011485 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011486 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011487}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011488UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011489 const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011490 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011491}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011492UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011493 int32_t default_val = (int32_t)0;
11494 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011495 const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011496 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11497 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011498 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011499}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011500UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011501 const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011502 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011503}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011504UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011505 const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011506 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011507}
11508UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011509 int32_t default_val = 0;
11510 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011511 const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011512 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11513 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011514 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011515}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011516UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011517 const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011518 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080011519}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011520
Eric Salob7d54ac2022-12-29 11:59:42 -080011521UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011522 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011523 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011524 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011525 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011526 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011527 } else {
11528 if (size) *size = 0;
11529 return NULL;
11530 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011531}
Eric Salob7d54ac2022-12-29 11:59:42 -080011532UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011533 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011534 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11535 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011536}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011537UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011538 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011539 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11540 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011541 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011542 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011543 return false;
11544 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011545 UPB_PRIVATE(_upb_Array_Set)
11546 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011547 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011548}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011549UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011550 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011551 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011552}
11553UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011554 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011555 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011556}
11557UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011558 const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011559 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011560}
11561UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011562 const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011563 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011564}
Mike Kruskal232ecf42023-01-14 00:09:40 -080011565
Joshua Habermanf41049a2022-01-21 14:41:25 -080011566/* Max size 32 is google.protobuf.FileOptions */
11567/* Max size 64 is google.protobuf.FileOptions */
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011568#define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200)
Joshua Habermanf41049a2022-01-21 14:41:25 -080011569
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011570#ifdef __cplusplus
11571} /* extern "C" */
11572#endif
11573
11574
11575#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
Mike Kruskal232ecf42023-01-14 00:09:40 -080011576// end:github_only
Eric Salo8809a112022-11-21 13:01:06 -080011577
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000011578typedef enum {
11579 kUpb_Syntax_Proto2 = 2,
11580 kUpb_Syntax_Proto3 = 3,
11581 kUpb_Syntax_Editions = 99
11582} upb_Syntax;
Eric Salo8809a112022-11-21 13:01:06 -080011583
11584// Forward declarations for circular references.
11585typedef struct upb_DefPool upb_DefPool;
11586typedef struct upb_EnumDef upb_EnumDef;
11587typedef struct upb_EnumReservedRange upb_EnumReservedRange;
11588typedef struct upb_EnumValueDef upb_EnumValueDef;
11589typedef struct upb_ExtensionRange upb_ExtensionRange;
11590typedef struct upb_FieldDef upb_FieldDef;
11591typedef struct upb_FileDef upb_FileDef;
11592typedef struct upb_MessageDef upb_MessageDef;
11593typedef struct upb_MessageReservedRange upb_MessageReservedRange;
11594typedef struct upb_MethodDef upb_MethodDef;
11595typedef struct upb_OneofDef upb_OneofDef;
11596typedef struct upb_ServiceDef upb_ServiceDef;
11597
11598// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
11599
11600typedef struct upb_DefBuilder upb_DefBuilder;
11601
11602#endif /* UPB_REFLECTION_COMMON_H_ */
11603
11604#ifndef UPB_REFLECTION_DEF_TYPE_H_
11605#define UPB_REFLECTION_DEF_TYPE_H_
11606
11607
11608// Must be last.
11609
11610// Inside a symtab we store tagged pointers to specific def types.
11611typedef enum {
11612 UPB_DEFTYPE_MASK = 7,
11613
11614 // Only inside symtab table.
11615 UPB_DEFTYPE_EXT = 0,
11616 UPB_DEFTYPE_MSG = 1,
11617 UPB_DEFTYPE_ENUM = 2,
11618 UPB_DEFTYPE_ENUMVAL = 3,
11619 UPB_DEFTYPE_SERVICE = 4,
11620
11621 // Only inside message table.
11622 UPB_DEFTYPE_FIELD = 0,
11623 UPB_DEFTYPE_ONEOF = 1,
Eric Salo8809a112022-11-21 13:01:06 -080011624} upb_deftype_t;
11625
11626#ifdef __cplusplus
11627extern "C" {
11628#endif
11629
11630// Our 3-bit pointer tagging requires all pointers to be multiples of 8.
11631// The arena will always yield 8-byte-aligned addresses, however we put
11632// the defs into arrays. For each element in the array to be 8-byte-aligned,
11633// the sizes of each def type must also be a multiple of 8.
11634//
11635// If any of these asserts fail, we need to add or remove padding on 32-bit
11636// machines (64-bit machines will have 8-byte alignment already due to
11637// pointers, which all of these structs have).
11638UPB_INLINE void _upb_DefType_CheckPadding(size_t size) {
11639 UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0);
11640}
11641
11642upb_deftype_t _upb_DefType_Type(upb_value v);
11643
11644upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type);
11645
11646const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type);
11647
11648#ifdef __cplusplus
11649} /* extern "C" */
11650#endif
11651
11652
11653#endif /* UPB_REFLECTION_DEF_TYPE_H_ */
11654
11655// Must be last.
11656
11657#ifdef __cplusplus
11658extern "C" {
11659#endif
11660
Jason Lunn67dee292023-07-13 13:15:26 -070011661UPB_API void upb_DefPool_Free(upb_DefPool* s);
Eric Salo8809a112022-11-21 13:01:06 -080011662
Jason Lunn67dee292023-07-13 13:15:26 -070011663UPB_API upb_DefPool* upb_DefPool_New(void);
Eric Salo8809a112022-11-21 13:01:06 -080011664
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011665UPB_API const UPB_DESC(FeatureSetDefaults) *
11666 upb_DefPool_FeatureSetDefaults(const upb_DefPool* s);
11667
Protobuf Team Botc6b149c2023-11-10 23:37:46 +000011668UPB_API bool upb_DefPool_SetFeatureSetDefaults(upb_DefPool* s,
11669 const char* serialized_defaults,
11670 size_t serialized_len,
11671 upb_Status* status);
11672
Jason Lunn67dee292023-07-13 13:15:26 -070011673UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName(
11674 const upb_DefPool* s, const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080011675
11676const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize(
11677 const upb_DefPool* s, const char* sym, size_t len);
11678
Jason Lunn67dee292023-07-13 13:15:26 -070011679UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s,
11680 const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080011681
11682const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s,
11683 const char* sym);
11684
11685const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s,
11686 const char* name);
11687
11688const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s,
11689 const char* name,
11690 size_t len);
11691
11692const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable(
11693 const upb_DefPool* s, const upb_MiniTableExtension* ext);
11694
Protobuf Team Bot8aad0582023-11-14 23:47:47 +000011695UPB_API const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s,
Eric Salo8809a112022-11-21 13:01:06 -080011696 const char* sym);
11697
11698const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize(
11699 const upb_DefPool* s, const char* name, size_t size);
11700
11701const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
11702 const upb_MessageDef* m,
11703 int32_t fieldnum);
11704
Protobuf Team Bot312240c2024-03-22 17:47:13 +000011705UPB_API const upb_ServiceDef* upb_DefPool_FindServiceByName(
11706 const upb_DefPool* s, const char* name);
Eric Salo8809a112022-11-21 13:01:06 -080011707
11708const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
11709 const upb_DefPool* s, const char* name, size_t size);
11710
11711const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s,
11712 const char* name);
11713
Jason Lunn67dee292023-07-13 13:15:26 -070011714UPB_API const upb_FileDef* upb_DefPool_AddFile(
11715 upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto,
11716 upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011717
Protobuf Team Bot8aad0582023-11-14 23:47:47 +000011718UPB_API const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry(
Eric Salo8809a112022-11-21 13:01:06 -080011719 const upb_DefPool* s);
11720
11721const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s,
11722 const upb_MessageDef* m,
11723 size_t* count);
11724
11725#ifdef __cplusplus
11726} /* extern "C" */
11727#endif
11728
11729
11730#endif /* UPB_REFLECTION_DEF_POOL_H_ */
11731
Protobuf Team Bot06310352023-09-26 21:54:58 +000011732// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011733
11734#ifndef UPB_REFLECTION_ENUM_DEF_H_
11735#define UPB_REFLECTION_ENUM_DEF_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -070011736
11737
11738// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011739
11740#ifdef __cplusplus
11741extern "C" {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011742#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011743
Eric Salo8809a112022-11-21 13:01:06 -080011744bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num);
11745const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e);
11746int32_t upb_EnumDef_Default(const upb_EnumDef* e);
Jason Lunn67dee292023-07-13 13:15:26 -070011747UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011748const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
11749 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011750UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011751 const upb_EnumDef* e, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011752UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
11753 const upb_EnumDef* e, int32_t num);
11754UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011755bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
11756bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
Protobuf Team Bot5e8d7e52024-03-15 22:28:30 +000011757bool upb_EnumDef_IsSpecifiedAsClosed(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011758
11759// Creates a mini descriptor string for an enum, returns true on success.
11760bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
11761 upb_StringView* out);
11762
11763const char* upb_EnumDef_Name(const upb_EnumDef* e);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011764const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011765const UPB_DESC(FeatureSet) * upb_EnumDef_ResolvedFeatures(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011766
11767upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i);
11768int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e);
11769
11770const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e,
11771 int i);
11772int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e);
11773
Jason Lunn67dee292023-07-13 13:15:26 -070011774UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i);
11775UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011776
11777#ifdef __cplusplus
11778} /* extern "C" */
11779#endif
11780
11781
11782#endif /* UPB_REFLECTION_ENUM_DEF_H_ */
11783
Protobuf Team Bot06310352023-09-26 21:54:58 +000011784// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011785
11786#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_
11787#define UPB_REFLECTION_ENUM_VALUE_DEF_H_
11788
11789
11790// Must be last.
11791
11792#ifdef __cplusplus
11793extern "C" {
11794#endif
11795
11796const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v);
11797const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v);
11798bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v);
11799uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v);
Jason Lunn67dee292023-07-13 13:15:26 -070011800UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v);
11801UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011802const UPB_DESC(EnumValueOptions) *
11803 upb_EnumValueDef_Options(const upb_EnumValueDef* v);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011804const UPB_DESC(FeatureSet) *
11805 upb_EnumValueDef_ResolvedFeatures(const upb_EnumValueDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011806
11807#ifdef __cplusplus
11808} /* extern "C" */
11809#endif
11810
11811
11812#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */
11813
Protobuf Team Bot06310352023-09-26 21:54:58 +000011814// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011815
11816#ifndef UPB_REFLECTION_EXTENSION_RANGE_H_
11817#define UPB_REFLECTION_EXTENSION_RANGE_H_
11818
11819
11820// Must be last.
11821
11822#ifdef __cplusplus
11823extern "C" {
11824#endif
11825
11826int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r);
11827int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r);
11828
11829bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011830const UPB_DESC(ExtensionRangeOptions) *
11831 upb_ExtensionRange_Options(const upb_ExtensionRange* r);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011832const UPB_DESC(FeatureSet) *
11833 upb_ExtensionRange_ResolvedFeatures(const upb_ExtensionRange* e);
Eric Salo8809a112022-11-21 13:01:06 -080011834
11835#ifdef __cplusplus
11836} /* extern "C" */
11837#endif
11838
11839
11840#endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */
11841
Protobuf Team Bot06310352023-09-26 21:54:58 +000011842// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011843
11844#ifndef UPB_REFLECTION_FIELD_DEF_H_
11845#define UPB_REFLECTION_FIELD_DEF_H_
11846
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011847#include <stdint.h>
11848
Eric Salo8809a112022-11-21 13:01:06 -080011849
11850// Must be last.
11851
11852// Maximum field number allowed for FieldDefs.
11853// This is an inherent limit of the protobuf wire format.
11854#define kUpb_MaxFieldNumber ((1 << 29) - 1)
11855
11856#ifdef __cplusplus
11857extern "C" {
11858#endif
11859
11860const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011861UPB_API const upb_MessageDef* upb_FieldDef_ContainingType(
11862 const upb_FieldDef* f);
11863UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f);
11864UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f);
11865UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011866const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011867UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011868const char* upb_FieldDef_FullName(const upb_FieldDef* f);
11869bool upb_FieldDef_HasDefault(const upb_FieldDef* f);
11870bool upb_FieldDef_HasJsonName(const upb_FieldDef* f);
11871bool upb_FieldDef_HasOptions(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011872UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011873bool upb_FieldDef_HasSubDef(const upb_FieldDef* f);
11874uint32_t upb_FieldDef_Index(const upb_FieldDef* f);
11875bool upb_FieldDef_IsExtension(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011876UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011877bool upb_FieldDef_IsOptional(const upb_FieldDef* f);
Protobuf Team Botf2c187d2024-01-09 17:58:04 +000011878UPB_API bool upb_FieldDef_IsPacked(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011879bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011880UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011881bool upb_FieldDef_IsRequired(const upb_FieldDef* f);
11882bool upb_FieldDef_IsString(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011883UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
11884UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
11885UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
Protobuf Team Botb361c9c2024-03-22 00:27:43 +000011886uint32_t upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011887UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
Protobuf Team Botb58bd402023-09-19 15:42:34 +000011888bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f);
Protobuf Team Bot8ce5c9f2024-04-05 20:20:09 +000011889bool _upb_FieldDef_IsGroupLike(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011890
11891// Creates a mini descriptor string for a field, returns true on success.
11892bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a,
11893 upb_StringView* out);
11894
11895const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011896const upb_MiniTableExtension* upb_FieldDef_MiniTableExtension(
11897 const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011898UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f);
11899UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011900const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011901const UPB_DESC(FeatureSet) *
11902 upb_FieldDef_ResolvedFeatures(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011903UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof(
11904 const upb_FieldDef* f);
11905UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011906
11907#ifdef __cplusplus
11908} /* extern "C" */
11909#endif
11910
11911
11912#endif /* UPB_REFLECTION_FIELD_DEF_H_ */
11913
Protobuf Team Bot06310352023-09-26 21:54:58 +000011914// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011915
11916#ifndef UPB_REFLECTION_FILE_DEF_H_
11917#define UPB_REFLECTION_FILE_DEF_H_
11918
11919
11920// Must be last.
11921
11922#ifdef __cplusplus
11923extern "C" {
11924#endif
11925
Protobuf Team Botc6b149c2023-11-10 23:37:46 +000011926UPB_API const char* upb_FileDef_EditionName(int edition);
11927
Eric Salo8809a112022-11-21 13:01:06 -080011928const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i);
11929int upb_FileDef_DependencyCount(const upb_FileDef* f);
11930bool upb_FileDef_HasOptions(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011931UPB_API const char* upb_FileDef_Name(const upb_FileDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011932const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011933const UPB_DESC(FeatureSet) * upb_FileDef_ResolvedFeatures(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011934const char* upb_FileDef_Package(const upb_FileDef* f);
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000011935UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011936UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011937
11938const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i);
11939int upb_FileDef_PublicDependencyCount(const upb_FileDef* f);
11940
11941const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i);
11942int upb_FileDef_ServiceCount(const upb_FileDef* f);
11943
Jason Lunn67dee292023-07-13 13:15:26 -070011944UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011945
11946const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i);
11947int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f);
11948
11949const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i);
11950int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f);
11951
11952const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i);
11953int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f);
11954
11955const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i);
11956int upb_FileDef_WeakDependencyCount(const upb_FileDef* f);
11957
11958#ifdef __cplusplus
11959} /* extern "C" */
11960#endif
11961
11962
11963#endif /* UPB_REFLECTION_FILE_DEF_H_ */
11964
Protobuf Team Bot06310352023-09-26 21:54:58 +000011965// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011966
11967#ifndef UPB_REFLECTION_MESSAGE_DEF_H_
11968#define UPB_REFLECTION_MESSAGE_DEF_H_
11969
11970
11971// Must be last.
11972
11973// Well-known field tag numbers for map-entry messages.
11974#define kUpb_MapEntry_KeyFieldNumber 1
11975#define kUpb_MapEntry_ValueFieldNumber 2
11976
11977// Well-known field tag numbers for Any messages.
11978#define kUpb_Any_TypeFieldNumber 1
11979#define kUpb_Any_ValueFieldNumber 2
11980
11981// Well-known field tag numbers for duration messages.
11982#define kUpb_Duration_SecondsFieldNumber 1
11983#define kUpb_Duration_NanosFieldNumber 2
11984
11985// Well-known field tag numbers for timestamp messages.
11986#define kUpb_Timestamp_SecondsFieldNumber 1
11987#define kUpb_Timestamp_NanosFieldNumber 2
11988
11989// All the different kind of well known type messages. For simplicity of check,
11990// number wrappers and string wrappers are grouped together. Make sure the
11991// order and number of these groups are not changed.
11992typedef enum {
11993 kUpb_WellKnown_Unspecified,
11994 kUpb_WellKnown_Any,
11995 kUpb_WellKnown_FieldMask,
11996 kUpb_WellKnown_Duration,
11997 kUpb_WellKnown_Timestamp,
11998
11999 // number wrappers
12000 kUpb_WellKnown_DoubleValue,
12001 kUpb_WellKnown_FloatValue,
12002 kUpb_WellKnown_Int64Value,
12003 kUpb_WellKnown_UInt64Value,
12004 kUpb_WellKnown_Int32Value,
12005 kUpb_WellKnown_UInt32Value,
12006
12007 // string wrappers
12008 kUpb_WellKnown_StringValue,
12009 kUpb_WellKnown_BytesValue,
12010 kUpb_WellKnown_BoolValue,
12011 kUpb_WellKnown_Value,
12012 kUpb_WellKnown_ListValue,
12013 kUpb_WellKnown_Struct,
12014} upb_WellKnown;
12015
12016#ifdef __cplusplus
12017extern "C" {
12018#endif
12019
12020const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m);
12021
12022const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m,
12023 int i);
12024int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m);
12025
Jason Lunn67dee292023-07-13 13:15:26 -070012026UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m,
12027 int i);
12028UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012029
Jason Lunn67dee292023-07-13 13:15:26 -070012030UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012031
12032// Returns a field by either JSON name or regular proto name.
12033const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
12034 const upb_MessageDef* m, const char* name, size_t size);
12035UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName(
12036 const upb_MessageDef* m, const char* name) {
12037 return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name));
12038}
12039
12040// Lookup of either field or oneof by name. Returns whether either was found.
12041// If the return is true, then the found def will be set, and the non-found
12042// one set to NULL.
Jason Lunn67dee292023-07-13 13:15:26 -070012043UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
12044 const char* name, size_t size,
12045 const upb_FieldDef** f,
12046 const upb_OneofDef** o);
Eric Salo8809a112022-11-21 13:01:06 -080012047UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m,
12048 const char* name,
12049 const upb_FieldDef** f,
12050 const upb_OneofDef** o) {
12051 return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o);
12052}
12053
12054const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m,
12055 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070012056UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080012057 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070012058UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber(
12059 const upb_MessageDef* m, uint32_t i);
Eric Salo8809a112022-11-21 13:01:06 -080012060const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m,
12061 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070012062UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080012063 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070012064UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012065bool upb_MessageDef_HasOptions(const upb_MessageDef* m);
12066bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m);
12067bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m);
12068
12069// Creates a mini descriptor string for a message, returns true on success.
12070bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a,
12071 upb_StringView* out);
12072
Jason Lunn67dee292023-07-13 13:15:26 -070012073UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012074const char* upb_MessageDef_Name(const upb_MessageDef* m);
12075
12076const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i);
12077const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m,
12078 int i);
12079const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m,
12080 int i);
12081
12082int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m);
12083int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m);
12084int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m);
12085
Jason Lunn67dee292023-07-13 13:15:26 -070012086UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m,
12087 int i);
12088UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080012089int upb_MessageDef_RealOneofCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012090
Mike Kruskal232ecf42023-01-14 00:09:40 -080012091const UPB_DESC(MessageOptions) *
12092 upb_MessageDef_Options(const upb_MessageDef* m);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012093const UPB_DESC(FeatureSet) *
12094 upb_MessageDef_ResolvedFeatures(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012095
12096upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i);
12097int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m);
12098
12099const upb_MessageReservedRange* upb_MessageDef_ReservedRange(
12100 const upb_MessageDef* m, int i);
12101int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m);
12102
Jason Lunn67dee292023-07-13 13:15:26 -070012103UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m);
12104UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012105
12106#ifdef __cplusplus
12107} /* extern "C" */
12108#endif
12109
12110
12111#endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */
12112
Protobuf Team Bot06310352023-09-26 21:54:58 +000012113// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012114
12115#ifndef UPB_REFLECTION_METHOD_DEF_H_
12116#define UPB_REFLECTION_METHOD_DEF_H_
12117
12118
12119// Must be last.
12120
12121#ifdef __cplusplus
12122extern "C" {
12123#endif
12124
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012125UPB_API bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012126const char* upb_MethodDef_FullName(const upb_MethodDef* m);
12127bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
12128int upb_MethodDef_Index(const upb_MethodDef* m);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012129UPB_API const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
12130UPB_API const char* upb_MethodDef_Name(const upb_MethodDef* m);
12131UPB_API const UPB_DESC(MethodOptions) *
12132 upb_MethodDef_Options(const upb_MethodDef* m);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012133const UPB_DESC(FeatureSet) *
12134 upb_MethodDef_ResolvedFeatures(const upb_MethodDef* m);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012135UPB_API const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
12136UPB_API bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
12137UPB_API const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012138
12139#ifdef __cplusplus
12140} /* extern "C" */
12141#endif
12142
12143
12144#endif /* UPB_REFLECTION_METHOD_DEF_H_ */
12145
Protobuf Team Bot06310352023-09-26 21:54:58 +000012146// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012147
12148#ifndef UPB_REFLECTION_ONEOF_DEF_H_
12149#define UPB_REFLECTION_ONEOF_DEF_H_
12150
12151
12152// Must be last.
12153
12154#ifdef __cplusplus
12155extern "C" {
12156#endif
12157
Jason Lunn67dee292023-07-13 13:15:26 -070012158UPB_API const upb_MessageDef* upb_OneofDef_ContainingType(
12159 const upb_OneofDef* o);
12160UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i);
12161UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012162const char* upb_OneofDef_FullName(const upb_OneofDef* o);
12163bool upb_OneofDef_HasOptions(const upb_OneofDef* o);
12164uint32_t upb_OneofDef_Index(const upb_OneofDef* o);
12165bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o);
12166const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o,
12167 const char* name);
12168const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o,
12169 const char* name,
12170 size_t size);
12171const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o,
12172 uint32_t num);
Jason Lunn67dee292023-07-13 13:15:26 -070012173UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012174int upb_OneofDef_numfields(const upb_OneofDef* o);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012175const UPB_DESC(OneofOptions*) upb_OneofDef_Options(const upb_OneofDef* o);
12176const UPB_DESC(FeatureSet*)
12177 upb_OneofDef_ResolvedFeatures(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012178
12179#ifdef __cplusplus
12180} /* extern "C" */
12181#endif
12182
12183
12184#endif /* UPB_REFLECTION_ONEOF_DEF_H_ */
12185
Protobuf Team Bot06310352023-09-26 21:54:58 +000012186// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012187
12188#ifndef UPB_REFLECTION_SERVICE_DEF_H_
12189#define UPB_REFLECTION_SERVICE_DEF_H_
12190
12191
12192// Must be last.
12193
12194#ifdef __cplusplus
12195extern "C" {
12196#endif
12197
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012198UPB_API const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012199const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
12200 const char* name);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012201UPB_API const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012202bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
12203int upb_ServiceDef_Index(const upb_ServiceDef* s);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012204UPB_API const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s,
12205 int i);
12206UPB_API int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012207const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012208UPB_API const UPB_DESC(ServiceOptions) *
Mike Kruskal232ecf42023-01-14 00:09:40 -080012209 upb_ServiceDef_Options(const upb_ServiceDef* s);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012210const UPB_DESC(FeatureSet) *
12211 upb_ServiceDef_ResolvedFeatures(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012212
12213#ifdef __cplusplus
12214} /* extern "C" */
12215#endif
12216
12217
12218#endif /* UPB_REFLECTION_SERVICE_DEF_H_ */
Protobuf Team Botffc56ba2023-09-08 15:29:06 +000012219// IWYU pragma: end_exports
Eric Salo8809a112022-11-21 13:01:06 -080012220
12221#endif /* UPB_REFLECTION_DEF_H_ */
12222
12223// Must be last.
12224
12225#ifdef __cplusplus
12226extern "C" {
12227#endif
12228
12229enum { upb_JsonDecode_IgnoreUnknown = 1 };
12230
Jason Lunn67dee292023-07-13 13:15:26 -070012231UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
12232 const upb_MessageDef* m, const upb_DefPool* symtab,
12233 int options, upb_Arena* arena, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080012234
12235#ifdef __cplusplus
12236} /* extern "C" */
12237#endif
12238
12239
12240#endif /* UPB_JSONDECODE_H_ */
12241
12242#ifndef UPB_LEX_ATOI_H_
12243#define UPB_LEX_ATOI_H_
12244
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012245#include <stdint.h>
12246
Eric Salo8809a112022-11-21 13:01:06 -080012247// Must be last.
12248
12249#ifdef __cplusplus
12250extern "C" {
12251#endif
12252
12253// We use these hand-written routines instead of strto[u]l() because the "long
12254// long" variants aren't in c89. Also our version allows setting a ptr limit.
12255// Return the new position of the pointer after parsing the int, or NULL on
12256// integer overflow.
12257
12258const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val);
12259const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
12260 bool* is_neg);
12261
12262#ifdef __cplusplus
12263} /* extern "C" */
12264#endif
12265
12266
12267#endif /* UPB_LEX_ATOI_H_ */
12268
12269#ifndef UPB_LEX_UNICODE_H_
12270#define UPB_LEX_UNICODE_H_
12271
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012272#include <stdint.h>
12273
Eric Salo8809a112022-11-21 13:01:06 -080012274// Must be last.
12275
12276#ifdef __cplusplus
12277extern "C" {
12278#endif
12279
12280// Returns true iff a codepoint is the value for a high surrogate.
12281UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) {
12282 return (cp >= 0xd800 && cp <= 0xdbff);
12283}
12284
12285// Returns true iff a codepoint is the value for a low surrogate.
12286UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) {
12287 return (cp >= 0xdc00 && cp <= 0xdfff);
12288}
12289
12290// Returns the high 16-bit surrogate value for a supplementary codepoint.
12291// Does not sanity-check the input.
12292UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) {
12293 return (cp >> 10) + 0xd7c0;
12294}
12295
12296// Returns the low 16-bit surrogate value for a supplementary codepoint.
12297// Does not sanity-check the input.
12298UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) {
12299 return (cp & 0x3ff) | 0xdc00;
12300}
12301
12302// Returns the 32-bit value corresponding to a pair of 16-bit surrogates.
12303// Does not sanity-check the input.
12304UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) {
12305 return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000;
12306}
12307
12308// Outputs a codepoint as UTF8.
12309// Returns the number of bytes written (1-4 on success, 0 on error).
12310// Does not sanity-check the input. Specifically does not check for surrogates.
12311int upb_Unicode_ToUTF8(uint32_t cp, char* out);
12312
12313#ifdef __cplusplus
12314} /* extern "C" */
12315#endif
12316
12317
12318#endif /* UPB_LEX_UNICODE_H_ */
12319
12320#ifndef UPB_REFLECTION_MESSAGE_H_
12321#define UPB_REFLECTION_MESSAGE_H_
12322
Protobuf Team Bot473d20d2023-09-15 22:27:16 +000012323#include <stddef.h>
12324
Eric Salo8809a112022-11-21 13:01:06 -080012325
12326// Must be last.
12327
12328#ifdef __cplusplus
12329extern "C" {
12330#endif
12331
Eric Salo3f36a912022-12-05 14:12:25 -080012332// Returns a mutable pointer to a map, array, or submessage value. If the given
12333// arena is non-NULL this will construct a new object if it was not previously
12334// present. May not be called for primitive fields.
Jason Lunn67dee292023-07-13 13:15:26 -070012335UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg,
12336 const upb_FieldDef* f,
12337 upb_Arena* a);
Eric Salo8809a112022-11-21 13:01:06 -080012338
Eric Salo3f36a912022-12-05 14:12:25 -080012339// Returns the field that is set in the oneof, or NULL if none are set.
Jason Lunn67dee292023-07-13 13:15:26 -070012340UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
12341 const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012342
Eric Salo3f36a912022-12-05 14:12:25 -080012343// Clear all data and unknown fields.
12344void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012345
Eric Salo3f36a912022-12-05 14:12:25 -080012346// Clears any field presence and sets the value back to its default.
Jason Lunn67dee292023-07-13 13:15:26 -070012347UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg,
12348 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012349
Eric Salo3f36a912022-12-05 14:12:25 -080012350// May only be called for fields where upb_FieldDef_HasPresence(f) == true.
Jason Lunn67dee292023-07-13 13:15:26 -070012351UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg,
12352 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012353
Eric Salo3f36a912022-12-05 14:12:25 -080012354// Returns the value in the message associated with this field def.
Jason Lunn67dee292023-07-13 13:15:26 -070012355UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
12356 const upb_FieldDef* f);
Eric Salo3f36a912022-12-05 14:12:25 -080012357
12358// Sets the given field to the given value. For a msg/array/map/string, the
12359// caller must ensure that the target data outlives |msg| (by living either in
12360// the same arena or a different arena that outlives it).
12361//
12362// Returns false if allocation fails.
Jason Lunn67dee292023-07-13 13:15:26 -070012363UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
12364 upb_MessageValue val, upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -080012365
12366// Iterate over present fields.
12367//
12368// size_t iter = kUpb_Message_Begin;
12369// const upb_FieldDef *f;
12370// upb_MessageValue val;
12371// while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) {
12372// process_field(f, val);
12373// }
12374//
12375// If ext_pool is NULL, no extensions will be returned. If the given symtab
12376// returns extensions that don't match what is in this message, those extensions
12377// will be skipped.
Eric Salo8809a112022-11-21 13:01:06 -080012378
12379#define kUpb_Message_Begin -1
Eric Salo3f36a912022-12-05 14:12:25 -080012380
Protobuf Team Bot7e324502024-01-04 18:12:49 +000012381UPB_API bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
12382 const upb_DefPool* ext_pool,
12383 const upb_FieldDef** f, upb_MessageValue* val,
12384 size_t* iter);
Eric Salo8809a112022-11-21 13:01:06 -080012385
Eric Salo3f36a912022-12-05 14:12:25 -080012386// Clears all unknown field data from this message and all submessages.
Jason Lunn67dee292023-07-13 13:15:26 -070012387UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg,
12388 const upb_MessageDef* m, int maxdepth);
Eric Salo8809a112022-11-21 13:01:06 -080012389
12390#ifdef __cplusplus
12391} /* extern "C" */
12392#endif
12393
12394
12395#endif /* UPB_REFLECTION_MESSAGE_H_ */
12396
12397#ifndef UPB_JSON_ENCODE_H_
12398#define UPB_JSON_ENCODE_H_
12399
12400
12401// Must be last.
12402
12403#ifdef __cplusplus
12404extern "C" {
12405#endif
12406
12407enum {
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000012408 /* When set, emits 0/default values. TODO: proto3 only? */
Eric Salo8809a112022-11-21 13:01:06 -080012409 upb_JsonEncode_EmitDefaults = 1 << 0,
12410
12411 /* When set, use normal (snake_case) field names instead of JSON (camelCase)
12412 names. */
12413 upb_JsonEncode_UseProtoNames = 1 << 1,
12414
12415 /* When set, emits enums as their integer values instead of as their names. */
12416 upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2
12417};
12418
12419/* Encodes the given |msg| to JSON format. The message's reflection is given in
Protobuf Team Botad884532023-09-05 18:31:02 +000012420 * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL,
12421 * extensions will not be printed).
Eric Salo8809a112022-11-21 13:01:06 -080012422 *
12423 * Output is placed in the given buffer, and always NULL-terminated. The output
12424 * size (excluding NULL) is returned. This means that a return value >= |size|
12425 * implies that the output was truncated. (These are the same semantics as
12426 * snprintf()). */
Jason Lunn67dee292023-07-13 13:15:26 -070012427UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m,
12428 const upb_DefPool* ext_pool, int options,
12429 char* buf, size_t size, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080012430
12431#ifdef __cplusplus
12432} /* extern "C" */
12433#endif
12434
12435
12436#endif /* UPB_JSONENCODE_H_ */
12437
12438#ifndef UPB_LEX_ROUND_TRIP_H_
12439#define UPB_LEX_ROUND_TRIP_H_
12440
12441// Must be last.
12442
12443// Encodes a float or double that is round-trippable, but as short as possible.
12444// These routines are not fully optimal (not guaranteed to be shortest), but are
12445// short-ish and match the implementation that has been used in protobuf since
12446// the beginning.
12447
12448// The given buffer size must be at least kUpb_RoundTripBufferSize.
12449enum { kUpb_RoundTripBufferSize = 32 };
12450
12451#ifdef __cplusplus
12452extern "C" {
12453#endif
12454
12455void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size);
12456void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size);
12457
12458#ifdef __cplusplus
12459} /* extern "C" */
12460#endif
12461
12462
12463#endif /* UPB_LEX_ROUND_TRIP_H_ */
12464
12465#ifndef UPB_PORT_VSNPRINTF_COMPAT_H_
12466#define UPB_PORT_VSNPRINTF_COMPAT_H_
12467
12468// Must be last.
12469
12470UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt,
12471 va_list ap) {
12472#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
12473 // The msvc runtime has a non-conforming vsnprintf() that requires the
12474 // following compatibility code to become conformant.
12475 int n = -1;
12476 if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap);
12477 if (n == -1) n = _vscprintf(fmt, ap);
12478 return n;
12479#else
12480 return vsnprintf(buf, size, fmt, ap);
12481#endif
12482}
12483
12484
12485#endif // UPB_PORT_VSNPRINTF_COMPAT_H_
12486
Eric Salodfb71552023-03-22 12:35:09 -070012487#ifndef UPB_PORT_ATOMIC_H_
12488#define UPB_PORT_ATOMIC_H_
12489
12490
12491#ifdef UPB_USE_C11_ATOMICS
12492
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012493// IWYU pragma: begin_exports
Eric Salodfb71552023-03-22 12:35:09 -070012494#include <stdatomic.h>
12495#include <stdbool.h>
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012496// IWYU pragma: end_exports
Eric Salodfb71552023-03-22 12:35:09 -070012497
Deanna Garciac7d979d2023-04-14 17:22:13 -070012498#define upb_Atomic_Init(addr, val) atomic_init(addr, val)
12499#define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order)
12500#define upb_Atomic_Store(addr, val, order) \
12501 atomic_store_explicit(addr, val, order)
12502#define upb_Atomic_Add(addr, val, order) \
12503 atomic_fetch_add_explicit(addr, val, order)
12504#define upb_Atomic_Sub(addr, val, order) \
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070012505 atomic_fetch_sub_explicit(addr, val, order)
12506#define upb_Atomic_Exchange(addr, val, order) \
12507 atomic_exchange_explicit(addr, val, order)
Deanna Garciac7d979d2023-04-14 17:22:13 -070012508#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
12509 success_order, failure_order) \
12510 atomic_compare_exchange_strong_explicit(addr, expected, desired, \
12511 success_order, failure_order)
12512#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
12513 failure_order) \
12514 atomic_compare_exchange_weak_explicit(addr, expected, desired, \
12515 success_order, failure_order)
Eric Salodfb71552023-03-22 12:35:09 -070012516
12517#else // !UPB_USE_C11_ATOMICS
12518
Deanna Garciac7d979d2023-04-14 17:22:13 -070012519#include <string.h>
Eric Salodfb71552023-03-22 12:35:09 -070012520
Deanna Garciac7d979d2023-04-14 17:22:13 -070012521#define upb_Atomic_Init(addr, val) (*addr = val)
12522#define upb_Atomic_Load(addr, order) (*addr)
12523#define upb_Atomic_Store(addr, val, order) (*(addr) = val)
12524#define upb_Atomic_Add(addr, val, order) (*(addr) += val)
12525#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val)
Eric Salodfb71552023-03-22 12:35:09 -070012526
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070012527UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) {
12528 void* old;
12529 memcpy(&old, addr, sizeof(value));
12530 memcpy(addr, &value, sizeof(value));
12531 return old;
12532}
12533
12534#define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val)
12535
Deanna Garciac7d979d2023-04-14 17:22:13 -070012536// `addr` and `expected` are logically double pointers.
12537UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
12538 void* expected,
12539 void* desired) {
12540 if (memcmp(addr, expected, sizeof(desired)) == 0) {
12541 memcpy(addr, &desired, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070012542 return true;
12543 } else {
Deanna Garciac7d979d2023-04-14 17:22:13 -070012544 memcpy(expected, addr, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070012545 return false;
12546 }
12547}
12548
Deanna Garciac7d979d2023-04-14 17:22:13 -070012549#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
12550 success_order, failure_order) \
12551 _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \
12552 (void*)desired)
12553#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
12554 failure_order) \
12555 upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0)
12556
Eric Salodfb71552023-03-22 12:35:09 -070012557#endif
12558
12559
12560#endif // UPB_PORT_ATOMIC_H_
12561
Protobuf Team Bot95d7dc02023-12-13 04:09:17 +000012562#ifndef UPB_MESSAGE_COMPAT_H_
12563#define UPB_MESSAGE_COMPAT_H_
12564
12565#include <stdint.h>
12566
12567
12568// Must be last.
12569
12570// upb does not support mixing minitables from different sources but these
12571// functions are still used by some existing users so for now we make them
12572// available here. This may or may not change in the future so do not add
12573// them to new code.
12574
12575#ifdef __cplusplus
12576extern "C" {
12577#endif
12578
Protobuf Team Bot64441a22024-01-23 23:46:32 +000012579const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
12580 const upb_Message* msg, size_t index);
Protobuf Team Botf2845222023-12-19 04:57:32 +000012581
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012582// Returns the minitable with the given field number, or NULL on failure.
12583const upb_MiniTableExtension* upb_Message_FindExtensionByNumber(
12584 const upb_Message* msg, uint32_t field_number);
Protobuf Team Bot95d7dc02023-12-13 04:09:17 +000012585
12586#ifdef __cplusplus
12587} /* extern "C" */
12588#endif
12589
12590
12591#endif /* UPB_MESSAGE_COMPAT_H_ */
12592
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012593// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
12594
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012595#ifndef UPB_MESSAGE_INTERNAL_MAP_SORTER_H_
12596#define UPB_MESSAGE_INTERNAL_MAP_SORTER_H_
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012597
12598#include <stdlib.h>
12599
12600
Protobuf Team Botc12c96e2024-01-16 07:41:08 +000012601#ifndef UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
12602#define UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012603
12604#include <stdint.h>
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012605
12606
12607// Map entries aren't actually stored for map fields, they are only used during
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012608// parsing. (It helps a lot if all map entry messages have the same layout.)
12609// The mini_table layout code will ensure that all map entries have this layout.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012610//
12611// Note that users can and do create map entries directly, which will also use
12612// this layout.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012613
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012614typedef struct {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012615 struct upb_Message message;
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012616 // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
12617 // and the uint64_t helps make this clear.
12618 uint64_t hasbits;
12619 union {
12620 upb_StringView str; // For str/bytes.
12621 upb_value val; // For all other types.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012622 double d[2]; // Padding for 32-bit builds.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012623 } k;
12624 union {
12625 upb_StringView str; // For str/bytes.
12626 upb_value val; // For all other types.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012627 double d[2]; // Padding for 32-bit builds.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012628 } v;
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012629} upb_MapEntry;
12630
Protobuf Team Botc12c96e2024-01-16 07:41:08 +000012631#endif // UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012632
12633// Must be last.
12634
12635#ifdef __cplusplus
12636extern "C" {
12637#endif
12638
12639// _upb_mapsorter sorts maps and provides ordered iteration over the entries.
12640// Since maps can be recursive (map values can be messages which contain other
12641// maps), _upb_mapsorter can contain a stack of maps.
12642
12643typedef struct {
12644 void const** entries;
12645 int size;
12646 int cap;
12647} _upb_mapsorter;
12648
12649typedef struct {
12650 int start;
12651 int pos;
12652 int end;
12653} _upb_sortedmap;
12654
12655UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) {
12656 s->entries = NULL;
12657 s->size = 0;
12658 s->cap = 0;
12659}
12660
12661UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) {
Protobuf Team Botddc54062023-12-12 20:03:38 +000012662 if (s->entries) upb_gfree(s->entries);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012663}
12664
Protobuf Team Bot499c7482023-12-30 01:42:17 +000012665UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s,
12666 const struct upb_Map* map,
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012667 _upb_sortedmap* sorted, upb_MapEntry* ent) {
12668 if (sorted->pos == sorted->end) return false;
12669 const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++];
12670 upb_StringView key = upb_tabstrview(tabent->key);
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012671 _upb_map_fromkey(key, &ent->k, map->key_size);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012672 upb_value val = {tabent->val.val};
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012673 _upb_map_fromvalue(val, &ent->v, map->val_size);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012674 return true;
12675}
12676
12677UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s,
12678 _upb_sortedmap* sorted,
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012679 const upb_Extension** ext) {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012680 if (sorted->pos == sorted->end) return false;
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012681 *ext = (const upb_Extension*)s->entries[sorted->pos++];
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012682 return true;
12683}
12684
12685UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s,
12686 _upb_sortedmap* sorted) {
12687 s->size = sorted->start;
12688}
12689
12690bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
Protobuf Team Bot499c7482023-12-30 01:42:17 +000012691 const struct upb_Map* map, _upb_sortedmap* sorted);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012692
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012693bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts,
12694 size_t count, _upb_sortedmap* sorted);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012695
12696#ifdef __cplusplus
12697} /* extern "C" */
12698#endif
12699
12700
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012701#endif /* UPB_MESSAGE_INTERNAL_MAP_SORTER_H_ */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012702
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000012703#ifndef UPB_BASE_INTERNAL_LOG2_H_
12704#define UPB_BASE_INTERNAL_LOG2_H_
12705
12706// Must be last.
12707
12708#ifdef __cplusplus
12709extern "C" {
12710#endif
12711
12712UPB_INLINE int upb_Log2Ceiling(int x) {
12713 if (x <= 1) return 0;
12714#ifdef __GNUC__
12715 return 32 - __builtin_clz(x - 1);
12716#else
12717 int lg2 = 0;
12718 while ((1 << lg2) < x) lg2++;
12719 return lg2;
12720#endif
12721}
12722
12723UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
12724
12725#ifdef __cplusplus
12726} /* extern "C" */
12727#endif
12728
12729
12730#endif /* UPB_BASE_INTERNAL_LOG2_H_ */
12731
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012732#ifndef UPB_MESSAGE_COMPARE_H_
12733#define UPB_MESSAGE_COMPARE_H_
12734
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012735#include <stddef.h>
12736
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012737
12738// Must be last.
12739
12740#ifdef __cplusplus
12741extern "C" {
12742#endif
12743
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012744// Returns true if no known fields or extensions are set in the message.
12745UPB_API bool upb_Message_IsEmpty(const upb_Message* msg,
12746 const upb_MiniTable* m);
12747
12748UPB_API bool upb_Message_IsEqual(const upb_Message* msg1,
12749 const upb_Message* msg2,
Protobuf Team Botdb9cc392024-03-11 17:27:18 +000012750 const upb_MiniTable* m, int options);
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012751
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012752// If |ctype| is a message then |m| must point to its minitable.
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012753UPB_API_INLINE bool upb_MessageValue_IsEqual(upb_MessageValue val1,
12754 upb_MessageValue val2,
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012755 upb_CType ctype,
Protobuf Team Botdb9cc392024-03-11 17:27:18 +000012756 const upb_MiniTable* m,
12757 int options) {
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012758 switch (ctype) {
12759 case kUpb_CType_Bool:
12760 return val1.bool_val == val2.bool_val;
12761
12762 case kUpb_CType_Float:
12763 case kUpb_CType_Int32:
12764 case kUpb_CType_UInt32:
12765 case kUpb_CType_Enum:
12766 return val1.int32_val == val2.int32_val;
12767
12768 case kUpb_CType_Double:
12769 case kUpb_CType_Int64:
12770 case kUpb_CType_UInt64:
12771 return val1.int64_val == val2.int64_val;
12772
12773 case kUpb_CType_String:
12774 case kUpb_CType_Bytes:
12775 return upb_StringView_IsEqual(val1.str_val, val2.str_val);
12776
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012777 case kUpb_CType_Message:
Protobuf Team Botdb9cc392024-03-11 17:27:18 +000012778 return upb_Message_IsEqual(val1.msg_val, val2.msg_val, m, options);
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012779
12780 default:
12781 UPB_UNREACHABLE();
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012782 return false;
12783 }
12784}
12785
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012786#ifdef __cplusplus
12787} /* extern "C" */
12788#endif
12789
12790
12791#endif // UPB_MESSAGE_COMPARE_H_
12792
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012793#ifndef UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
12794#define UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
12795
12796#include <stddef.h>
12797
12798// Must be last.
12799
12800#ifdef __cplusplus
12801extern "C" {
12802#endif
12803
12804// Returns true if unknown fields from the two messages are equal when sorted
12805// and varints are made canonical.
12806//
12807// This function is discouraged, as the comparison is inherently lossy without
12808// schema data:
12809//
12810// 1. We don't know whether delimited fields are sub-messages. Unknown
12811// sub-messages will therefore not have their fields sorted and varints
12812// canonicalized.
12813// 2. We don't know about oneof/non-repeated fields, which should semantically
12814// discard every value except the last.
12815
12816typedef enum {
12817 kUpb_UnknownCompareResult_Equal = 0,
12818 kUpb_UnknownCompareResult_NotEqual = 1,
12819 kUpb_UnknownCompareResult_OutOfMemory = 2,
12820 kUpb_UnknownCompareResult_MaxDepthExceeded = 3,
12821} upb_UnknownCompareResult;
12822
12823upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(
12824 const char* buf1, size_t size1, const char* buf2, size_t size2,
12825 int max_depth);
12826
12827#ifdef __cplusplus
12828} /* extern "C" */
12829#endif
12830
12831
12832#endif /* UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_ */
12833
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012834#ifndef UPB_MESSAGE_COPY_H_
12835#define UPB_MESSAGE_COPY_H_
12836
12837
12838// Must be last.
12839
12840#ifdef __cplusplus
12841extern "C" {
12842#endif
12843
12844// Deep clones a message using the provided target arena.
12845upb_Message* upb_Message_DeepClone(const upb_Message* msg,
12846 const upb_MiniTable* m, upb_Arena* arena);
12847
12848// Shallow clones a message using the provided target arena.
12849upb_Message* upb_Message_ShallowClone(const upb_Message* msg,
12850 const upb_MiniTable* m, upb_Arena* arena);
12851
12852// Deep clones array contents.
12853upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type,
12854 const upb_MiniTable* sub, upb_Arena* arena);
12855
12856// Deep clones map contents.
12857upb_Map* upb_Map_DeepClone(const upb_Map* map, upb_CType key_type,
12858 upb_CType value_type,
12859 const upb_MiniTable* map_entry_table,
12860 upb_Arena* arena);
12861
12862// Deep copies the message from src to dst.
12863bool upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
12864 const upb_MiniTable* m, upb_Arena* arena);
12865
12866// Shallow copies the message from src to dst.
12867void upb_Message_ShallowCopy(upb_Message* dst, const upb_Message* src,
12868 const upb_MiniTable* m);
12869
12870#ifdef __cplusplus
12871} /* extern "C" */
12872#endif
12873
12874
12875#endif // UPB_MESSAGE_COPY_H_
12876
Adam Cozzette8059da22023-08-16 07:57:14 -070012877#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12878#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12879
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012880#include <stdint.h>
12881
Adam Cozzette8059da22023-08-16 07:57:14 -070012882
12883// Must be last.
12884
12885#ifdef __cplusplus
12886extern "C" {
12887#endif
12888
12889UPB_INLINE char _upb_ToBase92(int8_t ch) {
12890 extern const char _kUpb_ToBase92[];
12891 UPB_ASSERT(0 <= ch && ch < 92);
12892 return _kUpb_ToBase92[ch];
12893}
12894
12895UPB_INLINE char _upb_FromBase92(uint8_t ch) {
12896 extern const int8_t _kUpb_FromBase92[];
12897 if (' ' > ch || ch > '~') return -1;
12898 return _kUpb_FromBase92[ch - ' '];
12899}
12900
12901UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr,
12902 const char* end, char first_ch,
12903 uint8_t min, uint8_t max,
12904 uint32_t* out_val) {
12905 uint32_t val = 0;
12906 uint32_t shift = 0;
12907 const int bits_per_char =
12908 upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min));
12909 char ch = first_ch;
12910 while (1) {
12911 uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min);
12912 val |= bits << shift;
12913 if (ptr == end || *ptr < min || max < *ptr) {
12914 *out_val = val;
12915 UPB_ASSUME(ptr != NULL);
12916 return ptr;
12917 }
12918 ch = *ptr++;
12919 shift += bits_per_char;
12920 if (shift >= 32) return NULL;
12921 }
12922}
12923
12924#ifdef __cplusplus
12925} /* extern "C" */
12926#endif
12927
12928
12929#endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12930
Protobuf Team Bot91cfce92023-11-27 21:05:28 +000012931#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12932#define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12933
12934
Adam Cozzette8059da22023-08-16 07:57:14 -070012935// Must be last.
12936
12937// upb_MdDecoder: used internally for decoding MiniDescriptors for messages,
12938// extensions, and enums.
12939typedef struct {
12940 const char* end;
12941 upb_Status* status;
12942 jmp_buf err;
12943} upb_MdDecoder;
12944
12945UPB_PRINTF(2, 3)
12946UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d,
12947 const char* fmt, ...) {
12948 if (d->status) {
12949 va_list argp;
12950 upb_Status_SetErrorMessage(d->status, "Error building mini table: ");
12951 va_start(argp, fmt);
12952 upb_Status_VAppendErrorFormat(d->status, fmt, argp);
12953 va_end(argp);
12954 }
12955 UPB_LONGJMP(d->err, 1);
12956}
12957
12958UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d,
12959 const void* ptr) {
12960 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory");
12961}
12962
12963UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint(
12964 upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max,
12965 uint32_t* out_val) {
12966 ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val);
12967 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint");
12968 return ptr;
12969}
12970
12971
12972#endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12973
12974#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12975#define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12976
12977
12978// Must be last.
12979
12980typedef enum {
12981 kUpb_EncodedType_Double = 0,
12982 kUpb_EncodedType_Float = 1,
12983 kUpb_EncodedType_Fixed32 = 2,
12984 kUpb_EncodedType_Fixed64 = 3,
12985 kUpb_EncodedType_SFixed32 = 4,
12986 kUpb_EncodedType_SFixed64 = 5,
12987 kUpb_EncodedType_Int32 = 6,
12988 kUpb_EncodedType_UInt32 = 7,
12989 kUpb_EncodedType_SInt32 = 8,
12990 kUpb_EncodedType_Int64 = 9,
12991 kUpb_EncodedType_UInt64 = 10,
12992 kUpb_EncodedType_SInt64 = 11,
12993 kUpb_EncodedType_OpenEnum = 12,
12994 kUpb_EncodedType_Bool = 13,
12995 kUpb_EncodedType_Bytes = 14,
12996 kUpb_EncodedType_String = 15,
12997 kUpb_EncodedType_Group = 16,
12998 kUpb_EncodedType_Message = 17,
12999 kUpb_EncodedType_ClosedEnum = 18,
13000
13001 kUpb_EncodedType_RepeatedBase = 20,
13002} upb_EncodedType;
13003
13004typedef enum {
13005 kUpb_EncodedFieldModifier_FlipPacked = 1 << 0,
13006 kUpb_EncodedFieldModifier_IsRequired = 1 << 1,
13007 kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000013008 kUpb_EncodedFieldModifier_FlipValidateUtf8 = 1 << 3,
Adam Cozzette8059da22023-08-16 07:57:14 -070013009} upb_EncodedFieldModifier;
13010
13011enum {
13012 kUpb_EncodedValue_MinField = ' ',
13013 kUpb_EncodedValue_MaxField = 'I',
13014 kUpb_EncodedValue_MinModifier = 'L',
13015 kUpb_EncodedValue_MaxModifier = '[',
13016 kUpb_EncodedValue_End = '^',
13017 kUpb_EncodedValue_MinSkip = '_',
13018 kUpb_EncodedValue_MaxSkip = '~',
13019 kUpb_EncodedValue_OneofSeparator = '~',
13020 kUpb_EncodedValue_FieldSeparator = '|',
13021 kUpb_EncodedValue_MinOneofField = ' ',
13022 kUpb_EncodedValue_MaxOneofField = 'b',
13023 kUpb_EncodedValue_MaxEnumMask = 'A',
13024};
13025
13026enum {
13027 kUpb_EncodedVersion_EnumV1 = '!',
13028 kUpb_EncodedVersion_ExtensionV1 = '#',
13029 kUpb_EncodedVersion_MapV1 = '%',
13030 kUpb_EncodedVersion_MessageV1 = '$',
13031 kUpb_EncodedVersion_MessageSetV1 = '&',
13032};
13033
13034
13035#endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
13036
13037#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
13038#define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
13039
13040// Must be last.
13041
13042typedef enum {
13043 kUpb_FieldModifier_IsRepeated = 1 << 0,
13044 kUpb_FieldModifier_IsPacked = 1 << 1,
13045 kUpb_FieldModifier_IsClosedEnum = 1 << 2,
13046 kUpb_FieldModifier_IsProto3Singular = 1 << 3,
13047 kUpb_FieldModifier_IsRequired = 1 << 4,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000013048 kUpb_FieldModifier_ValidateUtf8 = 1 << 5,
Adam Cozzette8059da22023-08-16 07:57:14 -070013049} kUpb_FieldModifier;
13050
Protobuf Team Botb58bd402023-09-19 15:42:34 +000013051// These modifiers are also used on the wire.
Adam Cozzette8059da22023-08-16 07:57:14 -070013052typedef enum {
13053 kUpb_MessageModifier_ValidateUtf8 = 1 << 0,
13054 kUpb_MessageModifier_DefaultIsPacked = 1 << 1,
13055 kUpb_MessageModifier_IsExtendable = 1 << 2,
13056} kUpb_MessageModifier;
13057
13058
13059#endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
13060
Protobuf Team Botc4a7b032023-12-27 00:12:48 +000013061#ifndef UPB_MINI_TABLE_COMPAT_H_
13062#define UPB_MINI_TABLE_COMPAT_H_
13063
13064
13065// Must be last.
13066
13067// upb does not support mixing minitables from different sources but these
13068// functions are still used by some existing users so for now we make them
13069// available here. This may or may not change in the future so do not add
13070// them to new code.
13071
13072#ifdef __cplusplus
13073extern "C" {
13074#endif
13075
13076// Checks if memory layout of src is compatible with dst.
13077bool upb_MiniTable_Compatible(const upb_MiniTable* src,
13078 const upb_MiniTable* dst);
13079
13080typedef enum {
13081 kUpb_MiniTableEquals_NotEqual,
13082 kUpb_MiniTableEquals_Equal,
13083 kUpb_MiniTableEquals_OutOfMemory,
13084} upb_MiniTableEquals_Status;
13085
13086// Checks equality of mini tables originating from different language runtimes.
13087upb_MiniTableEquals_Status upb_MiniTable_Equals(const upb_MiniTable* src,
13088 const upb_MiniTable* dst);
13089
13090#ifdef __cplusplus
13091} /* extern "C" */
13092#endif
13093
13094
13095#endif /* UPB_MINI_TABLE_COMPAT_H_ */
13096
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013097#ifndef UPB_HASH_INT_TABLE_H_
13098#define UPB_HASH_INT_TABLE_H_
13099
13100
13101// Must be last.
13102
13103typedef struct {
13104 upb_table t; // For entries that don't fit in the array part.
13105 const upb_tabval* array; // Array part of the table. See const note above.
13106 size_t array_size; // Array part size.
13107 size_t array_count; // Array part number of elements.
13108} upb_inttable;
13109
13110#ifdef __cplusplus
13111extern "C" {
13112#endif
13113
13114// Initialize a table. If memory allocation failed, false is returned and
13115// the table is uninitialized.
13116bool upb_inttable_init(upb_inttable* table, upb_Arena* a);
13117
13118// Returns the number of values in the table.
13119size_t upb_inttable_count(const upb_inttable* t);
13120
13121// Inserts the given key into the hashtable with the given value.
13122// The key must not already exist in the hash table.
13123// The value must not be UINTPTR_MAX.
13124//
13125// If a table resize was required but memory allocation failed, false is
13126// returned and the table is unchanged.
13127bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val,
13128 upb_Arena* a);
13129
13130// Looks up key in this table, returning "true" if the key was found.
13131// If v is non-NULL, copies the value for this key into *v.
13132bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v);
13133
13134// Removes an item from the table. Returns true if the remove was successful,
13135// and stores the removed item in *val if non-NULL.
13136bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val);
13137
13138// Updates an existing entry in an inttable.
13139// If the entry does not exist, returns false and does nothing.
13140// Unlike insert/remove, this does not invalidate iterators.
13141bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val);
13142
13143// Optimizes the table for the current set of entries, for both memory use and
13144// lookup time. Client should call this after all entries have been inserted;
13145// inserting more entries is legal, but will likely require a table resize.
13146void upb_inttable_compact(upb_inttable* t, upb_Arena* a);
13147
13148// Iteration over inttable:
13149//
13150// intptr_t iter = UPB_INTTABLE_BEGIN;
13151// uintptr_t key;
13152// upb_value val;
13153// while (upb_inttable_next(t, &key, &val, &iter)) {
13154// // ...
13155// }
13156
13157#define UPB_INTTABLE_BEGIN -1
13158
13159bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val,
13160 intptr_t* iter);
13161void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter);
13162
13163#ifdef __cplusplus
13164} /* extern "C" */
13165#endif
13166
13167
13168#endif /* UPB_HASH_INT_TABLE_H_ */
13169
13170#ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_
13171#define UPB_WIRE_INTERNAL_CONSTANTS_H_
13172
13173#define kUpb_WireFormat_DefaultDepthLimit 100
13174
13175// MessageSet wire format is:
13176// message MessageSet {
13177// repeated group Item = 1 {
13178// required int32 type_id = 2;
13179// required bytes message = 3;
13180// }
13181// }
13182
13183enum {
13184 kUpb_MsgSet_Item = 1,
13185 kUpb_MsgSet_TypeId = 2,
13186 kUpb_MsgSet_Message = 3,
13187};
13188
13189#endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */
13190
13191/*
13192 * Internal implementation details of the decoder that are shared between
13193 * decode.c and decode_fast.c.
13194 */
13195
13196#ifndef UPB_WIRE_INTERNAL_DECODER_H_
13197#define UPB_WIRE_INTERNAL_DECODER_H_
13198
13199#include "utf8_range.h"
13200
13201// Must be last.
13202
13203#define DECODE_NOGROUP (uint32_t) - 1
13204
13205typedef struct upb_Decoder {
13206 upb_EpsCopyInputStream input;
13207 const upb_ExtensionRegistry* extreg;
13208 const char* unknown; // Start of unknown data, preserve at buffer flip
13209 upb_Message* unknown_msg; // Pointer to preserve data to
13210 int depth; // Tracks recursion depth to bound stack usage.
13211 uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP.
13212 uint16_t options;
13213 bool missing_required;
13214 union {
13215 upb_Arena arena;
13216 void* foo[UPB_ARENA_SIZE_HACK];
13217 };
13218 upb_DecodeStatus status;
13219 jmp_buf err;
13220
13221#ifndef NDEBUG
13222 const char* debug_tagstart;
13223 const char* debug_valstart;
13224#endif
13225} upb_Decoder;
13226
13227/* Error function that will abort decoding with longjmp(). We can't declare this
13228 * UPB_NORETURN, even though it is appropriate, because if we do then compilers
13229 * will "helpfully" refuse to tailcall to it
13230 * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
13231 * of our optimizations. That is also why we must declare it in a separate file,
13232 * otherwise the compiler will see that it calls longjmp() and deduce that it is
13233 * noreturn. */
13234const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status);
13235
13236extern const uint8_t upb_utf8_offsets[];
13237
13238UPB_INLINE
13239bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) {
13240 return utf8_range_IsValid(ptr, len);
13241}
13242
13243const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr,
13244 const upb_Message* msg,
13245 const upb_MiniTable* m);
13246
13247/* x86-64 pointers always have the high 16 bits matching. So we can shift
13248 * left 8 and right 8 without loss of information. */
13249UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) {
13250 return ((intptr_t)tablep << 8) | tablep->UPB_PRIVATE(table_mask);
13251}
13252
13253UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) {
13254 return (const upb_MiniTable*)(table >> 8);
13255}
13256
13257const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
13258 const char* ptr, int overrun);
13259
13260UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) {
13261 return upb_EpsCopyInputStream_IsDoneWithCallback(
13262 &d->input, ptr, &_upb_Decoder_IsDoneFallback);
13263}
13264
13265UPB_INLINE const char* _upb_Decoder_BufferFlipCallback(
13266 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) {
13267 upb_Decoder* d = (upb_Decoder*)e;
13268 if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
13269
13270 if (d->unknown) {
13271 if (!UPB_PRIVATE(_upb_Message_AddUnknown)(
13272 d->unknown_msg, d->unknown, old_end - d->unknown, &d->arena)) {
13273 _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
13274 }
13275 d->unknown = new_start;
13276 }
13277 return new_start;
13278}
13279
13280#if UPB_FASTTABLE
13281UPB_INLINE
13282const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr,
13283 upb_Message* msg, intptr_t table,
13284 uint64_t hasbits, uint64_t tag) {
13285 const upb_MiniTable* table_p = decode_totablep(table);
13286 uint8_t mask = table;
13287 uint64_t data;
13288 size_t idx = tag & mask;
13289 UPB_ASSUME((idx & 7) == 0);
13290 idx >>= 3;
13291 data = table_p->UPB_PRIVATE(fasttable)[idx].field_data ^ tag;
13292 UPB_MUSTTAIL return table_p->UPB_PRIVATE(fasttable)[idx].field_parser(
13293 d, ptr, msg, table, hasbits, data);
13294}
13295#endif
13296
13297UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) {
13298 uint16_t tag;
13299 memcpy(&tag, ptr, 2);
13300 return tag;
13301}
13302
13303
13304#endif /* UPB_WIRE_INTERNAL_DECODER_H_ */
13305
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013306#ifndef UPB_WIRE_READER_H_
13307#define UPB_WIRE_READER_H_
13308
13309
13310#ifndef UPB_WIRE_INTERNAL_READER_H_
13311#define UPB_WIRE_INTERNAL_READER_H_
13312
13313// Must be last.
13314
13315#define kUpb_WireReader_WireTypeBits 3
13316#define kUpb_WireReader_WireTypeMask 7
13317
13318typedef struct {
13319 const char* ptr;
13320 uint64_t val;
13321} UPB_PRIVATE(_upb_WireReader_LongVarint);
13322
13323#ifdef __cplusplus
13324extern "C" {
13325#endif
13326
13327UPB_PRIVATE(_upb_WireReader_LongVarint)
13328UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(const char* ptr, uint64_t val);
13329
Protobuf Team Bot1d143b52024-01-25 20:29:43 +000013330UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)(
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013331 const char* ptr, uint64_t* val, int maxlen, uint64_t maxval) {
13332 uint64_t byte = (uint8_t)*ptr;
13333 if (UPB_LIKELY((byte & 0x80) == 0)) {
13334 *val = (uint32_t)byte;
13335 return ptr + 1;
13336 }
13337 const char* start = ptr;
13338 UPB_PRIVATE(_upb_WireReader_LongVarint)
13339 res = UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(ptr, byte);
13340 if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) ||
13341 res.val > maxval) {
13342 return NULL; // Malformed.
13343 }
13344 *val = res.val;
13345 return res.ptr;
13346}
13347
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013348UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013349 return tag >> kUpb_WireReader_WireTypeBits;
13350}
13351
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013352UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013353 return tag & kUpb_WireReader_WireTypeMask;
13354}
13355
13356#ifdef __cplusplus
13357} /* extern "C" */
13358#endif
13359
13360
13361#endif // UPB_WIRE_INTERNAL_READER_H_
13362
13363#ifndef UPB_WIRE_TYPES_H_
13364#define UPB_WIRE_TYPES_H_
13365
13366// A list of types as they are encoded on the wire.
13367typedef enum {
13368 kUpb_WireType_Varint = 0,
13369 kUpb_WireType_64Bit = 1,
13370 kUpb_WireType_Delimited = 2,
13371 kUpb_WireType_StartGroup = 3,
13372 kUpb_WireType_EndGroup = 4,
13373 kUpb_WireType_32Bit = 5
13374} upb_WireType;
13375
13376#endif /* UPB_WIRE_TYPES_H_ */
13377
13378// Must be last.
13379
13380// The upb_WireReader interface is suitable for general-purpose parsing of
13381// protobuf binary wire format. It is designed to be used along with
13382// upb_EpsCopyInputStream for buffering, and all parsing routines in this file
13383// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is
13384// available to read without any bounds checks.
13385
13386#ifdef __cplusplus
13387extern "C" {
13388#endif
13389
13390// Parses a tag into `tag`, and returns a pointer past the end of the tag, or
13391// NULL if there was an error in the tag data.
13392//
13393// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13394// Bounds checks must be performed before calling this function, preferably
13395// by calling upb_EpsCopyInputStream_IsDone().
Protobuf Team Bot1d143b52024-01-25 20:29:43 +000013396UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
13397 uint32_t* tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013398 uint64_t val;
13399 ptr = UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, &val, 5, UINT32_MAX);
13400 if (!ptr) return NULL;
13401 *tag = val;
13402 return ptr;
13403}
13404
13405// Given a tag, returns the field number.
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013406UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013407
13408// Given a tag, returns the wire type.
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013409UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013410
13411UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr,
13412 uint64_t* val) {
13413 return UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, val, 10, UINT64_MAX);
13414}
13415
13416// Skips data for a varint, returning a pointer past the end of the varint, or
13417// NULL if there was an error in the varint data.
13418//
13419// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13420// Bounds checks must be performed before calling this function, preferably
13421// by calling upb_EpsCopyInputStream_IsDone().
13422UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) {
13423 uint64_t val;
13424 return upb_WireReader_ReadVarint(ptr, &val);
13425}
13426
13427// Reads a varint indicating the size of a delimited field into `size`, or
13428// NULL if there was an error in the varint data.
13429//
13430// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13431// Bounds checks must be performed before calling this function, preferably
13432// by calling upb_EpsCopyInputStream_IsDone().
13433UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) {
13434 uint64_t size64;
13435 ptr = upb_WireReader_ReadVarint(ptr, &size64);
13436 if (!ptr || size64 >= INT32_MAX) return NULL;
13437 *size = size64;
13438 return ptr;
13439}
13440
13441// Reads a fixed32 field, performing byte swapping if necessary.
13442//
13443// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
13444// Bounds checks must be performed before calling this function, preferably
13445// by calling upb_EpsCopyInputStream_IsDone().
13446UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) {
13447 uint32_t uval;
13448 memcpy(&uval, ptr, 4);
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +000013449 uval = upb_BigEndian32(uval);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013450 memcpy(val, &uval, 4);
13451 return ptr + 4;
13452}
13453
13454// Reads a fixed64 field, performing byte swapping if necessary.
13455//
13456// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
13457// Bounds checks must be performed before calling this function, preferably
13458// by calling upb_EpsCopyInputStream_IsDone().
13459UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) {
13460 uint64_t uval;
13461 memcpy(&uval, ptr, 8);
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +000013462 uval = upb_BigEndian64(uval);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013463 memcpy(val, &uval, 8);
13464 return ptr + 8;
13465}
13466
13467const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)(
13468 const char* ptr, uint32_t tag, int depth_limit,
13469 upb_EpsCopyInputStream* stream);
13470
13471// Skips data for a group, returning a pointer past the end of the group, or
13472// NULL if there was an error parsing the group. The `tag` argument should be
13473// the start group tag that begins the group. The `depth_limit` argument
13474// indicates how many levels of recursion the group is allowed to have before
13475// reporting a parse error (this limit exists to protect against stack
13476// overflow).
13477//
13478// TODO: evaluate how the depth_limit should be specified. Do users need
13479// control over this?
13480UPB_INLINE const char* upb_WireReader_SkipGroup(
13481 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
13482 return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, 100, stream);
13483}
13484
13485UPB_INLINE const char* _upb_WireReader_SkipValue(
13486 const char* ptr, uint32_t tag, int depth_limit,
13487 upb_EpsCopyInputStream* stream) {
13488 switch (upb_WireReader_GetWireType(tag)) {
13489 case kUpb_WireType_Varint:
13490 return upb_WireReader_SkipVarint(ptr);
13491 case kUpb_WireType_32Bit:
13492 return ptr + 4;
13493 case kUpb_WireType_64Bit:
13494 return ptr + 8;
13495 case kUpb_WireType_Delimited: {
13496 int size;
13497 ptr = upb_WireReader_ReadSize(ptr, &size);
13498 if (!ptr) return NULL;
13499 ptr += size;
13500 return ptr;
13501 }
13502 case kUpb_WireType_StartGroup:
13503 return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, depth_limit,
13504 stream);
13505 case kUpb_WireType_EndGroup:
13506 return NULL; // Should be handled before now.
13507 default:
13508 return NULL; // Unknown wire type.
13509 }
13510}
13511
13512// Skips data for a wire value of any type, returning a pointer past the end of
13513// the data, or NULL if there was an error parsing the group. The `tag` argument
13514// should be the tag that was just parsed. The `depth_limit` argument indicates
13515// how many levels of recursion a group is allowed to have before reporting a
13516// parse error (this limit exists to protect against stack overflow).
13517//
13518// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13519// Bounds checks must be performed before calling this function, preferably
13520// by calling upb_EpsCopyInputStream_IsDone().
13521//
13522// TODO: evaluate how the depth_limit should be specified. Do users need
13523// control over this?
13524UPB_INLINE const char* upb_WireReader_SkipValue(
13525 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
13526 return _upb_WireReader_SkipValue(ptr, tag, 100, stream);
13527}
13528
13529#ifdef __cplusplus
13530} /* extern "C" */
13531#endif
13532
13533
13534#endif // UPB_WIRE_READER_H_
13535
13536#ifndef UPB_LEX_STRTOD_H_
13537#define UPB_LEX_STRTOD_H_
13538
13539// Must be last.
13540
13541#ifdef __cplusplus
13542extern "C" {
13543#endif
13544
13545double _upb_NoLocaleStrtod(const char *str, char **endptr);
13546
13547#ifdef __cplusplus
13548} /* extern "C" */
13549#endif
13550
13551
13552#endif /* UPB_LEX_STRTOD_H_ */
13553
13554#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
13555#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
13556
13557#include <stdint.h>
13558
13559
13560// Must be last.
13561
13562// If the input buffer has at least this many bytes available, the encoder call
13563// is guaranteed to succeed (as long as field number order is maintained).
13564#define kUpb_MtDataEncoder_MinSize 16
13565
13566typedef struct {
13567 char* end; // Limit of the buffer passed as a parameter.
13568 // Aliased to internal-only members in .cc.
13569 char internal[32];
13570} upb_MtDataEncoder;
13571
13572#ifdef __cplusplus
13573extern "C" {
13574#endif
13575
13576// Encodes field/oneof information for a given message. The sequence of calls
13577// should look like:
13578//
13579// upb_MtDataEncoder e;
13580// char buf[256];
13581// char* ptr = buf;
13582// e.end = ptr + sizeof(buf);
13583// unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero
13584// ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod);
13585// // Fields *must* be in field number order.
13586// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13587// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13588// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13589//
13590// // If oneofs are present. Oneofs must be encoded after regular fields.
13591// ptr = upb_MiniTable_StartOneof(&e, ptr)
13592// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13593// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13594//
13595// ptr = upb_MiniTable_StartOneof(&e, ptr);
13596// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13597// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13598//
13599// Oneofs must be encoded after all regular fields.
13600char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr,
13601 uint64_t msg_mod);
13602char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr,
13603 upb_FieldType type, uint32_t field_num,
13604 uint64_t field_mod);
13605char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr);
13606char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr,
13607 uint32_t field_num);
13608
13609// Encodes the set of values for a given enum. The values must be given in
13610// order (after casting to uint32_t), and repeats are not allowed.
13611char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr);
13612char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr,
13613 uint32_t val);
13614char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr);
13615
13616// Encodes an entire mini descriptor for an extension.
13617char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr,
13618 upb_FieldType type, uint32_t field_num,
13619 uint64_t field_mod);
13620
13621// Encodes an entire mini descriptor for a map.
13622char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr,
13623 upb_FieldType key_type,
13624 upb_FieldType value_type, uint64_t key_mod,
13625 uint64_t value_mod);
13626
13627// Encodes an entire mini descriptor for a message set.
13628char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr);
13629
13630#ifdef __cplusplus
13631} /* extern "C" */
13632#endif
13633
13634
13635#endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */
13636
Eric Salo8809a112022-11-21 13:01:06 -080013637#ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_
13638#define UPB_REFLECTION_DEF_POOL_INTERNAL_H_
13639
13640
13641// Must be last.
13642
13643#ifdef __cplusplus
13644extern "C" {
13645#endif
13646
13647upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s);
13648size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s);
13649upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s);
13650
13651bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext,
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013652 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080013653bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v,
13654 upb_Status* status);
13655bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size,
13656 upb_value* v);
13657
13658void** _upb_DefPool_ScratchData(const upb_DefPool* s);
13659size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080013660void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform);
Eric Salo8809a112022-11-21 13:01:06 -080013661
13662// For generated code only: loads a generated descriptor.
13663typedef struct _upb_DefPool_Init {
13664 struct _upb_DefPool_Init** deps; // Dependencies of this file.
13665 const upb_MiniTableFile* layout;
13666 const char* filename;
13667 upb_StringView descriptor; // Serialized descriptor.
13668} _upb_DefPool_Init;
13669
13670bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init);
13671
13672// Should only be directly called by tests. This variant lets us suppress
13673// the use of compiled-in tables, forcing a rebuild of the tables at runtime.
13674bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init,
13675 bool rebuild_minitable);
13676
13677#ifdef __cplusplus
13678} /* extern "C" */
13679#endif
13680
13681
13682#endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */
13683
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000013684#ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
13685#define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
13686
13687
Eric Salo8809a112022-11-21 13:01:06 -080013688// Must be last.
13689
13690// We want to copy the options verbatim into the destination options proto.
13691// We use serialize+parse as our deep copy.
Mike Kruskal232ecf42023-01-14 00:09:40 -080013692#define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \
13693 if (UPB_DESC(desc_type##_has_options)(proto)) { \
13694 size_t size; \
13695 char* pb = UPB_DESC(options_type##_serialize)( \
13696 UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \
13697 if (!pb) _upb_DefBuilder_OomErr(ctx); \
13698 target = \
13699 UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \
13700 if (!target) _upb_DefBuilder_OomErr(ctx); \
13701 } else { \
13702 target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \
Eric Salo8809a112022-11-21 13:01:06 -080013703 }
13704
13705#ifdef __cplusplus
13706extern "C" {
13707#endif
13708
13709struct upb_DefBuilder {
13710 upb_DefPool* symtab;
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013711 upb_strtable feature_cache; // Caches features by identity.
13712 UPB_DESC(FeatureSet*) legacy_features; // For computing legacy features.
13713 char* tmp_buf; // Temporary buffer in tmp_arena.
13714 size_t tmp_buf_size; // Size of temporary buffer.
Eric Salo8809a112022-11-21 13:01:06 -080013715 upb_FileDef* file; // File we are building.
13716 upb_Arena* arena; // Allocate defs here.
13717 upb_Arena* tmp_arena; // For temporary allocations.
13718 upb_Status* status; // Record errors here.
13719 const upb_MiniTableFile* layout; // NULL if we should build layouts.
Mike Kruskal232ecf42023-01-14 00:09:40 -080013720 upb_MiniTablePlatform platform; // Platform we are targeting.
Eric Salo8809a112022-11-21 13:01:06 -080013721 int enum_count; // Count of enums built so far.
13722 int msg_count; // Count of messages built so far.
13723 int ext_count; // Count of extensions built so far.
13724 jmp_buf err; // longjmp() on error.
13725};
13726
13727extern const char* kUpbDefOptDefault;
13728
13729// ctx->status has already been set elsewhere so just fail/longjmp()
13730UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx);
13731
13732UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt,
13733 ...) UPB_PRINTF(2, 3);
13734UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx);
13735
13736const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx,
13737 const char* prefix,
13738 upb_StringView name);
13739
13740// Given a symbol and the base symbol inside which it is defined,
13741// find the symbol's definition.
13742const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx,
13743 const char* from_name_dbg,
13744 const char* base, upb_StringView sym,
13745 upb_deftype_t* type);
13746
13747const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx,
13748 const char* from_name_dbg, const char* base,
13749 upb_StringView sym, upb_deftype_t type);
13750
13751char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f,
13752 const char** src, const char* end);
13753
13754const char* _upb_DefBuilder_FullToShort(const char* fullname);
13755
13756UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) {
13757 if (bytes == 0) return NULL;
13758 void* ret = upb_Arena_Malloc(ctx->arena, bytes);
13759 if (!ret) _upb_DefBuilder_OomErr(ctx);
13760 return ret;
13761}
13762
13763// Adds a symbol |v| to the symtab, which must be a def pointer previously
13764// packed with pack_def(). The def's pointer to upb_FileDef* must be set before
13765// adding, so we know which entries to remove if building this file fails.
13766UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name,
13767 upb_value v) {
13768 upb_StringView sym = {.data = name, .size = strlen(name)};
13769 bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status);
13770 if (!ok) _upb_DefBuilder_FailJmp(ctx);
13771}
13772
13773UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) {
13774 return ctx->arena;
13775}
13776
13777UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) {
13778 return ctx->file;
13779}
13780
13781// This version of CheckIdent() is only called by other, faster versions after
13782// they detect a parsing error.
13783void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name,
13784 bool full);
13785
Eric Salo8809a112022-11-21 13:01:06 -080013786// Verify a full identifier string. This is slightly more complicated than
13787// verifying a relative identifier string because we must track '.' chars.
13788UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx,
13789 upb_StringView name) {
13790 bool good = name.size > 0;
13791 bool start = true;
13792
13793 for (size_t i = 0; i < name.size; i++) {
13794 const char c = name.data[i];
13795 const char d = c | 0x20; // force lowercase
13796 const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_');
13797 const bool is_numer = ('0' <= c) & (c <= '9') & !start;
13798 const bool is_dot = (c == '.') & !start;
13799
13800 good &= is_alpha | is_numer | is_dot;
13801 start = is_dot;
13802 }
13803
13804 if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true);
13805}
13806
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013807// Returns true if the returned feature set is new and must be populated.
13808bool _upb_DefBuilder_GetOrCreateFeatureSet(upb_DefBuilder* ctx,
13809 const UPB_DESC(FeatureSet*) parent,
13810 upb_StringView key,
13811 UPB_DESC(FeatureSet**) set);
13812
13813const UPB_DESC(FeatureSet*)
13814 _upb_DefBuilder_DoResolveFeatures(upb_DefBuilder* ctx,
13815 const UPB_DESC(FeatureSet*) parent,
13816 const UPB_DESC(FeatureSet*) child,
13817 bool is_implicit);
13818
13819UPB_INLINE const UPB_DESC(FeatureSet*)
13820 _upb_DefBuilder_ResolveFeatures(upb_DefBuilder* ctx,
13821 const UPB_DESC(FeatureSet*) parent,
13822 const UPB_DESC(FeatureSet*) child) {
13823 return _upb_DefBuilder_DoResolveFeatures(ctx, parent, child, false);
13824}
13825
Eric Salo8809a112022-11-21 13:01:06 -080013826#ifdef __cplusplus
13827} /* extern "C" */
13828#endif
13829
13830
13831#endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */
13832
13833#ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
13834#define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
13835
13836
13837// Must be last.
13838
13839#ifdef __cplusplus
13840extern "C" {
13841#endif
13842
13843upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i);
13844bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a);
13845const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e);
13846
13847// Allocate and initialize an array of |n| enum defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013848upb_EnumDef* _upb_EnumDefs_New(upb_DefBuilder* ctx, int n,
13849 const UPB_DESC(EnumDescriptorProto*)
13850 const* protos,
13851 const UPB_DESC(FeatureSet*) parent_features,
13852 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080013853
13854#ifdef __cplusplus
13855} /* extern "C" */
13856#endif
13857
13858
13859#endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */
13860
13861#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
13862#define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
13863
13864
13865// Must be last.
13866
13867#ifdef __cplusplus
13868extern "C" {
13869#endif
13870
13871upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i);
13872
13873// Allocate and initialize an array of |n| enum value defs owned by |e|.
13874upb_EnumValueDef* _upb_EnumValueDefs_New(
13875 upb_DefBuilder* ctx, const char* prefix, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013876 const UPB_DESC(EnumValueDescriptorProto*) const* protos,
13877 const UPB_DESC(FeatureSet*) parent_features, upb_EnumDef* e,
Eric Salo8809a112022-11-21 13:01:06 -080013878 bool* is_sorted);
13879
13880const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v,
13881 int n, upb_Arena* a);
13882
13883#ifdef __cplusplus
13884} /* extern "C" */
13885#endif
13886
13887
13888#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */
13889
13890#ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
13891#define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
13892
13893
13894// Must be last.
13895
13896#ifdef __cplusplus
13897extern "C" {
13898#endif
13899
13900upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i);
13901
Eric Salo8809a112022-11-21 13:01:06 -080013902bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f);
13903bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f);
13904int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
13905uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f);
13906void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix,
13907 upb_FieldDef* f);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013908void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx,
13909 const upb_FieldDef* f);
13910
13911// Allocate and initialize an array of |n| extensions (field defs).
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013912upb_FieldDef* _upb_Extensions_New(upb_DefBuilder* ctx, int n,
13913 const UPB_DESC(FieldDescriptorProto*)
13914 const* protos,
13915 const UPB_DESC(FeatureSet*) parent_features,
13916 const char* prefix, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080013917
13918// Allocate and initialize an array of |n| field defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013919upb_FieldDef* _upb_FieldDefs_New(upb_DefBuilder* ctx, int n,
13920 const UPB_DESC(FieldDescriptorProto*)
13921 const* protos,
13922 const UPB_DESC(FeatureSet*) parent_features,
13923 const char* prefix, upb_MessageDef* m,
13924 bool* is_sorted);
Eric Salo8809a112022-11-21 13:01:06 -080013925
13926// Allocate and return a list of pointers to the |n| field defs in |ff|,
13927// sorted by field number.
13928const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n,
13929 upb_Arena* a);
13930
13931#ifdef __cplusplus
13932} /* extern "C" */
13933#endif
13934
13935
13936#endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */
13937
13938#ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_
13939#define UPB_REFLECTION_FILE_DEF_INTERNAL_H_
13940
13941
13942// Must be last.
13943
13944#ifdef __cplusplus
13945extern "C" {
13946#endif
13947
13948const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable(
13949 const upb_FileDef* f, int i);
13950const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f);
13951const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f);
13952
13953// upb_FileDef_Package() returns "" if f->package is NULL, this does not.
13954const char* _upb_FileDef_RawPackage(const upb_FileDef* f);
13955
13956void _upb_FileDef_Create(upb_DefBuilder* ctx,
Mike Kruskal232ecf42023-01-14 00:09:40 -080013957 const UPB_DESC(FileDescriptorProto) * file_proto);
Eric Salo8809a112022-11-21 13:01:06 -080013958
13959#ifdef __cplusplus
13960} /* extern "C" */
13961#endif
13962
13963
13964#endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */
13965
13966#ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
13967#define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
13968
13969
13970// Must be last.
13971
13972#ifdef __cplusplus
13973extern "C" {
13974#endif
13975
13976upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i);
13977bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m);
13978bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size,
13979 upb_value v, upb_Arena* a);
13980void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
13981 const upb_FieldDef* f);
13982bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013983void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080013984void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx,
13985 const upb_MessageDef* m);
13986void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m);
13987
13988// Allocate and initialize an array of |n| message defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013989upb_MessageDef* _upb_MessageDefs_New(upb_DefBuilder* ctx, int n,
13990 const UPB_DESC(DescriptorProto*)
13991 const* protos,
13992 const UPB_DESC(FeatureSet*)
13993 parent_features,
13994 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080013995
13996#ifdef __cplusplus
13997} /* extern "C" */
13998#endif
13999
14000
14001#endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */
14002
14003#ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
14004#define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
14005
14006
14007// Must be last.
14008
14009#ifdef __cplusplus
14010extern "C" {
14011#endif
14012
14013upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i);
14014
14015// Allocate and initialize an array of |n| service defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014016upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
14017 const UPB_DESC(ServiceDescriptorProto*)
14018 const* protos,
14019 const UPB_DESC(FeatureSet*)
14020 parent_features);
Eric Salo8809a112022-11-21 13:01:06 -080014021
14022#ifdef __cplusplus
14023} /* extern "C" */
14024#endif
14025
14026
14027#endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */
14028
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014029#ifndef UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
14030#define UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
14031
14032// This file contains the serialized FeatureSetDefaults object for
14033// language-independent features and (possibly at some point) for upb-specific
14034// features. This is used for feature resolution under Editions.
14035// NOLINTBEGIN
14036// clang-format off
Protobuf Team Bot5b8b87f2023-11-30 05:12:08 +000014037#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\021\022\014\010\001\020\002\030\002 \003(\0010\002\030\346\007\n\021\022\014\010\002\020\001\030\001 \002(\0010\001\030\347\007\n\021\022\014\010\001\020\001\030\001 \002(\0010\001\030\350\007 \346\007(\350\007"
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014038// clang-format on
14039// NOLINTEND
14040
14041#endif // UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
14042
Eric Salo8809a112022-11-21 13:01:06 -080014043#ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_
14044#define UPB_REFLECTION_DESC_STATE_INTERNAL_H_
14045
14046
14047// Must be last.
14048
14049// Manages the storage for mini descriptor strings as they are being encoded.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000014050// TODO: Move some of this state directly into the encoder, maybe.
Eric Salo8809a112022-11-21 13:01:06 -080014051typedef struct {
14052 upb_MtDataEncoder e;
14053 size_t bufsize;
14054 char* buf;
14055 char* ptr;
14056} upb_DescState;
14057
14058#ifdef __cplusplus
14059extern "C" {
14060#endif
14061
14062UPB_INLINE void _upb_DescState_Init(upb_DescState* d) {
14063 d->bufsize = kUpb_MtDataEncoder_MinSize * 2;
14064 d->buf = NULL;
14065 d->ptr = NULL;
14066}
14067
14068bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a);
14069
14070#ifdef __cplusplus
14071} /* extern "C" */
14072#endif
14073
14074
14075#endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */
14076
14077#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
14078#define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
14079
14080
Protobuf Team Bot06310352023-09-26 21:54:58 +000014081// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080014082
14083#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
14084#define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
14085
14086
14087// Must be last.
14088
14089#ifdef __cplusplus
14090extern "C" {
14091#endif
14092
14093int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r);
14094int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r);
14095
14096#ifdef __cplusplus
14097} /* extern "C" */
14098#endif
14099
14100
14101#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */
14102
14103// Must be last.
14104
14105#ifdef __cplusplus
14106extern "C" {
14107#endif
14108
14109upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r,
14110 int i);
14111
14112// Allocate and initialize an array of |n| reserved ranges owned by |e|.
14113upb_EnumReservedRange* _upb_EnumReservedRanges_New(
14114 upb_DefBuilder* ctx, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014115 const UPB_DESC(EnumDescriptorProto_EnumReservedRange*) const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080014116 const upb_EnumDef* e);
14117
14118#ifdef __cplusplus
14119} /* extern "C" */
14120#endif
14121
14122
14123#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */
14124
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000014125#ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_
14126#define UPB_REFLECTION_INTERNAL_STRDUP2_H_
14127
14128#include <stddef.h>
14129
14130
14131// Must be last.
14132
14133#ifdef __cplusplus
14134extern "C" {
14135#endif
14136
14137// Variant that works with a length-delimited rather than NULL-delimited string,
14138// as supported by strtable.
14139char* upb_strdup2(const char* s, size_t len, upb_Arena* a);
14140
14141#ifdef __cplusplus
14142} /* extern "C" */
14143#endif
14144
14145
14146#endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */
14147
Eric Salo8809a112022-11-21 13:01:06 -080014148#ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
14149#define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
14150
14151
14152// Must be last.
14153
14154#ifdef __cplusplus
14155extern "C" {
14156#endif
14157
14158upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i);
14159
14160// Allocate and initialize an array of |n| extension ranges owned by |m|.
14161upb_ExtensionRange* _upb_ExtensionRanges_New(
14162 upb_DefBuilder* ctx, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014163 const UPB_DESC(DescriptorProto_ExtensionRange*) const* protos,
14164 const UPB_DESC(FeatureSet*) parent_features, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080014165
14166#ifdef __cplusplus
14167} /* extern "C" */
14168#endif
14169
14170
14171#endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */
14172
14173#ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
14174#define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
14175
14176
14177// Must be last.
14178
14179#ifdef __cplusplus
14180extern "C" {
14181#endif
14182
14183upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070014184void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o,
14185 const upb_FieldDef* f, const char* name, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -080014186
14187// Allocate and initialize an array of |n| oneof defs owned by |m|.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014188upb_OneofDef* _upb_OneofDefs_New(upb_DefBuilder* ctx, int n,
14189 const UPB_DESC(OneofDescriptorProto*)
14190 const* protos,
14191 const UPB_DESC(FeatureSet*) parent_features,
14192 upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080014193
14194size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m);
14195
14196#ifdef __cplusplus
14197} /* extern "C" */
14198#endif
14199
14200
14201#endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */
14202
14203#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
14204#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
14205
14206
Protobuf Team Bot06310352023-09-26 21:54:58 +000014207// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080014208
14209#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
14210#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
14211
14212
14213// Must be last.
14214
14215#ifdef __cplusplus
14216extern "C" {
14217#endif
14218
14219int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r);
14220int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r);
14221
14222#ifdef __cplusplus
14223} /* extern "C" */
14224#endif
14225
14226
14227#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */
14228
14229// Must be last.
14230
14231#ifdef __cplusplus
14232extern "C" {
14233#endif
14234
14235upb_MessageReservedRange* _upb_MessageReservedRange_At(
14236 const upb_MessageReservedRange* r, int i);
14237
14238// Allocate and initialize an array of |n| reserved ranges owned by |m|.
14239upb_MessageReservedRange* _upb_MessageReservedRanges_New(
14240 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080014241 const UPB_DESC(DescriptorProto_ReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080014242 const upb_MessageDef* m);
14243
14244#ifdef __cplusplus
14245} /* extern "C" */
14246#endif
14247
14248
14249#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */
14250
14251#ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
14252#define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
14253
14254
14255// Must be last.
14256
14257#ifdef __cplusplus
14258extern "C" {
14259#endif
14260
14261upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i);
14262
14263// Allocate and initialize an array of |n| method defs owned by |s|.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014264upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n,
14265 const UPB_DESC(MethodDescriptorProto*)
14266 const* protos,
14267 const UPB_DESC(FeatureSet*) parent_features,
14268 upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080014269
14270#ifdef __cplusplus
14271} /* extern "C" */
14272#endif
14273
14274
14275#endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */
14276
Eric Salo8809a112022-11-21 13:01:06 -080014277// This should #undef all macros #defined in def.inc
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014278
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014279#undef UPB_SIZE
14280#undef UPB_PTR_AT
Joshua Habermandd69a482021-05-17 22:40:33 -070014281#undef UPB_MAPTYPE_STRING
Eric Salo3f36a912022-12-05 14:12:25 -080014282#undef UPB_EXPORT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014283#undef UPB_INLINE
Eric Salo3f36a912022-12-05 14:12:25 -080014284#undef UPB_API
14285#undef UPB_API_INLINE
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014286#undef UPB_ALIGN_UP
14287#undef UPB_ALIGN_DOWN
14288#undef UPB_ALIGN_MALLOC
14289#undef UPB_ALIGN_OF
Protobuf Team Bote2785502023-12-21 21:28:36 +000014290#undef UPB_ALIGN_AS
Joshua Habermand3995ec2022-09-30 16:54:39 -070014291#undef UPB_MALLOC_ALIGN
Joshua Habermandd69a482021-05-17 22:40:33 -070014292#undef UPB_LIKELY
14293#undef UPB_UNLIKELY
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014294#undef UPB_FORCEINLINE
14295#undef UPB_NOINLINE
14296#undef UPB_NORETURN
Joshua Habermandd69a482021-05-17 22:40:33 -070014297#undef UPB_PRINTF
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014298#undef UPB_MAX
14299#undef UPB_MIN
14300#undef UPB_UNUSED
14301#undef UPB_ASSUME
14302#undef UPB_ASSERT
14303#undef UPB_UNREACHABLE
Joshua Habermandd69a482021-05-17 22:40:33 -070014304#undef UPB_SETJMP
14305#undef UPB_LONGJMP
14306#undef UPB_PTRADD
14307#undef UPB_MUSTTAIL
14308#undef UPB_FASTTABLE_SUPPORTED
Mike Kruskal232ecf42023-01-14 00:09:40 -080014309#undef UPB_FASTTABLE_MASK
Joshua Habermandd69a482021-05-17 22:40:33 -070014310#undef UPB_FASTTABLE
14311#undef UPB_FASTTABLE_INIT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014312#undef UPB_POISON_MEMORY_REGION
14313#undef UPB_UNPOISON_MEMORY_REGION
14314#undef UPB_ASAN
Sandy Zhange3b09432023-08-07 09:30:02 -070014315#undef UPB_ASAN_GUARD_SIZE
14316#undef UPB_CLANG_ASAN
Protobuf Team Bot5e8d7e52024-03-15 22:28:30 +000014317#undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN
Joshua Habermand3995ec2022-09-30 16:54:39 -070014318#undef UPB_DEPRECATED
14319#undef UPB_GNUC_MIN
Mike Kruskal232ecf42023-01-14 00:09:40 -080014320#undef UPB_DESCRIPTOR_UPB_H_FILENAME
14321#undef UPB_DESC
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014322#undef UPB_DESC_MINITABLE
Mike Kruskal232ecf42023-01-14 00:09:40 -080014323#undef UPB_IS_GOOGLE3
Eric Salodfb71552023-03-22 12:35:09 -070014324#undef UPB_ATOMIC
14325#undef UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -070014326#undef UPB_PRIVATE
Protobuf Team Bot07194fc2023-11-30 05:43:03 +000014327#undef UPB_ONLYBITS