blob: 2982fab997afcf1e89fb22786a48f4377794e491 [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,
4146 upb_Message* msg, const upb_MiniTable* l,
4147 const upb_ExtensionRegistry* extreg,
4148 int options, upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004149
4150#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08004151} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004152#endif
4153
Joshua Habermandd69a482021-05-17 22:40:33 -07004154
Mike Kruskal9cf9db82022-11-04 21:22:31 -07004155#endif /* UPB_WIRE_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07004156
Protobuf Team Botda56def2023-12-26 19:08:52 +00004157// upb_Encode: parsing from a upb_Message using a upb_MiniTable.
4158
4159#ifndef UPB_WIRE_ENCODE_H_
4160#define UPB_WIRE_ENCODE_H_
4161
4162#include <stddef.h>
4163#include <stdint.h>
4164
4165
4166// Must be last.
4167
4168#ifdef __cplusplus
4169extern "C" {
4170#endif
4171
4172enum {
4173 /* If set, the results of serializing will be deterministic across all
4174 * instances of this binary. There are no guarantees across different
4175 * binary builds.
4176 *
4177 * If your proto contains maps, the encoder will need to malloc()/free()
4178 * memory during encode. */
4179 kUpb_EncodeOption_Deterministic = 1,
4180
4181 // When set, unknown fields are not printed.
4182 kUpb_EncodeOption_SkipUnknown = 2,
4183
4184 // When set, the encode will fail if any required fields are missing.
4185 kUpb_EncodeOption_CheckRequired = 4,
4186};
4187
4188typedef enum {
4189 kUpb_EncodeStatus_Ok = 0,
4190 kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
4191 kUpb_EncodeStatus_MaxDepthExceeded = 2,
4192
4193 // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
4194 kUpb_EncodeStatus_MissingRequired = 3,
4195} upb_EncodeStatus;
4196
4197UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
4198 return (uint32_t)depth << 16;
4199}
4200
4201UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) {
4202 return options >> 16;
4203}
4204
4205// Enforce an upper bound on recursion depth.
4206UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) {
4207 uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options);
4208 if (max_depth > limit) max_depth = limit;
4209 return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff);
4210}
4211
4212UPB_API upb_EncodeStatus upb_Encode(const upb_Message* msg,
4213 const upb_MiniTable* l, int options,
4214 upb_Arena* arena, char** buf, size_t* size);
4215
4216#ifdef __cplusplus
4217} /* extern "C" */
4218#endif
4219
4220
4221#endif /* UPB_WIRE_ENCODE_H_ */
4222
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004223// These are the specialized field parser functions for the fast parser.
4224// Generated tables will refer to these by name.
4225//
4226// The function names are encoded with names like:
4227//
4228// // 123 4
4229// upb_pss_1bt(); // Parse singular string, 1 byte tag.
4230//
4231// In position 1:
4232// - 'p' for parse, most function use this
4233// - 'c' for copy, for when we are copying strings instead of aliasing
4234//
4235// In position 2 (cardinality):
4236// - 's' for singular, with or without hasbit
4237// - 'o' for oneof
4238// - 'r' for non-packed repeated
4239// - 'p' for packed repeated
4240//
4241// In position 3 (type):
4242// - 'b1' for bool
4243// - 'v4' for 4-byte varint
4244// - 'v8' for 8-byte varint
4245// - 'z4' for zig-zag-encoded 4-byte varint
4246// - 'z8' for zig-zag-encoded 8-byte varint
4247// - 'f4' for 4-byte fixed
4248// - 'f8' for 8-byte fixed
4249// - 'm' for sub-message
4250// - 's' for string (validate UTF-8)
4251// - 'b' for bytes
4252//
4253// In position 4 (tag length):
4254// - '1' for one-byte tags (field numbers 1-15)
4255// - '2' for two-byte tags (field numbers 16-2048)
4256
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004257#ifndef UPB_WIRE_INTERNAL_DECODE_FAST_H_
4258#define UPB_WIRE_INTERNAL_DECODE_FAST_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004259
4260
Joshua Habermand3995ec2022-09-30 16:54:39 -07004261// Must be last.
4262
4263#ifdef __cplusplus
4264extern "C" {
4265#endif
4266
Joshua Habermanf41049a2022-01-21 14:41:25 -08004267struct upb_Decoder;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004268
4269// The fallback, generic parsing function that can handle any field type.
4270// This just uses the regular (non-fast) parser to parse a single field.
Joshua Habermand3995ec2022-09-30 16:54:39 -07004271const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d,
4272 const char* ptr, upb_Message* msg,
4273 intptr_t table, uint64_t hasbits,
4274 uint64_t data);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004275
Joshua Habermanf41049a2022-01-21 14:41:25 -08004276#define UPB_PARSE_PARAMS \
4277 struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004278 uint64_t hasbits, uint64_t data
4279
4280/* primitive fields ***********************************************************/
4281
4282#define F(card, type, valbytes, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004283 const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004284
4285#define TYPES(card, tagbytes) \
4286 F(card, b, 1, tagbytes) \
4287 F(card, v, 4, tagbytes) \
4288 F(card, v, 8, tagbytes) \
4289 F(card, z, 4, tagbytes) \
4290 F(card, z, 8, tagbytes) \
4291 F(card, f, 4, tagbytes) \
4292 F(card, f, 8, tagbytes)
4293
4294#define TAGBYTES(card) \
4295 TYPES(card, 1) \
4296 TYPES(card, 2)
4297
4298TAGBYTES(s)
4299TAGBYTES(o)
4300TAGBYTES(r)
4301TAGBYTES(p)
4302
4303#undef F
4304#undef TYPES
4305#undef TAGBYTES
4306
4307/* string fields **************************************************************/
4308
4309#define F(card, tagbytes, type) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004310 const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
4311 const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004312
4313#define UTF8(card, tagbytes) \
4314 F(card, tagbytes, s) \
4315 F(card, tagbytes, b)
4316
4317#define TAGBYTES(card) \
4318 UTF8(card, 1) \
4319 UTF8(card, 2)
4320
4321TAGBYTES(s)
4322TAGBYTES(o)
4323TAGBYTES(r)
4324
4325#undef F
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004326#undef UTF8
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004327#undef TAGBYTES
4328
4329/* sub-message fields *********************************************************/
4330
4331#define F(card, tagbytes, size_ceil, ceil_arg) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004332 const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004333
4334#define SIZES(card, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004335 F(card, tagbytes, 64, 64) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004336 F(card, tagbytes, 128, 128) \
4337 F(card, tagbytes, 192, 192) \
4338 F(card, tagbytes, 256, 256) \
4339 F(card, tagbytes, max, -1)
4340
4341#define TAGBYTES(card) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004342 SIZES(card, 1) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004343 SIZES(card, 2)
4344
4345TAGBYTES(s)
4346TAGBYTES(o)
4347TAGBYTES(r)
4348
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004349#undef F
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004350#undef SIZES
4351#undef TAGBYTES
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004352
4353#undef UPB_PARSE_PARAMS
4354
Joshua Habermand3995ec2022-09-30 16:54:39 -07004355#ifdef __cplusplus
4356} /* extern "C" */
4357#endif
4358
4359
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004360#endif /* UPB_WIRE_INTERNAL_DECODE_FAST_H_ */
Mike Kruskal9d435022023-07-11 12:45:07 -07004361// IWYU pragma: end_exports
4362
4363#endif // UPB_GENERATED_CODE_SUPPORT_H_
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00004364/* This file was generated by upb_generator from the input file:
Mike Kruskal9d435022023-07-11 12:45:07 -07004365 *
4366 * google/protobuf/descriptor.proto
4367 *
4368 * Do not edit -- your changes will be discarded when the file is
4369 * regenerated. */
4370
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004371#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
4372#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
4373
4374
4375// Must be last.
4376
4377#ifdef __cplusplus
4378extern "C" {
4379#endif
4380
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004381extern const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init;
4382extern const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init;
4383extern const upb_MiniTable google__protobuf__DescriptorProto_msg_init;
4384extern const upb_MiniTable google__protobuf__DescriptorProto__ExtensionRange_msg_init;
4385extern const upb_MiniTable google__protobuf__DescriptorProto__ReservedRange_msg_init;
4386extern const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init;
4387extern const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init;
4388extern const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init;
4389extern const upb_MiniTable google__protobuf__OneofDescriptorProto_msg_init;
4390extern const upb_MiniTable google__protobuf__EnumDescriptorProto_msg_init;
4391extern const upb_MiniTable google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init;
4392extern const upb_MiniTable google__protobuf__EnumValueDescriptorProto_msg_init;
4393extern const upb_MiniTable google__protobuf__ServiceDescriptorProto_msg_init;
4394extern const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init;
4395extern const upb_MiniTable google__protobuf__FileOptions_msg_init;
4396extern const upb_MiniTable google__protobuf__MessageOptions_msg_init;
4397extern const upb_MiniTable google__protobuf__FieldOptions_msg_init;
4398extern const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00004399extern const upb_MiniTable google__protobuf__FieldOptions__FeatureSupport_msg_init;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004400extern const upb_MiniTable google__protobuf__OneofOptions_msg_init;
4401extern const upb_MiniTable google__protobuf__EnumOptions_msg_init;
4402extern const upb_MiniTable google__protobuf__EnumValueOptions_msg_init;
4403extern const upb_MiniTable google__protobuf__ServiceOptions_msg_init;
4404extern const upb_MiniTable google__protobuf__MethodOptions_msg_init;
4405extern const upb_MiniTable google__protobuf__UninterpretedOption_msg_init;
4406extern const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init;
4407extern const upb_MiniTable google__protobuf__FeatureSet_msg_init;
4408extern const upb_MiniTable google__protobuf__FeatureSetDefaults_msg_init;
4409extern const upb_MiniTable google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init;
4410extern const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init;
4411extern const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init;
4412extern const upb_MiniTable google__protobuf__GeneratedCodeInfo_msg_init;
4413extern const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004414
4415extern const upb_MiniTableEnum google_protobuf_Edition_enum_init;
4416extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init;
4417extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init;
4418extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init;
4419extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init;
4420extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init;
4421extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init;
Protobuf Team Bot61127952023-09-26 20:07:33 +00004422extern const upb_MiniTableEnum google_protobuf_FeatureSet_Utf8Validation_enum_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004423extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init;
4424extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init;
4425extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init;
4426extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init;
4427extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init;
4428extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init;
4429extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init;
4430extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init;
4431extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init;
4432extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout;
4433
4434#ifdef __cplusplus
4435} /* extern "C" */
4436#endif
4437
4438
4439#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */
4440
4441#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4442#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4443
4444#include <string.h>
4445
4446
4447// Must be last.
4448
4449#ifdef __cplusplus
4450extern "C" {
4451#endif
4452
4453// The maximum number of bytes a single protobuf field can take up in the
4454// wire format. We only want to do one bounds check per field, so the input
4455// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called,
4456// the decoder can read this many bytes without performing another bounds
4457// check. The stream will copy into a patch buffer as necessary to guarantee
4458// this invariant.
4459#define kUpb_EpsCopyInputStream_SlopBytes 16
4460
4461enum {
4462 kUpb_EpsCopyInputStream_NoAliasing = 0,
4463 kUpb_EpsCopyInputStream_OnPatch = 1,
4464 kUpb_EpsCopyInputStream_NoDelta = 2
4465};
4466
4467typedef struct {
4468 const char* end; // Can read up to SlopBytes bytes beyond this.
4469 const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0)
4470 uintptr_t aliasing;
Protobuf Team Bot1d143b52024-01-25 20:29:43 +00004471 int limit; // Submessage limit relative to end
4472 bool error; // To distinguish between EOF and error.
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004473 char patch[kUpb_EpsCopyInputStream_SlopBytes * 2];
4474} upb_EpsCopyInputStream;
4475
4476// Returns true if the stream is in the error state. A stream enters the error
4477// state when the user reads past a limit (caught in IsDone()) or the
4478// ZeroCopyInputStream returns an error.
4479UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) {
4480 return e->error;
4481}
4482
4483typedef const char* upb_EpsCopyInputStream_BufferFlipCallback(
4484 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start);
4485
4486typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc(
4487 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
4488
4489// Initializes a upb_EpsCopyInputStream using the contents of the buffer
4490// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least
4491// kUpb_EpsCopyInputStream_SlopBytes are available to read.
4492UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e,
4493 const char** ptr, size_t size,
4494 bool enable_aliasing) {
4495 if (size <= kUpb_EpsCopyInputStream_SlopBytes) {
4496 memset(&e->patch, 0, 32);
4497 if (size) memcpy(&e->patch, *ptr, size);
4498 e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch
4499 : kUpb_EpsCopyInputStream_NoAliasing;
4500 *ptr = e->patch;
4501 e->end = *ptr + size;
4502 e->limit = 0;
4503 } else {
4504 e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes;
4505 e->limit = kUpb_EpsCopyInputStream_SlopBytes;
4506 e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta
4507 : kUpb_EpsCopyInputStream_NoAliasing;
4508 }
4509 e->limit_ptr = e->end;
4510 e->error = false;
4511}
4512
4513typedef enum {
4514 // The current stream position is at a limit.
4515 kUpb_IsDoneStatus_Done,
4516
4517 // The current stream position is not at a limit.
4518 kUpb_IsDoneStatus_NotDone,
4519
4520 // The current stream position is not at a limit, and the stream needs to
4521 // be flipped to a new buffer before more data can be read.
4522 kUpb_IsDoneStatus_NeedFallback,
4523} upb_IsDoneStatus;
4524
4525// Returns the status of the current stream position. This is a low-level
4526// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible.
4527UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus(
4528 upb_EpsCopyInputStream* e, const char* ptr, int* overrun) {
4529 *overrun = ptr - e->end;
4530 if (UPB_LIKELY(ptr < e->limit_ptr)) {
4531 return kUpb_IsDoneStatus_NotDone;
4532 } else if (UPB_LIKELY(*overrun == e->limit)) {
4533 return kUpb_IsDoneStatus_Done;
4534 } else {
4535 return kUpb_IsDoneStatus_NeedFallback;
4536 }
4537}
4538
4539// Returns true if the stream has hit a limit, either the current delimited
4540// limit or the overall end-of-stream. As a side effect, this function may flip
4541// the pointer to a new buffer if there are less than
4542// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer.
4543//
4544// Postcondition: if the function returns false, there are at least
4545// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr.
4546UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback(
4547 upb_EpsCopyInputStream* e, const char** ptr,
4548 upb_EpsCopyInputStream_IsDoneFallbackFunc* func) {
4549 int overrun;
4550 switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) {
4551 case kUpb_IsDoneStatus_Done:
4552 return true;
4553 case kUpb_IsDoneStatus_NotDone:
4554 return false;
4555 case kUpb_IsDoneStatus_NeedFallback:
4556 *ptr = func(e, *ptr, overrun);
4557 return *ptr == NULL;
4558 }
4559 UPB_UNREACHABLE();
4560}
4561
4562const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback(
4563 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
4564
4565// A simpler version of IsDoneWithCallback() that does not support a buffer flip
4566// callback. Useful in cases where we do not need to insert custom logic at
4567// every buffer flip.
4568//
4569// If this returns true, the user must call upb_EpsCopyInputStream_IsError()
4570// to distinguish between EOF and error.
4571UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e,
4572 const char** ptr) {
4573 return upb_EpsCopyInputStream_IsDoneWithCallback(
4574 e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback);
4575}
4576
4577// Returns the total number of bytes that are safe to read from the current
4578// buffer without reading uninitialized or unallocated memory.
4579//
4580// Note that this check does not respect any semantic limits on the stream,
4581// either limits from PushLimit() or the overall stream end, so some of these
4582// bytes may have unpredictable, nonsense values in them. The guarantee is only
4583// that the bytes are valid to read from the perspective of the C language
4584// (ie. you can read without triggering UBSAN or ASAN).
4585UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable(
4586 upb_EpsCopyInputStream* e, const char* ptr) {
4587 return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes;
4588}
4589
4590// Returns true if the given delimited field size is valid (it does not extend
4591// beyond any previously-pushed limits). `ptr` should point to the beginning
4592// of the field data, after the delimited size.
4593//
4594// Note that this does *not* guarantee that all of the data for this field is in
4595// the current buffer.
4596UPB_INLINE bool upb_EpsCopyInputStream_CheckSize(
4597 const upb_EpsCopyInputStream* e, const char* ptr, int size) {
4598 UPB_ASSERT(size >= 0);
4599 return ptr - e->end + size <= e->limit;
4600}
4601
4602UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable(
4603 upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) {
4604 // This is one extra branch compared to the more normal:
4605 // return (size_t)(end - ptr) < size;
4606 // However it is one less computation if we are just about to use "ptr + len":
4607 // https://godbolt.org/z/35YGPz
4608 // In microbenchmarks this shows a small improvement.
4609 uintptr_t uptr = (uintptr_t)ptr;
4610 uintptr_t uend = (uintptr_t)e->limit_ptr;
4611 uintptr_t res = uptr + (size_t)size;
4612 if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes;
4613 // NOTE: this check depends on having a linear address space. This is not
4614 // technically guaranteed by uintptr_t.
4615 bool ret = res >= uptr && res <= uend;
4616 if (size < 0) UPB_ASSERT(!ret);
4617 return ret;
4618}
4619
4620// Returns true if the given delimited field size is valid (it does not extend
4621// beyond any previously-pushed limited) *and* all of the data for this field is
4622// available to be read in the current buffer.
4623//
4624// If the size is negative, this function will always return false. This
4625// property can be useful in some cases.
4626UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable(
4627 upb_EpsCopyInputStream* e, const char* ptr, int size) {
4628 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false);
4629}
4630
4631// Returns true if the given sub-message size is valid (it does not extend
4632// beyond any previously-pushed limited) *and* all of the data for this
4633// sub-message is available to be parsed in the current buffer.
4634//
4635// This implies that all fields from the sub-message can be parsed from the
4636// current buffer while maintaining the invariant that we always have at least
4637// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of
4638// any individual field start.
4639//
4640// If the size is negative, this function will always return false. This
4641// property can be useful in some cases.
4642UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(
4643 upb_EpsCopyInputStream* e, const char* ptr, int size) {
4644 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true);
4645}
4646
4647// Returns true if aliasing_enabled=true was passed to
4648// upb_EpsCopyInputStream_Init() when this stream was initialized.
4649UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled(
4650 upb_EpsCopyInputStream* e) {
4651 return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing;
4652}
4653
4654// Returns true if aliasing_enabled=true was passed to
4655// upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can
4656// alias into the region [ptr, size] in an input buffer.
4657UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable(
4658 upb_EpsCopyInputStream* e, const char* ptr, size_t size) {
4659 // When EpsCopyInputStream supports streaming, this will need to become a
4660 // runtime check.
4661 return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) &&
4662 e->aliasing >= kUpb_EpsCopyInputStream_NoDelta;
4663}
4664
4665// Returns a pointer into an input buffer that corresponds to the parsing
4666// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may
4667// be different if we are currently parsing out of the patch buffer.
4668//
4669// REQUIRES: Aliasing must be available for the given pointer. If the input is a
4670// flat buffer and aliasing is enabled, then aliasing will always be available.
4671UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr(
4672 upb_EpsCopyInputStream* e, const char* ptr) {
4673 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0));
4674 uintptr_t delta =
4675 e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing;
4676 return (const char*)((uintptr_t)ptr + delta);
4677}
4678
4679// Reads string data from the input, aliasing into the input buffer instead of
4680// copying. The parsing pointer is passed in `*ptr`, and will be updated if
4681// necessary to point to the actual input buffer. Returns the new parsing
4682// pointer, which will be advanced past the string data.
4683//
4684// REQUIRES: Aliasing must be available for this data region (test with
4685// upb_EpsCopyInputStream_AliasingAvailable().
4686UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased(
4687 upb_EpsCopyInputStream* e, const char** ptr, size_t size) {
4688 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size));
4689 const char* ret = *ptr + size;
4690 *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr);
4691 UPB_ASSUME(ret != NULL);
4692 return ret;
4693}
4694
4695// Skips `size` bytes of data from the input and returns a pointer past the end.
4696// Returns NULL on end of stream or error.
4697UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e,
4698 const char* ptr, int size) {
4699 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
4700 return ptr + size;
4701}
4702
4703// Copies `size` bytes of data from the input `ptr` into the buffer `to`, and
4704// returns a pointer past the end. Returns NULL on end of stream or error.
4705UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e,
4706 const char* ptr, void* to,
4707 int size) {
4708 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
4709 memcpy(to, ptr, size);
4710 return ptr + size;
4711}
4712
4713// Reads string data from the stream and advances the pointer accordingly.
4714// If aliasing was enabled when the stream was initialized, then the returned
4715// pointer will point into the input buffer if possible, otherwise new data
4716// will be allocated from arena and copied into. We may be forced to copy even
4717// if aliasing was enabled if the input data spans input buffers.
4718//
4719// Returns NULL if memory allocation failed, or we reached a premature EOF.
4720UPB_INLINE const char* upb_EpsCopyInputStream_ReadString(
4721 upb_EpsCopyInputStream* e, const char** ptr, size_t size,
4722 upb_Arena* arena) {
4723 if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) {
4724 return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size);
4725 } else {
4726 // We need to allocate and copy.
4727 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) {
4728 return NULL;
4729 }
4730 UPB_ASSERT(arena);
4731 char* data = (char*)upb_Arena_Malloc(arena, size);
4732 if (!data) return NULL;
4733 const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size);
4734 *ptr = data;
4735 return ret;
4736 }
4737}
4738
4739UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) {
4740 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4741}
4742
4743// Pushes a limit onto the stack of limits for the current stream. The limit
4744// will extend for `size` bytes beyond the position in `ptr`. Future calls to
4745// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position
4746// reaches this limit.
4747//
4748// Returns a delta that the caller must store and supply to PopLimit() below.
4749UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e,
4750 const char* ptr, int size) {
4751 int limit = size + (int)(ptr - e->end);
4752 int delta = e->limit - limit;
4753 _upb_EpsCopyInputStream_CheckLimit(e);
4754 UPB_ASSERT(limit <= e->limit);
4755 e->limit = limit;
4756 e->limit_ptr = e->end + UPB_MIN(0, limit);
4757 _upb_EpsCopyInputStream_CheckLimit(e);
4758 return delta;
4759}
4760
4761// Pops the last limit that was pushed on this stream. This may only be called
4762// once IsDone() returns true. The user must pass the delta that was returned
4763// from PushLimit().
4764UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e,
4765 const char* ptr,
4766 int saved_delta) {
4767 UPB_ASSERT(ptr - e->end == e->limit);
4768 _upb_EpsCopyInputStream_CheckLimit(e);
4769 e->limit += saved_delta;
4770 e->limit_ptr = e->end + UPB_MIN(0, e->limit);
4771 _upb_EpsCopyInputStream_CheckLimit(e);
4772}
4773
4774UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline(
4775 upb_EpsCopyInputStream* e, const char* ptr, int overrun,
4776 upb_EpsCopyInputStream_BufferFlipCallback* callback) {
4777 if (overrun < e->limit) {
4778 // Need to copy remaining data into patch buffer.
4779 UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes);
4780 const char* old_end = ptr;
4781 const char* new_start = &e->patch[0] + overrun;
4782 memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0,
4783 kUpb_EpsCopyInputStream_SlopBytes);
4784 memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes);
4785 ptr = new_start;
4786 e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes];
4787 e->limit -= kUpb_EpsCopyInputStream_SlopBytes;
4788 e->limit_ptr = e->end + e->limit;
4789 UPB_ASSERT(ptr < e->limit_ptr);
4790 if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) {
4791 e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start;
4792 }
4793 return callback(e, old_end, new_start);
4794 } else {
4795 UPB_ASSERT(overrun > e->limit);
4796 e->error = true;
4797 return callback(e, NULL, NULL);
4798 }
4799}
4800
4801typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc(
4802 upb_EpsCopyInputStream* e, const char* ptr, void* ctx);
4803
4804// Tries to perform a fast-path handling of the given delimited message data.
4805// If the sub-message beginning at `*ptr` and extending for `len` is short and
4806// fits within this buffer, calls `func` with `ctx` as a parameter, where the
4807// pushing and popping of limits is handled automatically and with lower cost
4808// than the normal PushLimit()/PopLimit() sequence.
Protobuf Team Bot1d143b52024-01-25 20:29:43 +00004809UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004810 upb_EpsCopyInputStream* e, const char** ptr, int len,
4811 upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
4812 if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) {
4813 return false;
4814 }
4815
4816 // Fast case: Sub-message is <128 bytes and fits in the current buffer.
4817 // This means we can preserve limit/limit_ptr verbatim.
4818 const char* saved_limit_ptr = e->limit_ptr;
4819 int saved_limit = e->limit;
4820 e->limit_ptr = *ptr + len;
4821 e->limit = e->limit_ptr - e->end;
4822 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4823 *ptr = func(e, *ptr, ctx);
4824 e->limit_ptr = saved_limit_ptr;
4825 e->limit = saved_limit;
4826 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4827 return true;
4828}
4829
4830#ifdef __cplusplus
4831} /* extern "C" */
4832#endif
4833
4834
4835#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4836
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004837#ifndef UPB_JSON_DECODE_H_
4838#define UPB_JSON_DECODE_H_
4839
4840
4841#ifndef UPB_REFLECTION_DEF_H_
4842#define UPB_REFLECTION_DEF_H_
4843
4844// IWYU pragma: begin_exports
4845
Protobuf Team Bot06310352023-09-26 21:54:58 +00004846// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004847
4848#ifndef UPB_REFLECTION_DEF_POOL_H_
4849#define UPB_REFLECTION_DEF_POOL_H_
4850
4851
Protobuf Team Bot06310352023-09-26 21:54:58 +00004852// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004853
4854// Declarations common to all public def types.
4855
4856#ifndef UPB_REFLECTION_COMMON_H_
4857#define UPB_REFLECTION_COMMON_H_
4858
4859// begin:google_only
4860// #ifndef UPB_BOOTSTRAP_STAGE0
4861// #include "net/proto2/proto/descriptor.upb.h"
4862// #else
4863// #include "google/protobuf/descriptor.upb.h"
4864// #endif
4865// end:google_only
4866
4867// begin:github_only
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00004868/* This file was generated by upb_generator from the input file:
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004869 *
4870 * google/protobuf/descriptor.proto
4871 *
4872 * Do not edit -- your changes will be discarded when the file is
4873 * regenerated. */
4874
Mike Kruskal9d435022023-07-11 12:45:07 -07004875#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
4876#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07004877
Protobuf Team Bot111d6552023-09-15 21:07:08 +00004878
4879
4880// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004881
4882#ifdef __cplusplus
4883extern "C" {
4884#endif
4885
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00004886typedef struct google_protobuf_FileDescriptorSet { upb_Message UPB_PRIVATE(base); } google_protobuf_FileDescriptorSet;
4887typedef struct google_protobuf_FileDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_FileDescriptorProto;
4888typedef struct google_protobuf_DescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto;
4889typedef struct google_protobuf_DescriptorProto_ExtensionRange { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto_ExtensionRange;
4890typedef struct google_protobuf_DescriptorProto_ReservedRange { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto_ReservedRange;
4891typedef struct google_protobuf_ExtensionRangeOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_ExtensionRangeOptions;
4892typedef struct google_protobuf_ExtensionRangeOptions_Declaration { upb_Message UPB_PRIVATE(base); } google_protobuf_ExtensionRangeOptions_Declaration;
4893typedef struct google_protobuf_FieldDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldDescriptorProto;
4894typedef struct google_protobuf_OneofDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_OneofDescriptorProto;
4895typedef struct google_protobuf_EnumDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumDescriptorProto;
4896typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumDescriptorProto_EnumReservedRange;
4897typedef struct google_protobuf_EnumValueDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumValueDescriptorProto;
4898typedef struct google_protobuf_ServiceDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_ServiceDescriptorProto;
4899typedef struct google_protobuf_MethodDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_MethodDescriptorProto;
4900typedef struct google_protobuf_FileOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_FileOptions;
4901typedef struct google_protobuf_MessageOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_MessageOptions;
4902typedef struct google_protobuf_FieldOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions;
4903typedef struct google_protobuf_FieldOptions_EditionDefault { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions_EditionDefault;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00004904typedef struct google_protobuf_FieldOptions_FeatureSupport { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions_FeatureSupport;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00004905typedef struct google_protobuf_OneofOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_OneofOptions;
4906typedef struct google_protobuf_EnumOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumOptions;
4907typedef struct google_protobuf_EnumValueOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumValueOptions;
4908typedef struct google_protobuf_ServiceOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_ServiceOptions;
4909typedef struct google_protobuf_MethodOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_MethodOptions;
4910typedef struct google_protobuf_UninterpretedOption { upb_Message UPB_PRIVATE(base); } google_protobuf_UninterpretedOption;
4911typedef struct google_protobuf_UninterpretedOption_NamePart { upb_Message UPB_PRIVATE(base); } google_protobuf_UninterpretedOption_NamePart;
4912typedef struct google_protobuf_FeatureSet { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSet;
4913typedef struct google_protobuf_FeatureSetDefaults { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSetDefaults;
4914typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault;
4915typedef struct google_protobuf_SourceCodeInfo { upb_Message UPB_PRIVATE(base); } google_protobuf_SourceCodeInfo;
4916typedef struct google_protobuf_SourceCodeInfo_Location { upb_Message UPB_PRIVATE(base); } google_protobuf_SourceCodeInfo_Location;
4917typedef struct google_protobuf_GeneratedCodeInfo { upb_Message UPB_PRIVATE(base); } google_protobuf_GeneratedCodeInfo;
4918typedef struct google_protobuf_GeneratedCodeInfo_Annotation { upb_Message UPB_PRIVATE(base); } google_protobuf_GeneratedCodeInfo_Annotation;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004919
4920typedef enum {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004921 google_protobuf_EDITION_UNKNOWN = 0,
4922 google_protobuf_EDITION_1_TEST_ONLY = 1,
4923 google_protobuf_EDITION_2_TEST_ONLY = 2,
Protobuf Team Bot67038022023-10-04 04:14:37 +00004924 google_protobuf_EDITION_PROTO2 = 998,
4925 google_protobuf_EDITION_PROTO3 = 999,
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004926 google_protobuf_EDITION_2023 = 1000,
Protobuf Team Bot41c8f2a2024-01-11 00:10:17 +00004927 google_protobuf_EDITION_2024 = 1001,
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004928 google_protobuf_EDITION_99997_TEST_ONLY = 99997,
4929 google_protobuf_EDITION_99998_TEST_ONLY = 99998,
Protobuf Team Botde57b672023-11-30 22:16:47 +00004930 google_protobuf_EDITION_99999_TEST_ONLY = 99999,
4931 google_protobuf_EDITION_MAX = 2147483647
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004932} google_protobuf_Edition;
4933
4934typedef enum {
Protobuf Team Bot469f0272023-04-21 18:12:45 -07004935 google_protobuf_ExtensionRangeOptions_DECLARATION = 0,
4936 google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1
4937} google_protobuf_ExtensionRangeOptions_VerificationState;
4938
4939typedef enum {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004940 google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0,
4941 google_protobuf_FeatureSet_OPEN = 1,
4942 google_protobuf_FeatureSet_CLOSED = 2
4943} google_protobuf_FeatureSet_EnumType;
4944
4945typedef enum {
4946 google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0,
4947 google_protobuf_FeatureSet_EXPLICIT = 1,
4948 google_protobuf_FeatureSet_IMPLICIT = 2,
4949 google_protobuf_FeatureSet_LEGACY_REQUIRED = 3
4950} google_protobuf_FeatureSet_FieldPresence;
4951
4952typedef enum {
4953 google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0,
4954 google_protobuf_FeatureSet_ALLOW = 1,
4955 google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2
4956} google_protobuf_FeatureSet_JsonFormat;
4957
4958typedef enum {
4959 google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0,
4960 google_protobuf_FeatureSet_LENGTH_PREFIXED = 1,
4961 google_protobuf_FeatureSet_DELIMITED = 2
4962} google_protobuf_FeatureSet_MessageEncoding;
4963
4964typedef enum {
4965 google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0,
4966 google_protobuf_FeatureSet_PACKED = 1,
4967 google_protobuf_FeatureSet_EXPANDED = 2
4968} google_protobuf_FeatureSet_RepeatedFieldEncoding;
4969
4970typedef enum {
Protobuf Team Bot61127952023-09-26 20:07:33 +00004971 google_protobuf_FeatureSet_UTF8_VALIDATION_UNKNOWN = 0,
Protobuf Team Bot5b8b87f2023-11-30 05:12:08 +00004972 google_protobuf_FeatureSet_VERIFY = 2,
4973 google_protobuf_FeatureSet_NONE = 3
Protobuf Team Bot61127952023-09-26 20:07:33 +00004974} google_protobuf_FeatureSet_Utf8Validation;
4975
4976typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004977 google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
4978 google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
4979 google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
4980} google_protobuf_FieldDescriptorProto_Label;
4981
4982typedef enum {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004983 google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
4984 google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
4985 google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
4986 google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
4987 google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
4988 google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
4989 google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
4990 google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
4991 google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
4992 google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
4993 google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
4994 google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
4995 google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
4996 google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
4997 google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
4998 google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
4999 google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
5000 google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
5001} google_protobuf_FieldDescriptorProto_Type;
5002
5003typedef enum {
5004 google_protobuf_FieldOptions_STRING = 0,
5005 google_protobuf_FieldOptions_CORD = 1,
5006 google_protobuf_FieldOptions_STRING_PIECE = 2
5007} google_protobuf_FieldOptions_CType;
5008
5009typedef enum {
5010 google_protobuf_FieldOptions_JS_NORMAL = 0,
5011 google_protobuf_FieldOptions_JS_STRING = 1,
5012 google_protobuf_FieldOptions_JS_NUMBER = 2
5013} google_protobuf_FieldOptions_JSType;
5014
5015typedef enum {
Adam Cozzette90ff32c2023-01-21 15:04:56 -08005016 google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0,
5017 google_protobuf_FieldOptions_RETENTION_RUNTIME = 1,
5018 google_protobuf_FieldOptions_RETENTION_SOURCE = 2
5019} google_protobuf_FieldOptions_OptionRetention;
5020
5021typedef enum {
5022 google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0,
5023 google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1,
5024 google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2,
5025 google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3,
5026 google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4,
5027 google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5,
5028 google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6,
5029 google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7,
5030 google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8,
5031 google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9
5032} google_protobuf_FieldOptions_OptionTargetType;
5033
5034typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08005035 google_protobuf_FileOptions_SPEED = 1,
5036 google_protobuf_FileOptions_CODE_SIZE = 2,
5037 google_protobuf_FileOptions_LITE_RUNTIME = 3
5038} google_protobuf_FileOptions_OptimizeMode;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005039
5040typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005041 google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0,
5042 google_protobuf_GeneratedCodeInfo_Annotation_SET = 1,
5043 google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2
5044} google_protobuf_GeneratedCodeInfo_Annotation_Semantic;
5045
Mike Kruskalccbdaa72023-02-02 20:42:14 -08005046typedef enum {
5047 google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
5048 google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
5049 google_protobuf_MethodOptions_IDEMPOTENT = 2
5050} google_protobuf_MethodOptions_IdempotencyLevel;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005051
Mike Kruskalccbdaa72023-02-02 20:42:14 -08005052
Joshua Habermanf41049a2022-01-21 14:41:25 -08005053
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005054/* google.protobuf.FileDescriptorSet */
5055
Joshua Habermanf41049a2022-01-21 14:41:25 -08005056UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005057 return (google_protobuf_FileDescriptorSet*)_upb_Message_New(&google__protobuf__FileDescriptorSet_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005058}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005059UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) {
5060 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005061 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005062 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorSet_msg_init, NULL, 0, arena) !=
5063 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005064 return NULL;
5065 }
5066 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005067}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005068UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size,
5069 const upb_ExtensionRegistry* extreg,
5070 int options, upb_Arena* arena) {
5071 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
5072 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005073 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorSet_msg_init, extreg, options,
5074 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005075 return NULL;
5076 }
5077 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005078}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005079UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005080 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005081 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorSet_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005082 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005083}
5084UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options,
5085 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005086 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005087 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorSet_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005088 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005089}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005090UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005091 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 +00005092 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005093}
Eric Salob7d54ac2022-12-29 11:59:42 -08005094UPB_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 +00005095 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 +00005096 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005097 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005098 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005099 return (const google_protobuf_FileDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005100 } else {
5101 if (size) *size = 0;
5102 return NULL;
5103 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005104}
Deanna Garciab26afb52023-04-25 13:37:18 -07005105UPB_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 +00005106 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 +00005107 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005108 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005109 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005110 }
5111 return arr;
5112}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005113UPB_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 +00005114 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 +00005115 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5116 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005117 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005118 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005119 }
5120 return arr;
5121}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005122
Eric Salob7d54ac2022-12-29 11:59:42 -08005123UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005124 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 +00005125 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005126 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005127 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005128 return (google_protobuf_FileDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005129 } else {
5130 if (size) *size = 0;
5131 return NULL;
5132 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005133}
Eric Salob7d54ac2022-12-29 11:59:42 -08005134UPB_INLINE 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 +00005135 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 +00005136 return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5137 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005138}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005139UPB_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 +00005140 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 +00005141 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5142 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005143 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005144 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005145 return NULL;
5146 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005147 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 -08005148 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005149 UPB_PRIVATE(_upb_Array_Set)
5150 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005151 return sub;
5152}
5153
5154/* google.protobuf.FileDescriptorProto */
5155
Joshua Habermanf41049a2022-01-21 14:41:25 -08005156UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005157 return (google_protobuf_FileDescriptorProto*)_upb_Message_New(&google__protobuf__FileDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005158}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005159UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5160 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005161 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005162 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorProto_msg_init, NULL, 0, arena) !=
5163 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005164 return NULL;
5165 }
5166 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005167}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005168UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size,
5169 const upb_ExtensionRegistry* extreg,
5170 int options, upb_Arena* arena) {
5171 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
5172 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005173 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorProto_msg_init, extreg, options,
5174 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005175 return NULL;
5176 }
5177 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005178}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005179UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005180 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005181 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005182 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005183}
5184UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options,
5185 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005186 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005187 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005188 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005189}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005190UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005191 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 +00005192 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005193}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005194UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005195 upb_StringView default_val = upb_StringView_FromString("");
5196 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005197 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 +00005198 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5199 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005200 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005201}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005202UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005203 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 +00005204 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005205}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005206UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005207 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 +00005208 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005209}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005210UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005211 upb_StringView default_val = upb_StringView_FromString("");
5212 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005213 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 +00005214 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5215 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005216 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005217}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005218UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005219 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 +00005220 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005221}
5222UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005223 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 +00005224 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005225}
Eric Salob7d54ac2022-12-29 11:59:42 -08005226UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005227 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 +00005228 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005229 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005230 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005231 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005232 } else {
5233 if (size) *size = 0;
5234 return NULL;
5235 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005236}
Deanna Garciab26afb52023-04-25 13:37:18 -07005237UPB_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 +00005238 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 +00005239 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005240 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005241 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005242 }
5243 return arr;
5244}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005245UPB_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 +00005246 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 +00005247 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5248 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005249 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005250 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005251 }
5252 return arr;
5253}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005254UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005255 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 +00005256 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005257}
Eric Salob7d54ac2022-12-29 11:59:42 -08005258UPB_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 +00005259 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 +00005260 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005261 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005262 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005263 return (const google_protobuf_DescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005264 } else {
5265 if (size) *size = 0;
5266 return NULL;
5267 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005268}
Deanna Garciab26afb52023-04-25 13:37:18 -07005269UPB_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 +00005270 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 +00005271 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005272 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005273 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005274 }
5275 return arr;
5276}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005277UPB_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 +00005278 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 +00005279 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5280 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005281 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005282 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005283 }
5284 return arr;
5285}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005286UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005287 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 +00005288 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005289}
Eric Salob7d54ac2022-12-29 11:59:42 -08005290UPB_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 +00005291 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 +00005292 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005293 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005294 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005295 return (const google_protobuf_EnumDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005296 } else {
5297 if (size) *size = 0;
5298 return NULL;
5299 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005300}
Deanna Garciab26afb52023-04-25 13:37:18 -07005301UPB_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 +00005302 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 +00005303 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005304 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005305 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005306 }
5307 return arr;
5308}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005309UPB_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 +00005310 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 +00005311 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5312 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005313 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005314 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005315 }
5316 return arr;
5317}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005318UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005319 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 +00005320 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005321}
Eric Salob7d54ac2022-12-29 11:59:42 -08005322UPB_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 +00005323 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 +00005324 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005325 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005326 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005327 return (const google_protobuf_ServiceDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005328 } else {
5329 if (size) *size = 0;
5330 return NULL;
5331 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005332}
Deanna Garciab26afb52023-04-25 13:37:18 -07005333UPB_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 +00005334 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 +00005335 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005336 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005337 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005338 }
5339 return arr;
5340}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005341UPB_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 +00005342 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 +00005343 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5344 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005345 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005346 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005347 }
5348 return arr;
5349}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005350UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005351 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 +00005352 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005353}
Eric Salob7d54ac2022-12-29 11:59:42 -08005354UPB_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 +00005355 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 +00005356 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005357 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005358 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005359 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005360 } else {
5361 if (size) *size = 0;
5362 return NULL;
5363 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005364}
Deanna Garciab26afb52023-04-25 13:37:18 -07005365UPB_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 +00005366 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 +00005367 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005368 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005369 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005370 }
5371 return arr;
5372}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005373UPB_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 +00005374 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 +00005375 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5376 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005377 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005378 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005379 }
5380 return arr;
5381}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005382UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005383 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 +00005384 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005385}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005386UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005387 const google_protobuf_FileOptions* default_val = NULL;
5388 const google_protobuf_FileOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005389 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 +00005390 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5391 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005392 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005393}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005394UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005395 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 +00005396 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005397}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005398UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005399 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 +00005400 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005401}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005402UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005403 const google_protobuf_SourceCodeInfo* default_val = NULL;
5404 const google_protobuf_SourceCodeInfo* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005405 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 +00005406 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5407 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005408 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005409}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005410UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005411 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 +00005412 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005413}
5414UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005415 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 +00005416 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08005417}
Eric Salob7d54ac2022-12-29 11:59:42 -08005418UPB_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 +00005419 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 +00005420 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005421 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005422 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005423 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005424 } else {
5425 if (size) *size = 0;
5426 return NULL;
5427 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005428}
Deanna Garciab26afb52023-04-25 13:37:18 -07005429UPB_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 +00005430 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 +00005431 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005432 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005433 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005434 }
5435 return arr;
5436}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005437UPB_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 +00005438 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 +00005439 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5440 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005441 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005442 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005443 }
5444 return arr;
5445}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005446UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005447 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 +00005448 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005449}
Eric Salob7d54ac2022-12-29 11:59:42 -08005450UPB_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 +00005451 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 +00005452 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005453 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005454 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005455 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005456 } else {
5457 if (size) *size = 0;
5458 return NULL;
5459 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005460}
Deanna Garciab26afb52023-04-25 13:37:18 -07005461UPB_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 +00005462 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 +00005463 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005464 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005465 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005466 }
5467 return arr;
5468}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005469UPB_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 +00005470 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 +00005471 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5472 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005473 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005474 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005475 }
5476 return arr;
5477}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005478UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005479 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 +00005480 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005481}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005482UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005483 upb_StringView default_val = upb_StringView_FromString("");
5484 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005485 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 +00005486 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5487 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005488 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005489}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005490UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005491 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 +00005492 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005493}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005494UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005495 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 +00005496 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005497}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00005498UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) {
5499 int32_t default_val = 0;
5500 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005501 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 +00005502 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5503 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005504 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005505}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005506UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005507 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 +00005508 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005509}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005510
Joshua Habermanf41049a2022-01-21 14:41:25 -08005511UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005512 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 +00005513 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005514}
5515UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005516 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 +00005517 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005518}
5519UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005520 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 +00005521 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005522 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005523 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005524 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005525 } else {
5526 if (size) *size = 0;
5527 return NULL;
5528 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005529}
Eric Salob7d54ac2022-12-29 11:59:42 -08005530UPB_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 +00005531 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 +00005532 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5533 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005534}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005535UPB_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 +00005536 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 +00005537 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5538 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005539 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005540 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005541 return false;
5542 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005543 UPB_PRIVATE(_upb_Array_Set)
5544 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005545 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005546}
Eric Salob7d54ac2022-12-29 11:59:42 -08005547UPB_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 +00005548 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 +00005549 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005550 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005551 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005552 return (google_protobuf_DescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005553 } else {
5554 if (size) *size = 0;
5555 return NULL;
5556 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005557}
Eric Salob7d54ac2022-12-29 11:59:42 -08005558UPB_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 +00005559 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 +00005560 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5561 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005562}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005563UPB_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 +00005564 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 +00005565 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5566 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005567 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005568 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005569 return NULL;
5570 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005571 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 -08005572 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005573 UPB_PRIVATE(_upb_Array_Set)
5574 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005575 return sub;
5576}
Eric Salob7d54ac2022-12-29 11:59:42 -08005577UPB_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 +00005578 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 +00005579 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005580 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005581 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005582 return (google_protobuf_EnumDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005583 } else {
5584 if (size) *size = 0;
5585 return NULL;
5586 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005587}
Eric Salob7d54ac2022-12-29 11:59:42 -08005588UPB_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 +00005589 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 +00005590 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5591 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005592}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005593UPB_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 +00005594 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 +00005595 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5596 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005597 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005598 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005599 return NULL;
5600 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005601 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 -08005602 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005603 UPB_PRIVATE(_upb_Array_Set)
5604 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005605 return sub;
5606}
Eric Salob7d54ac2022-12-29 11:59:42 -08005607UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005608 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 +00005609 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005610 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005611 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005612 return (google_protobuf_ServiceDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005613 } else {
5614 if (size) *size = 0;
5615 return NULL;
5616 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005617}
Eric Salob7d54ac2022-12-29 11:59:42 -08005618UPB_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 +00005619 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 +00005620 return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5621 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005622}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005623UPB_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 +00005624 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 +00005625 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5626 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005627 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005628 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005629 return NULL;
5630 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005631 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 -08005632 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005633 UPB_PRIVATE(_upb_Array_Set)
5634 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005635 return sub;
5636}
Eric Salob7d54ac2022-12-29 11:59:42 -08005637UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005638 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 +00005639 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005640 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005641 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005642 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005643 } else {
5644 if (size) *size = 0;
5645 return NULL;
5646 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005647}
Eric Salob7d54ac2022-12-29 11:59:42 -08005648UPB_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 +00005649 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 +00005650 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5651 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005652}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005653UPB_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 +00005654 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 +00005655 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5656 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005657 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005658 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005659 return NULL;
5660 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005661 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 -08005662 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005663 UPB_PRIVATE(_upb_Array_Set)
5664 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005665 return sub;
5666}
5667UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005668 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 +00005669 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005670}
5671UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005672 struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
5673 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005674 sub = (struct google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005675 if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005676 }
5677 return sub;
5678}
5679UPB_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 +00005680 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 +00005681 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005682}
5683UPB_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 -08005684 struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
5685 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005686 sub = (struct google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005687 if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005688 }
5689 return sub;
5690}
Eric Salob7d54ac2022-12-29 11:59:42 -08005691UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005692 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 +00005693 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005694 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005695 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005696 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005697 } else {
5698 if (size) *size = 0;
5699 return NULL;
5700 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005701}
Eric Salob7d54ac2022-12-29 11:59:42 -08005702UPB_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 +00005703 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 +00005704 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5705 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005706}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005707UPB_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 +00005708 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 +00005709 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5710 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005711 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005712 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005713 return false;
5714 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005715 UPB_PRIVATE(_upb_Array_Set)
5716 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005717 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005718}
Eric Salob7d54ac2022-12-29 11:59:42 -08005719UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005720 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 +00005721 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005722 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005723 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005724 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005725 } else {
5726 if (size) *size = 0;
5727 return NULL;
5728 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005729}
Eric Salob7d54ac2022-12-29 11:59:42 -08005730UPB_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 +00005731 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 +00005732 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5733 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005734}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005735UPB_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 +00005736 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 +00005737 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5738 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005739 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005740 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005741 return false;
5742 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005743 UPB_PRIVATE(_upb_Array_Set)
5744 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005745 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005746}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005747UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005748 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 +00005749 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005750}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00005751UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005752 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 +00005753 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005754}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005755
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005756/* google.protobuf.DescriptorProto */
5757
Joshua Habermanf41049a2022-01-21 14:41:25 -08005758UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005759 return (google_protobuf_DescriptorProto*)_upb_Message_New(&google__protobuf__DescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005760}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005761UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5762 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005763 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005764 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto_msg_init, NULL, 0, arena) !=
5765 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005766 return NULL;
5767 }
5768 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005769}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005770UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size,
5771 const upb_ExtensionRegistry* extreg,
5772 int options, upb_Arena* arena) {
5773 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
5774 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005775 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto_msg_init, extreg, options,
5776 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005777 return NULL;
5778 }
5779 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005780}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005781UPB_INLINE char* google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005782 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005783 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005784 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005785}
5786UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options,
5787 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005788 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005789 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005790 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005791}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005792UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005793 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 +00005794 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005795}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005796UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005797 upb_StringView default_val = upb_StringView_FromString("");
5798 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005799 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 +00005800 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5801 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005802 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005803}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005804UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005805 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 +00005806 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005807}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005808UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005809 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 +00005810 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005811}
Eric Salob7d54ac2022-12-29 11:59:42 -08005812UPB_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 +00005813 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 +00005814 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005815 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005816 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005817 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005818 } else {
5819 if (size) *size = 0;
5820 return NULL;
5821 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005822}
Deanna Garciab26afb52023-04-25 13:37:18 -07005823UPB_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 +00005824 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 +00005825 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005826 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005827 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005828 }
5829 return arr;
5830}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005831UPB_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 +00005832 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 +00005833 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5834 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005835 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005836 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005837 }
5838 return arr;
5839}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005840UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005841 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 +00005842 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005843}
Eric Salob7d54ac2022-12-29 11:59:42 -08005844UPB_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 +00005845 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 +00005846 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005847 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005848 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005849 return (const google_protobuf_DescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005850 } else {
5851 if (size) *size = 0;
5852 return NULL;
5853 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005854}
Deanna Garciab26afb52023-04-25 13:37:18 -07005855UPB_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 +00005856 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 +00005857 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005858 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005859 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005860 }
5861 return arr;
5862}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005863UPB_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 +00005864 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 +00005865 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5866 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005867 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005868 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005869 }
5870 return arr;
5871}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005872UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005873 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 +00005874 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005875}
Eric Salob7d54ac2022-12-29 11:59:42 -08005876UPB_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 +00005877 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 +00005878 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005879 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005880 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005881 return (const google_protobuf_EnumDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005882 } else {
5883 if (size) *size = 0;
5884 return NULL;
5885 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005886}
Deanna Garciab26afb52023-04-25 13:37:18 -07005887UPB_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 +00005888 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 +00005889 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005890 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005891 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005892 }
5893 return arr;
5894}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005895UPB_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 +00005896 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 +00005897 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5898 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005899 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005900 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005901 }
5902 return arr;
5903}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005904UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005905 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 +00005906 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005907}
Eric Salob7d54ac2022-12-29 11:59:42 -08005908UPB_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 +00005909 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 +00005910 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005911 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005912 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005913 return (const google_protobuf_DescriptorProto_ExtensionRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005914 } else {
5915 if (size) *size = 0;
5916 return NULL;
5917 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005918}
Deanna Garciab26afb52023-04-25 13:37:18 -07005919UPB_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 +00005920 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 +00005921 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005922 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005923 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005924 }
5925 return arr;
5926}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005927UPB_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 +00005928 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 +00005929 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5930 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005931 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005932 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005933 }
5934 return arr;
5935}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005936UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005937 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 +00005938 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005939}
Eric Salob7d54ac2022-12-29 11:59:42 -08005940UPB_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 +00005941 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 +00005942 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005943 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005944 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005945 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005946 } else {
5947 if (size) *size = 0;
5948 return NULL;
5949 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005950}
Deanna Garciab26afb52023-04-25 13:37:18 -07005951UPB_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 +00005952 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 +00005953 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005954 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005955 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005956 }
5957 return arr;
5958}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005959UPB_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 +00005960 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 +00005961 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5962 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005963 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005964 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005965 }
5966 return arr;
5967}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005968UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005969 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 +00005970 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005971}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005972UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005973 const google_protobuf_MessageOptions* default_val = NULL;
5974 const google_protobuf_MessageOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005975 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 +00005976 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5977 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005978 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005979}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005980UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005981 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 +00005982 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005983}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005984UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005985 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 +00005986 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005987}
Eric Salob7d54ac2022-12-29 11:59:42 -08005988UPB_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 +00005989 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 +00005990 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005991 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005992 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005993 return (const google_protobuf_OneofDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005994 } else {
5995 if (size) *size = 0;
5996 return NULL;
5997 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005998}
Deanna Garciab26afb52023-04-25 13:37:18 -07005999UPB_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 +00006000 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 +00006001 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006002 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006003 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006004 }
6005 return arr;
6006}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006007UPB_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 +00006008 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 +00006009 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6010 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006011 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006012 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006013 }
6014 return arr;
6015}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006016UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006017 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 +00006018 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006019}
Eric Salob7d54ac2022-12-29 11:59:42 -08006020UPB_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 +00006021 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 +00006022 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006023 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006024 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006025 return (const google_protobuf_DescriptorProto_ReservedRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006026 } else {
6027 if (size) *size = 0;
6028 return NULL;
6029 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006030}
Deanna Garciab26afb52023-04-25 13:37:18 -07006031UPB_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 +00006032 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 +00006033 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006034 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006035 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006036 }
6037 return arr;
6038}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006039UPB_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 +00006040 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 +00006041 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6042 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006043 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006044 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006045 }
6046 return arr;
6047}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006048UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006049 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 +00006050 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006051}
Eric Salob7d54ac2022-12-29 11:59:42 -08006052UPB_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 +00006053 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 +00006054 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006055 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006056 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006057 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006058 } else {
6059 if (size) *size = 0;
6060 return NULL;
6061 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006062}
Deanna Garciab26afb52023-04-25 13:37:18 -07006063UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_name_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006064 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 +00006065 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006066 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006067 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006068 }
6069 return arr;
6070}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006071UPB_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 +00006072 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 +00006073 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6074 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006075 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006076 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006077 }
6078 return arr;
6079}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006080
Joshua Habermanf41049a2022-01-21 14:41:25 -08006081UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006082 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 +00006083 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006084}
6085UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006086 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 +00006087 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006088 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006089 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006090 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006091 } else {
6092 if (size) *size = 0;
6093 return NULL;
6094 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006095}
Eric Salob7d54ac2022-12-29 11:59:42 -08006096UPB_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 +00006097 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 +00006098 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6099 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006100}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006101UPB_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 +00006102 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 +00006103 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6104 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006105 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006106 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006107 return NULL;
6108 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006109 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 -08006110 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006111 UPB_PRIVATE(_upb_Array_Set)
6112 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006113 return sub;
6114}
Eric Salob7d54ac2022-12-29 11:59:42 -08006115UPB_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 +00006116 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 +00006117 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006118 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006119 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006120 return (google_protobuf_DescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006121 } else {
6122 if (size) *size = 0;
6123 return NULL;
6124 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006125}
Eric Salob7d54ac2022-12-29 11:59:42 -08006126UPB_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 +00006127 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 +00006128 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6129 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006130}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006131UPB_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 +00006132 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 +00006133 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6134 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006135 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006136 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006137 return NULL;
6138 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006139 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 -08006140 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006141 UPB_PRIVATE(_upb_Array_Set)
6142 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006143 return sub;
6144}
Eric Salob7d54ac2022-12-29 11:59:42 -08006145UPB_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 +00006146 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 +00006147 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006148 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006149 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006150 return (google_protobuf_EnumDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006151 } else {
6152 if (size) *size = 0;
6153 return NULL;
6154 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006155}
Eric Salob7d54ac2022-12-29 11:59:42 -08006156UPB_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 +00006157 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 +00006158 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6159 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006160}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006161UPB_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 +00006162 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 +00006163 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6164 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006165 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006166 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006167 return NULL;
6168 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006169 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 -08006170 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006171 UPB_PRIVATE(_upb_Array_Set)
6172 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006173 return sub;
6174}
Eric Salob7d54ac2022-12-29 11:59:42 -08006175UPB_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 +00006176 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 +00006177 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006178 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006179 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006180 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006181 } else {
6182 if (size) *size = 0;
6183 return NULL;
6184 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006185}
Eric Salob7d54ac2022-12-29 11:59:42 -08006186UPB_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 +00006187 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 +00006188 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6189 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006190}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006191UPB_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 +00006192 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 +00006193 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6194 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006195 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006196 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006197 return NULL;
6198 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006199 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 -08006200 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006201 UPB_PRIVATE(_upb_Array_Set)
6202 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006203 return sub;
6204}
Eric Salob7d54ac2022-12-29 11:59:42 -08006205UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006206 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 +00006207 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006208 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006209 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006210 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006211 } else {
6212 if (size) *size = 0;
6213 return NULL;
6214 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006215}
Eric Salob7d54ac2022-12-29 11:59:42 -08006216UPB_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 +00006217 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 +00006218 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6219 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006220}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006221UPB_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 +00006222 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 +00006223 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6224 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006225 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006226 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006227 return NULL;
6228 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006229 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 -08006230 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006231 UPB_PRIVATE(_upb_Array_Set)
6232 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006233 return sub;
6234}
6235UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006236 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 +00006237 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006238}
6239UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006240 struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
6241 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006242 sub = (struct google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006243 if (sub) google_protobuf_DescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006244 }
6245 return sub;
6246}
Eric Salob7d54ac2022-12-29 11:59:42 -08006247UPB_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 +00006248 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 +00006249 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006250 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006251 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006252 return (google_protobuf_OneofDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006253 } else {
6254 if (size) *size = 0;
6255 return NULL;
6256 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006257}
Eric Salob7d54ac2022-12-29 11:59:42 -08006258UPB_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 +00006259 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 +00006260 return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6261 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006262}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006263UPB_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 +00006264 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 +00006265 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6266 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006267 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006268 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006269 return NULL;
6270 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006271 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 -08006272 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006273 UPB_PRIVATE(_upb_Array_Set)
6274 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006275 return sub;
6276}
Eric Salob7d54ac2022-12-29 11:59:42 -08006277UPB_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 +00006278 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 +00006279 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006280 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006281 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006282 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006283 } else {
6284 if (size) *size = 0;
6285 return NULL;
6286 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006287}
Eric Salob7d54ac2022-12-29 11:59:42 -08006288UPB_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 +00006289 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 +00006290 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6291 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006292}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006293UPB_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 +00006294 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 +00006295 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6296 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006297 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006298 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006299 return NULL;
6300 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006301 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 -08006302 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006303 UPB_PRIVATE(_upb_Array_Set)
6304 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006305 return sub;
6306}
Eric Salob7d54ac2022-12-29 11:59:42 -08006307UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006308 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 +00006309 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006310 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006311 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006312 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006313 } else {
6314 if (size) *size = 0;
6315 return NULL;
6316 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006317}
Eric Salob7d54ac2022-12-29 11:59:42 -08006318UPB_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 +00006319 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 +00006320 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6321 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006322}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006323UPB_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 +00006324 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 +00006325 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6326 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006327 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006328 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006329 return false;
6330 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006331 UPB_PRIVATE(_upb_Array_Set)
6332 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08006333 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006334}
6335
6336/* google.protobuf.DescriptorProto.ExtensionRange */
6337
Joshua Habermanf41049a2022-01-21 14:41:25 -08006338UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006339 return (google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ExtensionRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006340}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006341UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6342 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006343 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006344 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, NULL, 0, arena) !=
6345 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006346 return NULL;
6347 }
6348 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006349}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006350UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size,
6351 const upb_ExtensionRegistry* extreg,
6352 int options, upb_Arena* arena) {
6353 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
6354 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006355 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, extreg, options,
6356 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006357 return NULL;
6358 }
6359 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006360}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006361UPB_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 -07006362 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006363 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006364 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006365}
6366UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options,
6367 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006368 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006369 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006370 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006371}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006372UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006373 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 +00006374 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006375}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006376UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006377 int32_t default_val = (int32_t)0;
6378 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006379 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 +00006380 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6381 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006382 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006383}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006384UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006385 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 +00006386 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006387}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006388UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006389 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 +00006390 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006391}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006392UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006393 int32_t default_val = (int32_t)0;
6394 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006395 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 +00006396 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6397 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006398 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006399}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006400UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006401 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 +00006402 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006403}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006404UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006405 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 +00006406 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006407}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006408UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006409 const google_protobuf_ExtensionRangeOptions* default_val = NULL;
6410 const google_protobuf_ExtensionRangeOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006411 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 +00006412 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6413 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006414 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006415}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006416UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006417 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 +00006418 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006419}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006420
6421UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006422 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 +00006423 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006424}
6425UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006426 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 +00006427 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006428}
6429UPB_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 +00006430 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 +00006431 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006432}
6433UPB_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 -08006434 struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
6435 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006436 sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006437 if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006438 }
6439 return sub;
6440}
6441
6442/* google.protobuf.DescriptorProto.ReservedRange */
6443
Joshua Habermanf41049a2022-01-21 14:41:25 -08006444UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006445 return (google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006446}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006447UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6448 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006449 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006450 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ReservedRange_msg_init, NULL, 0, arena) !=
6451 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006452 return NULL;
6453 }
6454 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006455}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006456UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size,
6457 const upb_ExtensionRegistry* extreg,
6458 int options, upb_Arena* arena) {
6459 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
6460 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006461 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ReservedRange_msg_init, extreg, options,
6462 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006463 return NULL;
6464 }
6465 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006466}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006467UPB_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 -07006468 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006469 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006470 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006471}
6472UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options,
6473 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006474 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006475 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006476 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006477}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006478UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006479 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 +00006480 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006481}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006482UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006483 int32_t default_val = (int32_t)0;
6484 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006485 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 +00006486 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6487 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006488 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006489}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006490UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006491 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 +00006492 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006493}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006494UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006495 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 +00006496 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006497}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006498UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006499 int32_t default_val = (int32_t)0;
6500 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006501 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 +00006502 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6503 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006504 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006505}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006506UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006507 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 +00006508 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006509}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006510
6511UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006512 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 +00006513 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006514}
6515UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006516 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 +00006517 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006518}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006519
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006520/* google.protobuf.ExtensionRangeOptions */
6521
Joshua Habermanf41049a2022-01-21 14:41:25 -08006522UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006523 return (google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006524}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006525UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
6526 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006527 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006528 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions_msg_init, NULL, 0, arena) !=
6529 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006530 return NULL;
6531 }
6532 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006533}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006534UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size,
6535 const upb_ExtensionRegistry* extreg,
6536 int options, upb_Arena* arena) {
6537 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
6538 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006539 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions_msg_init, extreg, options,
6540 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006541 return NULL;
6542 }
6543 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006544}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006545UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006546 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006547 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006548 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006549}
6550UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options,
6551 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006552 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006553 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006554 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006555}
Mike Kruskal145900f2023-03-27 09:55:52 -07006556UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006557 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 +00006558 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006559}
6560UPB_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 +00006561 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 +00006562 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006563 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006564 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006565 return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)upb_Array_DataPtr(arr);
Mike Kruskal145900f2023-03-27 09:55:52 -07006566 } else {
6567 if (size) *size = 0;
6568 return NULL;
6569 }
6570}
Deanna Garciab26afb52023-04-25 13:37:18 -07006571UPB_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 +00006572 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 +00006573 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006574 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006575 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006576 }
6577 return arr;
6578}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006579UPB_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 +00006580 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 +00006581 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6582 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006583 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006584 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006585 }
6586 return arr;
6587}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006588UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006589 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 +00006590 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006591}
6592UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) {
6593 int32_t default_val = 1;
6594 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006595 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 +00006596 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6597 &default_val, &ret);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006598 return ret;
6599}
6600UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006601 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 +00006602 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006603}
6604UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006605 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 +00006606 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006607}
6608UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) {
6609 const google_protobuf_FeatureSet* default_val = NULL;
6610 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006611 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 +00006612 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6613 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006614 return ret;
6615}
6616UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006617 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 +00006618 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006619}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006620UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006621 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 +00006622 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006623}
Eric Salob7d54ac2022-12-29 11:59:42 -08006624UPB_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 +00006625 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 +00006626 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006627 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006628 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006629 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006630 } else {
6631 if (size) *size = 0;
6632 return NULL;
6633 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006634}
Deanna Garciab26afb52023-04-25 13:37:18 -07006635UPB_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 +00006636 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 +00006637 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006638 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006639 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006640 }
6641 return arr;
6642}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006643UPB_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 +00006644 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 +00006645 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6646 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006647 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006648 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006649 }
6650 return arr;
6651}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006652
Mike Kruskal145900f2023-03-27 09:55:52 -07006653UPB_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 +00006654 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 +00006655 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006656 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006657 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006658 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Array_MutableDataPtr(arr);
Mike Kruskal145900f2023-03-27 09:55:52 -07006659 } else {
6660 if (size) *size = 0;
6661 return NULL;
6662 }
6663}
6664UPB_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 +00006665 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 +00006666 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6667 &field, size, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006668}
6669UPB_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 +00006670 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 +00006671 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6672 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006673 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006674 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006675 return NULL;
6676 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006677 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 -07006678 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006679 UPB_PRIVATE(_upb_Array_Set)
6680 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskal145900f2023-03-27 09:55:52 -07006681 return sub;
6682}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006683UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006684 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 +00006685 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006686}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006687UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006688 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 +00006689 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006690}
6691UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
6692 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg);
6693 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006694 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006695 if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub);
6696 }
6697 return sub;
6698}
Eric Salob7d54ac2022-12-29 11:59:42 -08006699UPB_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 +00006700 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 +00006701 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006702 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006703 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006704 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006705 } else {
6706 if (size) *size = 0;
6707 return NULL;
6708 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006709}
Eric Salob7d54ac2022-12-29 11:59:42 -08006710UPB_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 +00006711 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 +00006712 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6713 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006714}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006715UPB_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 +00006716 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 +00006717 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6718 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006719 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006720 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006721 return NULL;
6722 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006723 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 -08006724 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006725 UPB_PRIVATE(_upb_Array_Set)
6726 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006727 return sub;
6728}
6729
Mike Kruskal145900f2023-03-27 09:55:52 -07006730/* google.protobuf.ExtensionRangeOptions.Declaration */
6731
6732UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006733 return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006734}
6735UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) {
6736 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6737 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006738 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, NULL, 0, arena) !=
6739 kUpb_DecodeStatus_Ok) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006740 return NULL;
6741 }
6742 return ret;
6743}
6744UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size,
6745 const upb_ExtensionRegistry* extreg,
6746 int options, upb_Arena* arena) {
6747 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6748 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006749 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, extreg, options,
6750 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006751 return NULL;
6752 }
6753 return ret;
6754}
6755UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) {
6756 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006757 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, 0, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006758 return ptr;
6759}
6760UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options,
6761 upb_Arena* arena, size_t* len) {
6762 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006763 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, options, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006764 return ptr;
6765}
6766UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006767 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 +00006768 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006769}
6770UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6771 int32_t default_val = (int32_t)0;
6772 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006773 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 +00006774 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6775 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006776 return ret;
6777}
6778UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006779 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 +00006780 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006781}
6782UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006783 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 +00006784 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006785}
6786UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6787 upb_StringView default_val = upb_StringView_FromString("");
6788 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006789 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 +00006790 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6791 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006792 return ret;
6793}
6794UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006795 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 +00006796 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006797}
6798UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006799 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 +00006800 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006801}
6802UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6803 upb_StringView default_val = upb_StringView_FromString("");
6804 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006805 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 +00006806 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6807 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006808 return ret;
6809}
6810UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006811 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 +00006812 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006813}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006814UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006815 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 +00006816 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006817}
6818UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6819 bool default_val = false;
6820 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006821 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 +00006822 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6823 &default_val, &ret);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006824 return ret;
6825}
6826UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006827 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 +00006828 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006829}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006830UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006831 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 +00006832 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006833}
6834UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6835 bool default_val = false;
6836 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006837 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 +00006838 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6839 &default_val, &ret);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006840 return ret;
6841}
6842UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006843 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 +00006844 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006845}
Mike Kruskal145900f2023-03-27 09:55:52 -07006846
6847UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006848 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 +00006849 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006850}
6851UPB_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 +00006852 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 +00006853 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006854}
6855UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006856 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 +00006857 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006858}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006859UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006860 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 +00006861 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006862}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006863UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006864 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 +00006865 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006866}
Mike Kruskal145900f2023-03-27 09:55:52 -07006867
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006868/* google.protobuf.FieldDescriptorProto */
6869
Joshua Habermanf41049a2022-01-21 14:41:25 -08006870UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006871 return (google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google__protobuf__FieldDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006872}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006873UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6874 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006875 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006876 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldDescriptorProto_msg_init, NULL, 0, arena) !=
6877 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006878 return NULL;
6879 }
6880 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006881}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006882UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size,
6883 const upb_ExtensionRegistry* extreg,
6884 int options, upb_Arena* arena) {
6885 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
6886 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006887 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldDescriptorProto_msg_init, extreg, options,
6888 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006889 return NULL;
6890 }
6891 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006892}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006893UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006894 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006895 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006896 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006897}
6898UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options,
6899 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006900 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006901 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006902 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006903}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006904UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006905 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 +00006906 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006907}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006908UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006909 upb_StringView default_val = upb_StringView_FromString("");
6910 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006911 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 +00006912 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6913 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006914 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006915}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006916UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006917 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 +00006918 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006919}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006920UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006921 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 +00006922 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006923}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006924UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006925 upb_StringView default_val = upb_StringView_FromString("");
6926 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006927 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 +00006928 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6929 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006930 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006931}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006932UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006933 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 +00006934 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006935}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006936UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006937 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 +00006938 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006939}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006940UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006941 int32_t default_val = (int32_t)0;
6942 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006943 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 +00006944 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6945 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006946 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006947}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006948UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006949 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 +00006950 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006951}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006952UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006953 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 +00006954 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006955}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006956UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006957 int32_t default_val = 1;
6958 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006959 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 +00006960 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6961 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006962 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006963}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006964UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006965 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 +00006966 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006967}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006968UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006969 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 +00006970 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006971}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006972UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006973 int32_t default_val = 1;
6974 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006975 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 +00006976 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6977 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006978 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006979}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006980UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006981 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 +00006982 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006983}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006984UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006985 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 +00006986 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006987}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006988UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006989 upb_StringView default_val = upb_StringView_FromString("");
6990 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006991 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 +00006992 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6993 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006994 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006995}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006996UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006997 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 +00006998 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006999}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007000UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007001 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 +00007002 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007003}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007004UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007005 upb_StringView default_val = upb_StringView_FromString("");
7006 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007007 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 +00007008 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7009 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007010 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007011}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007012UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007013 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 +00007014 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007015}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007016UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007017 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 +00007018 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007019}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007020UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007021 const google_protobuf_FieldOptions* default_val = NULL;
7022 const google_protobuf_FieldOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007023 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 +00007024 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7025 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007026 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007027}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007028UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007029 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 +00007030 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007031}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007032UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007033 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 +00007034 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007035}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007036UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007037 int32_t default_val = (int32_t)0;
7038 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007039 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 +00007040 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7041 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007042 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007043}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007044UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007045 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 +00007046 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007047}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007048UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007049 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 +00007050 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007051}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007052UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007053 upb_StringView default_val = upb_StringView_FromString("");
7054 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007055 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 +00007056 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7057 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007058 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007059}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007060UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007061 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 +00007062 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007063}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007064UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007065 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 +00007066 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007067}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007068UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007069 bool default_val = false;
7070 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007071 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 +00007072 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7073 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007074 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007075}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007076UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007077 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 +00007078 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007079}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007080
7081UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007082 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 +00007083 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007084}
7085UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007086 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 +00007087 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007088}
7089UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007090 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 +00007091 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007092}
7093UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007094 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 +00007095 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007096}
7097UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007098 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 +00007099 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007100}
7101UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007102 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 +00007103 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007104}
7105UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007106 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 +00007107 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007108}
7109UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007110 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 +00007111 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007112}
7113UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007114 struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
7115 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007116 sub = (struct google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007117 if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007118 }
7119 return sub;
7120}
7121UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007122 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 +00007123 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007124}
7125UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007126 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 +00007127 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007128}
7129UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007130 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 +00007131 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007132}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007133
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007134/* google.protobuf.OneofDescriptorProto */
7135
Joshua Habermanf41049a2022-01-21 14:41:25 -08007136UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007137 return (google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google__protobuf__OneofDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007138}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007139UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7140 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007141 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007142 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofDescriptorProto_msg_init, NULL, 0, arena) !=
7143 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007144 return NULL;
7145 }
7146 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007147}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007148UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size,
7149 const upb_ExtensionRegistry* extreg,
7150 int options, upb_Arena* arena) {
7151 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
7152 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007153 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofDescriptorProto_msg_init, extreg, options,
7154 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007155 return NULL;
7156 }
7157 return ret;
7158}
7159UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007160 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007161 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007162 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007163}
7164UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options,
7165 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007166 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007167 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007168 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007169}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007170UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007171 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 +00007172 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007173}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007174UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007175 upb_StringView default_val = upb_StringView_FromString("");
7176 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007177 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 +00007178 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7179 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007180 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007181}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007182UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007183 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 +00007184 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007185}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007186UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007187 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 +00007188 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007189}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007190UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007191 const google_protobuf_OneofOptions* default_val = NULL;
7192 const google_protobuf_OneofOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007193 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 +00007194 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7195 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007196 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007197}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007198UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007199 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 +00007200 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007201}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007202
Joshua Habermanf41049a2022-01-21 14:41:25 -08007203UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007204 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 +00007205 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007206}
7207UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007208 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 +00007209 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007210}
7211UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007212 struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
7213 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007214 sub = (struct google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007215 if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007216 }
7217 return sub;
7218}
7219
7220/* google.protobuf.EnumDescriptorProto */
7221
Joshua Habermanf41049a2022-01-21 14:41:25 -08007222UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007223 return (google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google__protobuf__EnumDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007224}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007225UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7226 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007227 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007228 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto_msg_init, NULL, 0, arena) !=
7229 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007230 return NULL;
7231 }
7232 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007233}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007234UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size,
7235 const upb_ExtensionRegistry* extreg,
7236 int options, upb_Arena* arena) {
7237 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
7238 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007239 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto_msg_init, extreg, options,
7240 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007241 return NULL;
7242 }
7243 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007244}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007245UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007246 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007247 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007248 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007249}
7250UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options,
7251 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007252 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007253 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007254 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007255}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007256UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007257 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 +00007258 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007259}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007260UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007261 upb_StringView default_val = upb_StringView_FromString("");
7262 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007263 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 +00007264 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7265 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007266 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007267}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007268UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007269 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 +00007270 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007271}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007272UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007273 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 +00007274 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007275}
Eric Salob7d54ac2022-12-29 11:59:42 -08007276UPB_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 +00007277 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 +00007278 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007279 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007280 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007281 return (const google_protobuf_EnumValueDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007282 } else {
7283 if (size) *size = 0;
7284 return NULL;
7285 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007286}
Deanna Garciab26afb52023-04-25 13:37:18 -07007287UPB_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 +00007288 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 +00007289 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007290 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007291 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007292 }
7293 return arr;
7294}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007295UPB_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 +00007296 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 +00007297 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7298 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007299 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007300 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007301 }
7302 return arr;
7303}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007304UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007305 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 +00007306 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007307}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007308UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007309 const google_protobuf_EnumOptions* default_val = NULL;
7310 const google_protobuf_EnumOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007311 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 +00007312 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7313 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007314 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007315}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007316UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007317 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 +00007318 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007319}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007320UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007321 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 +00007322 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007323}
Eric Salob7d54ac2022-12-29 11:59:42 -08007324UPB_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 +00007325 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 +00007326 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007327 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007328 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007329 return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007330 } else {
7331 if (size) *size = 0;
7332 return NULL;
7333 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007334}
Deanna Garciab26afb52023-04-25 13:37:18 -07007335UPB_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 +00007336 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 +00007337 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007338 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007339 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007340 }
7341 return arr;
7342}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007343UPB_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 +00007344 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 +00007345 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7346 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007347 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007348 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007349 }
7350 return arr;
7351}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007352UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007353 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 +00007354 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007355}
Eric Salob7d54ac2022-12-29 11:59:42 -08007356UPB_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 +00007357 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 +00007358 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007359 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007360 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007361 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007362 } else {
7363 if (size) *size = 0;
7364 return NULL;
7365 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007366}
Deanna Garciab26afb52023-04-25 13:37:18 -07007367UPB_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 +00007368 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 +00007369 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007370 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007371 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007372 }
7373 return arr;
7374}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007375UPB_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 +00007376 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 +00007377 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7378 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007379 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007380 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007381 }
7382 return arr;
7383}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007384
Joshua Habermanf41049a2022-01-21 14:41:25 -08007385UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007386 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 +00007387 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007388}
7389UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007390 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 +00007391 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007392 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007393 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007394 return (google_protobuf_EnumValueDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007395 } else {
7396 if (size) *size = 0;
7397 return NULL;
7398 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007399}
Eric Salob7d54ac2022-12-29 11:59:42 -08007400UPB_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 +00007401 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 +00007402 return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7403 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007404}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007405UPB_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 +00007406 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 +00007407 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7408 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007409 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007410 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007411 return NULL;
7412 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007413 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 -08007414 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007415 UPB_PRIVATE(_upb_Array_Set)
7416 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007417 return sub;
7418}
7419UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007420 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 +00007421 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007422}
7423UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007424 struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
7425 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007426 sub = (struct google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007427 if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007428 }
7429 return sub;
7430}
Eric Salob7d54ac2022-12-29 11:59:42 -08007431UPB_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 +00007432 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 +00007433 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007434 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007435 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007436 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007437 } else {
7438 if (size) *size = 0;
7439 return NULL;
7440 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007441}
Eric Salob7d54ac2022-12-29 11:59:42 -08007442UPB_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 +00007443 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 +00007444 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7445 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007446}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007447UPB_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 +00007448 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 +00007449 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7450 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007451 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007452 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007453 return NULL;
7454 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007455 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 -08007456 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007457 UPB_PRIVATE(_upb_Array_Set)
7458 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007459 return sub;
7460}
Eric Salob7d54ac2022-12-29 11:59:42 -08007461UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007462 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 +00007463 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007464 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007465 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007466 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007467 } else {
7468 if (size) *size = 0;
7469 return NULL;
7470 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007471}
Eric Salob7d54ac2022-12-29 11:59:42 -08007472UPB_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 +00007473 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 +00007474 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7475 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007476}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007477UPB_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 +00007478 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 +00007479 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7480 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007481 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007482 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007483 return false;
7484 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007485 UPB_PRIVATE(_upb_Array_Set)
7486 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08007487 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007488}
7489
7490/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
7491
Joshua Habermanf41049a2022-01-21 14:41:25 -08007492UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007493 return (google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007494}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007495UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
7496 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007497 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007498 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, NULL, 0, arena) !=
7499 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007500 return NULL;
7501 }
7502 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007503}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007504UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size,
7505 const upb_ExtensionRegistry* extreg,
7506 int options, upb_Arena* arena) {
7507 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
7508 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007509 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, extreg, options,
7510 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007511 return NULL;
7512 }
7513 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007514}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007515UPB_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 -07007516 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007517 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007518 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007519}
7520UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options,
7521 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007522 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007523 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007524 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007525}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007526UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007527 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 +00007528 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007529}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007530UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007531 int32_t default_val = (int32_t)0;
7532 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007533 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 +00007534 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7535 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007536 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007537}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007538UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007539 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 +00007540 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007541}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007542UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007543 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 +00007544 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007545}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007546UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007547 int32_t default_val = (int32_t)0;
7548 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007549 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 +00007550 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7551 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007552 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007553}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007554UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007555 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 +00007556 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007557}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007558
7559UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007560 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 +00007561 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007562}
7563UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007564 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 +00007565 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007566}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007567
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007568/* google.protobuf.EnumValueDescriptorProto */
7569
Joshua Habermanf41049a2022-01-21 14:41:25 -08007570UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007571 return (google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google__protobuf__EnumValueDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007572}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007573UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7574 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007575 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007576 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueDescriptorProto_msg_init, NULL, 0, arena) !=
7577 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007578 return NULL;
7579 }
7580 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007581}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007582UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size,
7583 const upb_ExtensionRegistry* extreg,
7584 int options, upb_Arena* arena) {
7585 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
7586 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007587 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueDescriptorProto_msg_init, extreg, options,
7588 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007589 return NULL;
7590 }
7591 return ret;
7592}
7593UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007594 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007595 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007596 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007597}
7598UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options,
7599 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007600 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007601 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007602 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007603}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007604UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007605 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 +00007606 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007607}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007608UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007609 upb_StringView default_val = upb_StringView_FromString("");
7610 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007611 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 +00007612 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7613 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007614 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007615}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007616UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007617 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 +00007618 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007619}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007620UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007621 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 +00007622 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007623}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007624UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007625 int32_t default_val = (int32_t)0;
7626 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007627 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 +00007628 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7629 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007630 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007631}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007632UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007633 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 +00007634 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007635}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007636UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007637 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 +00007638 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007639}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007640UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007641 const google_protobuf_EnumValueOptions* default_val = NULL;
7642 const google_protobuf_EnumValueOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007643 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 +00007644 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7645 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007646 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007647}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007648UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007649 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 +00007650 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007651}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007652
Joshua Habermanf41049a2022-01-21 14:41:25 -08007653UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007654 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 +00007655 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007656}
7657UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007658 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 +00007659 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007660}
7661UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007662 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 +00007663 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007664}
7665UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007666 struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
7667 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007668 sub = (struct google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007669 if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007670 }
7671 return sub;
7672}
7673
7674/* google.protobuf.ServiceDescriptorProto */
7675
Joshua Habermanf41049a2022-01-21 14:41:25 -08007676UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007677 return (google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google__protobuf__ServiceDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007678}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007679UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7680 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007681 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007682 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceDescriptorProto_msg_init, NULL, 0, arena) !=
7683 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007684 return NULL;
7685 }
7686 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007687}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007688UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size,
7689 const upb_ExtensionRegistry* extreg,
7690 int options, upb_Arena* arena) {
7691 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
7692 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007693 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceDescriptorProto_msg_init, extreg, options,
7694 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007695 return NULL;
7696 }
7697 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007698}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007699UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007700 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007701 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007702 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007703}
7704UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options,
7705 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007706 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007707 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007708 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007709}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007710UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007711 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 +00007712 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007713}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007714UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007715 upb_StringView default_val = upb_StringView_FromString("");
7716 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007717 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 +00007718 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7719 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007720 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007721}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007722UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007723 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 +00007724 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007725}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007726UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007727 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 +00007728 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007729}
Eric Salob7d54ac2022-12-29 11:59:42 -08007730UPB_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 +00007731 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 +00007732 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007733 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007734 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007735 return (const google_protobuf_MethodDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007736 } else {
7737 if (size) *size = 0;
7738 return NULL;
7739 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007740}
Deanna Garciab26afb52023-04-25 13:37:18 -07007741UPB_INLINE const upb_Array* _google_protobuf_ServiceDescriptorProto_method_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007742 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 +00007743 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007744 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007745 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007746 }
7747 return arr;
7748}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007749UPB_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 +00007750 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 +00007751 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7752 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007753 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007754 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007755 }
7756 return arr;
7757}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007758UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007759 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 +00007760 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007761}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007762UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007763 const google_protobuf_ServiceOptions* default_val = NULL;
7764 const google_protobuf_ServiceOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007765 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 +00007766 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7767 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007768 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007769}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007770UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007771 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 +00007772 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007773}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007774
Joshua Habermanf41049a2022-01-21 14:41:25 -08007775UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007776 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 +00007777 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007778}
7779UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007780 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 +00007781 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007782 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007783 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007784 return (google_protobuf_MethodDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007785 } else {
7786 if (size) *size = 0;
7787 return NULL;
7788 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007789}
Eric Salob7d54ac2022-12-29 11:59:42 -08007790UPB_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 +00007791 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 +00007792 return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7793 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007794}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007795UPB_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 +00007796 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 +00007797 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7798 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007799 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007800 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007801 return NULL;
7802 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007803 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 -08007804 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007805 UPB_PRIVATE(_upb_Array_Set)
7806 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007807 return sub;
7808}
7809UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007810 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 +00007811 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007812}
7813UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007814 struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
7815 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007816 sub = (struct google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007817 if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007818 }
7819 return sub;
7820}
7821
7822/* google.protobuf.MethodDescriptorProto */
7823
Joshua Habermanf41049a2022-01-21 14:41:25 -08007824UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007825 return (google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google__protobuf__MethodDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007826}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007827UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7828 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007829 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007830 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodDescriptorProto_msg_init, NULL, 0, arena) !=
7831 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007832 return NULL;
7833 }
7834 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007835}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007836UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size,
7837 const upb_ExtensionRegistry* extreg,
7838 int options, upb_Arena* arena) {
7839 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
7840 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007841 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodDescriptorProto_msg_init, extreg, options,
7842 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007843 return NULL;
7844 }
7845 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007846}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007847UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007848 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007849 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007850 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007851}
7852UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options,
7853 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007854 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007855 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007856 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007857}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007858UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007859 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 +00007860 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007861}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007862UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007863 upb_StringView default_val = upb_StringView_FromString("");
7864 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007865 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 +00007866 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7867 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007868 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007869}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007870UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007871 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 +00007872 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007873}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007874UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007875 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 +00007876 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007877}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007878UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007879 upb_StringView default_val = upb_StringView_FromString("");
7880 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007881 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 +00007882 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7883 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007884 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007885}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007886UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007887 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 +00007888 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007889}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007890UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007891 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 +00007892 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007893}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007894UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007895 upb_StringView default_val = upb_StringView_FromString("");
7896 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007897 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 +00007898 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7899 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007900 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007901}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007902UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007903 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 +00007904 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007905}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007906UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007907 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 +00007908 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007909}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007910UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007911 const google_protobuf_MethodOptions* default_val = NULL;
7912 const google_protobuf_MethodOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007913 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 +00007914 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7915 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007916 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007917}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007918UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007919 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 +00007920 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007921}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007922UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007923 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 +00007924 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007925}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007926UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007927 bool default_val = false;
7928 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007929 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 +00007930 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7931 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007932 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007933}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007934UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007935 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 +00007936 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007937}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007938UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007939 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 +00007940 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007941}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007942UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007943 bool default_val = false;
7944 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007945 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 +00007946 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7947 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007948 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007949}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007950UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007951 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 +00007952 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007953}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007954
Joshua Habermanf41049a2022-01-21 14:41:25 -08007955UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007956 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 +00007957 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007958}
7959UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007960 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 +00007961 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007962}
7963UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007964 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 +00007965 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007966}
7967UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007968 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 +00007969 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007970}
7971UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007972 struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
7973 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007974 sub = (struct google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007975 if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007976 }
7977 return sub;
7978}
7979UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007980 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 +00007981 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007982}
7983UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007984 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 +00007985 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007986}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007987
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007988/* google.protobuf.FileOptions */
7989
Joshua Habermanf41049a2022-01-21 14:41:25 -08007990UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007991 return (google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007992}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007993UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7994 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007995 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007996 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileOptions_msg_init, NULL, 0, arena) !=
7997 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007998 return NULL;
7999 }
8000 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008001}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008002UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size,
8003 const upb_ExtensionRegistry* extreg,
8004 int options, upb_Arena* arena) {
8005 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
8006 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008007 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileOptions_msg_init, extreg, options,
8008 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08008009 return NULL;
8010 }
8011 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008012}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008013UPB_INLINE char* google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008014 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008015 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008016 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008017}
8018UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options,
8019 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008020 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008021 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008022 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008023}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008024UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008025 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 +00008026 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008027}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008028UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008029 upb_StringView default_val = upb_StringView_FromString("");
8030 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008031 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 +00008032 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8033 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008034 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008035}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008036UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008037 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 +00008038 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008039}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008040UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008041 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 +00008042 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008043}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008044UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008045 upb_StringView default_val = upb_StringView_FromString("");
8046 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008047 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 +00008048 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8049 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008050 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008051}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008052UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008053 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 +00008054 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008055}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008056UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008057 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 +00008058 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008059}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008060UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008061 int32_t default_val = 1;
8062 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008063 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 +00008064 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8065 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008066 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008067}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008068UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008069 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 +00008070 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008071}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008072UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008073 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 +00008074 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008075}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008076UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008077 bool default_val = false;
8078 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008079 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 +00008080 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8081 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008082 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008083}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008084UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008085 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 +00008086 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008087}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008088UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008089 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 +00008090 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008091}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008092UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008093 upb_StringView default_val = upb_StringView_FromString("");
8094 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008095 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 +00008096 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8097 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008098 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008099}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008100UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008101 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 +00008102 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008103}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008104UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008105 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 +00008106 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008107}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008108UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008109 bool default_val = false;
8110 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008111 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 +00008112 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8113 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008114 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008115}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008116UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008117 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 +00008118 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008119}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008120UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008121 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 +00008122 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008123}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008124UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008125 bool default_val = false;
8126 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008127 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 +00008128 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8129 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008130 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008131}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008132UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008133 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 +00008134 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008135}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008136UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008137 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 +00008138 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008139}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008140UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008141 bool default_val = false;
8142 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008143 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 +00008144 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8145 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008146 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008147}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008148UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008149 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 +00008150 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008151}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008152UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008153 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 +00008154 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008155}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008156UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008157 bool default_val = false;
8158 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008159 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 +00008160 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8161 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008162 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008163}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008164UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008165 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 +00008166 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008167}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008168UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008169 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 +00008170 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008171}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008172UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008173 bool default_val = false;
8174 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008175 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 +00008176 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8177 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008178 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008179}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008180UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008181 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 +00008182 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008183}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008184UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008185 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 +00008186 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008187}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008188UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008189 bool default_val = false;
8190 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008191 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 +00008192 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8193 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008194 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008195}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008196UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008197 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 +00008198 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008199}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008200UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008201 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 +00008202 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008203}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008204UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008205 bool default_val = true;
8206 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008207 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 +00008208 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8209 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008210 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008211}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008212UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008213 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 +00008214 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008215}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008216UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008217 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 +00008218 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008219}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008220UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008221 upb_StringView default_val = upb_StringView_FromString("");
8222 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008223 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 +00008224 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8225 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008226 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008227}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008228UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008229 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 +00008230 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008231}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008232UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008233 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 +00008234 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008235}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008236UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008237 upb_StringView default_val = upb_StringView_FromString("");
8238 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008239 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 +00008240 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8241 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008242 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008243}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008244UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008245 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 +00008246 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008247}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008248UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008249 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 +00008250 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008251}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008252UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008253 upb_StringView default_val = upb_StringView_FromString("");
8254 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008255 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 +00008256 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8257 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008258 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008259}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008260UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008261 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 +00008262 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008263}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008264UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008265 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 +00008266 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008267}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008268UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008269 upb_StringView default_val = upb_StringView_FromString("");
8270 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008271 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 +00008272 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8273 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008274 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008275}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008276UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008277 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 +00008278 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008279}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008280UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008281 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 +00008282 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008283}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008284UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008285 upb_StringView default_val = upb_StringView_FromString("");
8286 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008287 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 +00008288 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8289 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008290 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008291}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008292UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008293 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 +00008294 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008295}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008296UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008297 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 +00008298 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008299}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008300UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008301 upb_StringView default_val = upb_StringView_FromString("");
8302 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008303 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 +00008304 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8305 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008306 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008307}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008308UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008309 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 +00008310 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008311}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008312UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008313 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 +00008314 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008315}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008316UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008317 upb_StringView default_val = upb_StringView_FromString("");
8318 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008319 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 +00008320 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8321 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008322 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008323}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008324UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008325 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 +00008326 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008327}
8328UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008329 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 +00008330 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008331}
8332UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) {
8333 const google_protobuf_FeatureSet* default_val = NULL;
8334 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008335 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 +00008336 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8337 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008338 return ret;
8339}
8340UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008341 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 +00008342 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008343}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008344UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008345 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 +00008346 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008347}
Eric Salob7d54ac2022-12-29 11:59:42 -08008348UPB_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 +00008349 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 +00008350 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008351 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008352 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008353 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008354 } else {
8355 if (size) *size = 0;
8356 return NULL;
8357 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008358}
Deanna Garciab26afb52023-04-25 13:37:18 -07008359UPB_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 +00008360 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 +00008361 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008362 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008363 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008364 }
8365 return arr;
8366}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008367UPB_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 +00008368 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 +00008369 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8370 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008371 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008372 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008373 }
8374 return arr;
8375}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008376
Joshua Habermanf41049a2022-01-21 14:41:25 -08008377UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008378 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 +00008379 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008380}
8381UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008382 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 +00008383 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008384}
8385UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008386 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 +00008387 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008388}
8389UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008390 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 +00008391 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008392}
8393UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008394 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 +00008395 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008396}
8397UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008398 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 +00008399 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008400}
8401UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008402 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 +00008403 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008404}
8405UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008406 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 +00008407 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008408}
8409UPB_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 +00008410 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 +00008411 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008412}
8413UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008414 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 +00008415 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008416}
8417UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008418 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 +00008419 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008420}
8421UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008422 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 +00008423 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008424}
8425UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008426 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 +00008427 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008428}
8429UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008430 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 +00008431 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008432}
8433UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008434 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 +00008435 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008436}
8437UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008438 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 +00008439 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008440}
8441UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008442 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 +00008443 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008444}
8445UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008446 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 +00008447 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008448}
8449UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008450 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 +00008451 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008452}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008453UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008454 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 +00008455 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008456}
8457UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) {
8458 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg);
8459 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008460 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008461 if (sub) google_protobuf_FileOptions_set_features(msg, sub);
8462 }
8463 return sub;
8464}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008465UPB_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 +00008466 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 +00008467 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008468 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008469 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008470 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008471 } else {
8472 if (size) *size = 0;
8473 return NULL;
8474 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008475}
Eric Salob7d54ac2022-12-29 11:59:42 -08008476UPB_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 +00008477 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 +00008478 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
8479 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008480}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008481UPB_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 +00008482 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 +00008483 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8484 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008485 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008486 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08008487 return NULL;
8488 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008489 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 -08008490 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008491 UPB_PRIVATE(_upb_Array_Set)
8492 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008493 return sub;
8494}
8495
8496/* google.protobuf.MessageOptions */
8497
Joshua Habermanf41049a2022-01-21 14:41:25 -08008498UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008499 return (google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008500}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008501UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8502 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008503 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008504 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MessageOptions_msg_init, NULL, 0, arena) !=
8505 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008506 return NULL;
8507 }
8508 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008509}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008510UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size,
8511 const upb_ExtensionRegistry* extreg,
8512 int options, upb_Arena* arena) {
8513 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
8514 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008515 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MessageOptions_msg_init, extreg, options,
8516 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08008517 return NULL;
8518 }
8519 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008520}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008521UPB_INLINE char* google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008522 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008523 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MessageOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008524 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008525}
8526UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options,
8527 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008528 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008529 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MessageOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008530 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008531}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008532UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008533 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 +00008534 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008535}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008536UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008537 bool default_val = false;
8538 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008539 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 +00008540 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8541 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008542 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008543}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008544UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008545 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 +00008546 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008547}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008548UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008549 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 +00008550 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008551}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008552UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008553 bool default_val = false;
8554 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008555 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 +00008556 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8557 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008558 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008559}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008560UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008561 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 +00008562 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008563}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008564UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008565 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 +00008566 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008567}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008568UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008569 bool default_val = false;
8570 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008571 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 +00008572 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8573 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008574 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008575}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008576UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008577 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 +00008578 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008579}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008580UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008581 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 +00008582 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008583}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008584UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008585 bool default_val = false;
8586 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008587 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 +00008588 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8589 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008590 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008591}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008592UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008593 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 +00008594 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008595}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008596UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008597 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 +00008598 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008599}
8600UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
8601 bool default_val = false;
8602 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008603 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 +00008604 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8605 &default_val, &ret);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008606 return ret;
8607}
8608UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008609 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 +00008610 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008611}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008612UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008613 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 +00008614 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008615}
8616UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) {
8617 const google_protobuf_FeatureSet* default_val = NULL;
8618 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008619 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 +00008620 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8621 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008622 return ret;
8623}
8624UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008625 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 +00008626 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008627}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008628UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008629 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 +00008630 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008631}
Eric Salob7d54ac2022-12-29 11:59:42 -08008632UPB_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 +00008633 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 +00008634 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008635 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008636 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008637 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008638 } else {
8639 if (size) *size = 0;
8640 return NULL;
8641 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008642}
Deanna Garciab26afb52023-04-25 13:37:18 -07008643UPB_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 +00008644 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 +00008645 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008646 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008647 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008648 }
8649 return arr;
8650}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008651UPB_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 +00008652 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 +00008653 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8654 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008655 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008656 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008657 }
8658 return arr;
8659}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008660
8661UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008662 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 +00008663 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008664}
8665UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008666 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 +00008667 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008668}
8669UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008670 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 +00008671 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008672}
8673UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008674 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 +00008675 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008676}
8677UPB_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 +00008678 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 +00008679 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008680}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008681UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008682 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 +00008683 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008684}
8685UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
8686 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg);
8687 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008688 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008689 if (sub) google_protobuf_MessageOptions_set_features(msg, sub);
8690 }
8691 return sub;
8692}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008693UPB_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 +00008694 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 +00008695 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008696 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008697 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008698 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008699 } else {
8700 if (size) *size = 0;
8701 return NULL;
8702 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008703}
Eric Salob7d54ac2022-12-29 11:59:42 -08008704UPB_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 +00008705 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 +00008706 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
8707 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008708}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008709UPB_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 +00008710 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 +00008711 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8712 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008713 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008714 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08008715 return NULL;
8716 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008717 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 -08008718 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008719 UPB_PRIVATE(_upb_Array_Set)
8720 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008721 return sub;
8722}
8723
8724/* google.protobuf.FieldOptions */
8725
Joshua Habermanf41049a2022-01-21 14:41:25 -08008726UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008727 return (google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008728}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008729UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8730 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008731 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008732 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions_msg_init, NULL, 0, arena) !=
8733 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008734 return NULL;
8735 }
8736 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008737}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008738UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size,
8739 const upb_ExtensionRegistry* extreg,
8740 int options, upb_Arena* arena) {
8741 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
8742 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008743 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions_msg_init, extreg, options,
8744 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08008745 return NULL;
8746 }
8747 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008748}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008749UPB_INLINE char* google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008750 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008751 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008752 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008753}
8754UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options,
8755 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008756 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008757 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008758 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008759}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008760UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008761 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 +00008762 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008763}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008764UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008765 int32_t default_val = 0;
8766 int32_t ret;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008767 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 +00008768 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8769 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008770 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008771}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008772UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008773 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 +00008774 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008775}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008776UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008777 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 +00008778 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008779}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008780UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008781 bool default_val = false;
8782 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008783 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 +00008784 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8785 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008786 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008787}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008788UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008789 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 +00008790 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008791}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008792UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008793 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 +00008794 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008795}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008796UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008797 bool default_val = false;
8798 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008799 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 +00008800 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8801 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008802 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008803}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008804UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008805 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 +00008806 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008807}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008808UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008809 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 +00008810 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008811}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008812UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008813 bool default_val = false;
8814 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008815 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 +00008816 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8817 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008818 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008819}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008820UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008821 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 +00008822 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008823}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008824UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008825 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 +00008826 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008827}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008828UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008829 int32_t default_val = 0;
8830 int32_t ret;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008831 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 +00008832 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8833 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008834 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008835}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008836UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008837 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 +00008838 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008839}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008840UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008841 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 +00008842 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008843}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008844UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008845 bool default_val = false;
8846 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008847 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 +00008848 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8849 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008850 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008851}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008852UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008853 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 +00008854 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008855}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008856UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008857 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 +00008858 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008859}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008860UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008861 bool default_val = false;
8862 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008863 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 +00008864 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8865 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008866 return ret;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008867}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008868UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008869 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 +00008870 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008871}
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008872UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008873 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 +00008874 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008875}
8876UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) {
8877 bool default_val = false;
8878 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008879 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 +00008880 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8881 &default_val, &ret);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008882 return ret;
8883}
8884UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008885 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 +00008886 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008887}
Adam Cozzette5a568372023-01-24 20:35:59 -08008888UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008889 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 +00008890 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008891}
8892UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) {
8893 int32_t default_val = 0;
8894 int32_t ret;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008895 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 +00008896 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8897 &default_val, &ret);
Adam Cozzette5a568372023-01-24 20:35:59 -08008898 return ret;
8899}
8900UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008901 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 +00008902 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008903}
Mike Kruskal0c121392023-03-18 00:05:41 -07008904UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008905 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 +00008906 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008907}
Mike Kruskal0c121392023-03-18 00:05:41 -07008908UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008909 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 +00008910 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal0c121392023-03-18 00:05:41 -07008911 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008912 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008913 return (int32_t const*)upb_Array_DataPtr(arr);
Mike Kruskal0c121392023-03-18 00:05:41 -07008914 } else {
8915 if (size) *size = 0;
8916 return NULL;
8917 }
Adam Cozzette5a568372023-01-24 20:35:59 -08008918}
Deanna Garciab26afb52023-04-25 13:37:18 -07008919UPB_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 +00008920 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 +00008921 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008922 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008923 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008924 }
8925 return arr;
8926}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008927UPB_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 +00008928 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 +00008929 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8930 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008931 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008932 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008933 }
8934 return arr;
8935}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008936UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008937 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 +00008938 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008939}
8940UPB_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 +00008941 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 +00008942 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008943 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008944 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008945 return (const google_protobuf_FieldOptions_EditionDefault* const*)upb_Array_DataPtr(arr);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008946 } else {
8947 if (size) *size = 0;
8948 return NULL;
8949 }
8950}
8951UPB_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 +00008952 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 +00008953 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008954 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008955 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008956 }
8957 return arr;
8958}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008959UPB_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 +00008960 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 +00008961 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8962 &field, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008963 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008964 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008965 }
8966 return arr;
8967}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008968UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008969 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 +00008970 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008971}
8972UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) {
8973 const google_protobuf_FeatureSet* default_val = NULL;
8974 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008975 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 +00008976 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8977 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008978 return ret;
8979}
8980UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008981 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 +00008982 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008983}
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00008984UPB_INLINE void google_protobuf_FieldOptions_clear_feature_support(google_protobuf_FieldOptions* msg) {
8985 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)};
8986 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
8987}
8988UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_feature_support(const google_protobuf_FieldOptions* msg) {
8989 const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL;
8990 const google_protobuf_FieldOptions_FeatureSupport* ret;
8991 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)};
8992 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8993 &default_val, &ret);
8994 return ret;
8995}
8996UPB_INLINE bool google_protobuf_FieldOptions_has_feature_support(const google_protobuf_FieldOptions* msg) {
8997 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)};
8998 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
8999}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009000UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009001 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 +00009002 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009003}
Eric Salob7d54ac2022-12-29 11:59:42 -08009004UPB_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 +00009005 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 +00009006 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009007 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009008 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009009 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009010 } else {
9011 if (size) *size = 0;
9012 return NULL;
9013 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009014}
Deanna Garciab26afb52023-04-25 13:37:18 -07009015UPB_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 +00009016 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 +00009017 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009018 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009019 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009020 }
9021 return arr;
9022}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009023UPB_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 +00009024 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 +00009025 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9026 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009027 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009028 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009029 }
9030 return arr;
9031}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009032
9033UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009034 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 +00009035 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009036}
9037UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009038 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 +00009039 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009040}
9041UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009042 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 +00009043 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009044}
9045UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009046 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 +00009047 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009048}
9049UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009050 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 +00009051 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009052}
9053UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009054 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 +00009055 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009056}
9057UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009058 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 +00009059 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009060}
9061UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009062 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 +00009063 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009064}
Adam Cozzette5a568372023-01-24 20:35:59 -08009065UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009066 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 +00009067 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Adam Cozzette5a568372023-01-24 20:35:59 -08009068}
Mike Kruskal0c121392023-03-18 00:05:41 -07009069UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009070 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 +00009071 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal0c121392023-03-18 00:05:41 -07009072 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009073 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009074 return (int32_t*)upb_Array_MutableDataPtr(arr);
Mike Kruskal0c121392023-03-18 00:05:41 -07009075 } else {
9076 if (size) *size = 0;
9077 return NULL;
9078 }
9079}
9080UPB_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 +00009081 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 +00009082 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9083 &field, size, arena);
Mike Kruskal0c121392023-03-18 00:05:41 -07009084}
9085UPB_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 +00009086 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 +00009087 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9088 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009089 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009090 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal0c121392023-03-18 00:05:41 -07009091 return false;
9092 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009093 UPB_PRIVATE(_upb_Array_Set)
9094 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Mike Kruskal0c121392023-03-18 00:05:41 -07009095 return true;
Adam Cozzette5a568372023-01-24 20:35:59 -08009096}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009097UPB_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 +00009098 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 +00009099 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009100 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009101 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009102 return (google_protobuf_FieldOptions_EditionDefault**)upb_Array_MutableDataPtr(arr);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009103 } else {
9104 if (size) *size = 0;
9105 return NULL;
9106 }
9107}
9108UPB_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 +00009109 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 +00009110 return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9111 &field, size, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009112}
9113UPB_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 +00009114 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 +00009115 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9116 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009117 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009118 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009119 return NULL;
9120 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009121 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 -07009122 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009123 UPB_PRIVATE(_upb_Array_Set)
9124 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009125 return sub;
9126}
9127UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009128 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 +00009129 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009130}
9131UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
9132 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg);
9133 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009134 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009135 if (sub) google_protobuf_FieldOptions_set_features(msg, sub);
9136 }
9137 return sub;
9138}
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009139UPB_INLINE void google_protobuf_FieldOptions_set_feature_support(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) {
9140 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)};
9141 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9142}
9143UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_mutable_feature_support(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
9144 struct google_protobuf_FieldOptions_FeatureSupport* sub = (struct google_protobuf_FieldOptions_FeatureSupport*)google_protobuf_FieldOptions_feature_support(msg);
9145 if (sub == NULL) {
9146 sub = (struct google_protobuf_FieldOptions_FeatureSupport*)_upb_Message_New(&google__protobuf__FieldOptions__FeatureSupport_msg_init, arena);
9147 if (sub) google_protobuf_FieldOptions_set_feature_support(msg, sub);
9148 }
9149 return sub;
9150}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009151UPB_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 +00009152 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 +00009153 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009154 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009155 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009156 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009157 } else {
9158 if (size) *size = 0;
9159 return NULL;
9160 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009161}
Eric Salob7d54ac2022-12-29 11:59:42 -08009162UPB_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 +00009163 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 +00009164 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9165 &field, size, arena);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009166}
9167UPB_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 +00009168 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 +00009169 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9170 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009171 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009172 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009173 return NULL;
9174 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009175 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 -08009176 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009177 UPB_PRIVATE(_upb_Array_Set)
9178 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009179 return sub;
9180}
9181
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009182/* google.protobuf.FieldOptions.EditionDefault */
9183
9184UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009185 return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009186}
9187UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
9188 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
9189 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009190 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__EditionDefault_msg_init, NULL, 0, arena) !=
9191 kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009192 return NULL;
9193 }
9194 return ret;
9195}
9196UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size,
9197 const upb_ExtensionRegistry* extreg,
9198 int options, upb_Arena* arena) {
9199 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
9200 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009201 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__EditionDefault_msg_init, extreg, options,
9202 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009203 return NULL;
9204 }
9205 return ret;
9206}
9207UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) {
9208 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009209 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__EditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009210 return ptr;
9211}
9212UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options,
9213 upb_Arena* arena, size_t* len) {
9214 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009215 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__EditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009216 return ptr;
9217}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009218UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009219 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 +00009220 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009221}
9222UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
9223 upb_StringView default_val = upb_StringView_FromString("");
9224 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009225 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 +00009226 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9227 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009228 return ret;
9229}
9230UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009231 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 +00009232 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009233}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009234UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009235 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 +00009236 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009237}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009238UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009239 int32_t default_val = 0;
9240 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009241 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 +00009242 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9243 &default_val, &ret);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009244 return ret;
9245}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009246UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009247 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 +00009248 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009249}
9250
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009251UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009252 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 +00009253 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009254}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009255UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009256 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 +00009257 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009258}
9259
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +00009260/* google.protobuf.FieldOptions.FeatureSupport */
9261
9262UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_new(upb_Arena* arena) {
9263 return (google_protobuf_FieldOptions_FeatureSupport*)_upb_Message_New(&google__protobuf__FieldOptions__FeatureSupport_msg_init, arena);
9264}
9265UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_parse(const char* buf, size_t size, upb_Arena* arena) {
9266 google_protobuf_FieldOptions_FeatureSupport* ret = google_protobuf_FieldOptions_FeatureSupport_new(arena);
9267 if (!ret) return NULL;
9268 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__FeatureSupport_msg_init, NULL, 0, arena) !=
9269 kUpb_DecodeStatus_Ok) {
9270 return NULL;
9271 }
9272 return ret;
9273}
9274UPB_INLINE google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_FeatureSupport_parse_ex(const char* buf, size_t size,
9275 const upb_ExtensionRegistry* extreg,
9276 int options, upb_Arena* arena) {
9277 google_protobuf_FieldOptions_FeatureSupport* ret = google_protobuf_FieldOptions_FeatureSupport_new(arena);
9278 if (!ret) return NULL;
9279 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__FeatureSupport_msg_init, extreg, options,
9280 arena) != kUpb_DecodeStatus_Ok) {
9281 return NULL;
9282 }
9283 return ret;
9284}
9285UPB_INLINE char* google_protobuf_FieldOptions_FeatureSupport_serialize(const google_protobuf_FieldOptions_FeatureSupport* msg, upb_Arena* arena, size_t* len) {
9286 char* ptr;
9287 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__FeatureSupport_msg_init, 0, arena, &ptr, len);
9288 return ptr;
9289}
9290UPB_INLINE char* google_protobuf_FieldOptions_FeatureSupport_serialize_ex(const google_protobuf_FieldOptions_FeatureSupport* msg, int options,
9291 upb_Arena* arena, size_t* len) {
9292 char* ptr;
9293 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__FeatureSupport_msg_init, options, arena, &ptr, len);
9294 return ptr;
9295}
9296UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_introduced(google_protobuf_FieldOptions_FeatureSupport* msg) {
9297 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9298 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9299}
9300UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_introduced(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9301 int32_t default_val = 0;
9302 int32_t ret;
9303 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9304 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9305 &default_val, &ret);
9306 return ret;
9307}
9308UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_introduced(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9309 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9310 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9311}
9312UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_deprecated(google_protobuf_FieldOptions_FeatureSupport* msg) {
9313 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9314 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9315}
9316UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_deprecated(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9317 int32_t default_val = 0;
9318 int32_t ret;
9319 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9320 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9321 &default_val, &ret);
9322 return ret;
9323}
9324UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_deprecated(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9325 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9326 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9327}
9328UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_deprecation_warning(google_protobuf_FieldOptions_FeatureSupport* msg) {
9329 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)};
9330 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9331}
9332UPB_INLINE upb_StringView google_protobuf_FieldOptions_FeatureSupport_deprecation_warning(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9333 upb_StringView default_val = upb_StringView_FromString("");
9334 upb_StringView ret;
9335 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)};
9336 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9337 &default_val, &ret);
9338 return ret;
9339}
9340UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_deprecation_warning(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9341 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)};
9342 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9343}
9344UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_clear_edition_removed(google_protobuf_FieldOptions_FeatureSupport* msg) {
9345 const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9346 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
9347}
9348UPB_INLINE int32_t google_protobuf_FieldOptions_FeatureSupport_edition_removed(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9349 int32_t default_val = 0;
9350 int32_t ret;
9351 const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9352 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9353 &default_val, &ret);
9354 return ret;
9355}
9356UPB_INLINE bool google_protobuf_FieldOptions_FeatureSupport_has_edition_removed(const google_protobuf_FieldOptions_FeatureSupport* msg) {
9357 const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9358 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
9359}
9360
9361UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_introduced(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9362 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9363 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9364}
9365UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_deprecated(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9366 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9367 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9368}
9369UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_deprecation_warning(google_protobuf_FieldOptions_FeatureSupport *msg, upb_StringView value) {
9370 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)};
9371 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9372}
9373UPB_INLINE void google_protobuf_FieldOptions_FeatureSupport_set_edition_removed(google_protobuf_FieldOptions_FeatureSupport *msg, int32_t value) {
9374 const upb_MiniTableField field = {4, 20, 67, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9375 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
9376}
9377
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009378/* google.protobuf.OneofOptions */
9379
Joshua Habermanf41049a2022-01-21 14:41:25 -08009380UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009381 return (google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009382}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009383UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9384 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009385 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009386 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofOptions_msg_init, NULL, 0, arena) !=
9387 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009388 return NULL;
9389 }
9390 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009391}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009392UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size,
9393 const upb_ExtensionRegistry* extreg,
9394 int options, upb_Arena* arena) {
9395 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
9396 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009397 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofOptions_msg_init, extreg, options,
9398 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009399 return NULL;
9400 }
9401 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009402}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009403UPB_INLINE char* google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009404 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009405 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009406 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009407}
9408UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options,
9409 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009410 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009411 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009412 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009413}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009414UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009415 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 +00009416 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009417}
9418UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) {
9419 const google_protobuf_FeatureSet* default_val = NULL;
9420 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009421 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 +00009422 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9423 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009424 return ret;
9425}
9426UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009427 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 +00009428 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009429}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009430UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009431 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 +00009432 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009433}
Eric Salob7d54ac2022-12-29 11:59:42 -08009434UPB_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 +00009435 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 +00009436 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009437 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009438 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009439 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009440 } else {
9441 if (size) *size = 0;
9442 return NULL;
9443 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009444}
Deanna Garciab26afb52023-04-25 13:37:18 -07009445UPB_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 +00009446 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 +00009447 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009448 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009449 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009450 }
9451 return arr;
9452}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009453UPB_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 +00009454 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 +00009455 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9456 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009457 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009458 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009459 }
9460 return arr;
9461}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009462
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009463UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009464 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 +00009465 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009466}
9467UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
9468 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg);
9469 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009470 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009471 if (sub) google_protobuf_OneofOptions_set_features(msg, sub);
9472 }
9473 return sub;
9474}
Eric Salob7d54ac2022-12-29 11:59:42 -08009475UPB_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 +00009476 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 +00009477 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009478 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009479 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009480 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009481 } else {
9482 if (size) *size = 0;
9483 return NULL;
9484 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009485}
Eric Salob7d54ac2022-12-29 11:59:42 -08009486UPB_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 +00009487 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 +00009488 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9489 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009490}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009491UPB_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 +00009492 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 +00009493 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9494 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009495 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009496 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009497 return NULL;
9498 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009499 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 -08009500 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009501 UPB_PRIVATE(_upb_Array_Set)
9502 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009503 return sub;
9504}
9505
9506/* google.protobuf.EnumOptions */
9507
Joshua Habermanf41049a2022-01-21 14:41:25 -08009508UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009509 return (google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009510}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009511UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9512 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009513 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009514 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumOptions_msg_init, NULL, 0, arena) !=
9515 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009516 return NULL;
9517 }
9518 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009519}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009520UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size,
9521 const upb_ExtensionRegistry* extreg,
9522 int options, upb_Arena* arena) {
9523 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
9524 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009525 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumOptions_msg_init, extreg, options,
9526 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009527 return NULL;
9528 }
9529 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009530}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009531UPB_INLINE char* google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009532 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009533 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009534 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009535}
9536UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options,
9537 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009538 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009539 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009540 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009541}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009542UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009543 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 +00009544 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009545}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009546UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009547 bool default_val = false;
9548 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009549 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 +00009550 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9551 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009552 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009553}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009554UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009555 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 +00009556 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009557}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009558UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009559 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 +00009560 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009561}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009562UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009563 bool default_val = false;
9564 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009565 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 +00009566 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9567 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009568 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009569}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009570UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009571 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 +00009572 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009573}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009574UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009575 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 +00009576 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009577}
9578UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
9579 bool default_val = false;
9580 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009581 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 +00009582 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9583 &default_val, &ret);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009584 return ret;
9585}
9586UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009587 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 +00009588 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009589}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009590UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009591 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 +00009592 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009593}
9594UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) {
9595 const google_protobuf_FeatureSet* default_val = NULL;
9596 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009597 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 +00009598 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9599 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009600 return ret;
9601}
9602UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009603 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 +00009604 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009605}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009606UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009607 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 +00009608 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009609}
Eric Salob7d54ac2022-12-29 11:59:42 -08009610UPB_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 +00009611 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 +00009612 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009613 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009614 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009615 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009616 } else {
9617 if (size) *size = 0;
9618 return NULL;
9619 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009620}
Deanna Garciab26afb52023-04-25 13:37:18 -07009621UPB_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 +00009622 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 +00009623 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009624 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009625 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009626 }
9627 return arr;
9628}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009629UPB_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 +00009630 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 +00009631 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9632 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009633 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009634 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009635 }
9636 return arr;
9637}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009638
9639UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009640 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 +00009641 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009642}
9643UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009644 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 +00009645 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009646}
9647UPB_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 +00009648 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 +00009649 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009650}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009651UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009652 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 +00009653 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009654}
9655UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
9656 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg);
9657 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009658 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009659 if (sub) google_protobuf_EnumOptions_set_features(msg, sub);
9660 }
9661 return sub;
9662}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009663UPB_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 +00009664 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 +00009665 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009666 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009667 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009668 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009669 } else {
9670 if (size) *size = 0;
9671 return NULL;
9672 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009673}
Eric Salob7d54ac2022-12-29 11:59:42 -08009674UPB_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 +00009675 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 +00009676 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9677 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009678}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009679UPB_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 +00009680 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 +00009681 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9682 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009683 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009684 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009685 return NULL;
9686 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009687 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 -08009688 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009689 UPB_PRIVATE(_upb_Array_Set)
9690 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009691 return sub;
9692}
9693
9694/* google.protobuf.EnumValueOptions */
9695
Joshua Habermanf41049a2022-01-21 14:41:25 -08009696UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009697 return (google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009698}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009699UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9700 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009701 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009702 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueOptions_msg_init, NULL, 0, arena) !=
9703 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009704 return NULL;
9705 }
9706 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009707}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009708UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size,
9709 const upb_ExtensionRegistry* extreg,
9710 int options, upb_Arena* arena) {
9711 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
9712 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009713 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueOptions_msg_init, extreg, options,
9714 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009715 return NULL;
9716 }
9717 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009718}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009719UPB_INLINE char* google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009720 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009721 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009722 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009723}
9724UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options,
9725 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009726 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009727 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009728 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009729}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009730UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009731 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 +00009732 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009733}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009734UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009735 bool default_val = false;
9736 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009737 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 +00009738 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9739 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009740 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009741}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009742UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009743 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 +00009744 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009745}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009746UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009747 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 +00009748 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009749}
9750UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) {
9751 const google_protobuf_FeatureSet* default_val = NULL;
9752 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009753 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 +00009754 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9755 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009756 return ret;
9757}
9758UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009759 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 +00009760 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009761}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009762UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009763 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 +00009764 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009765}
9766UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) {
9767 bool default_val = false;
9768 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009769 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 +00009770 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9771 &default_val, &ret);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009772 return ret;
9773}
9774UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009775 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 +00009776 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009777}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009778UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009779 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 +00009780 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009781}
Eric Salob7d54ac2022-12-29 11:59:42 -08009782UPB_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 +00009783 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 +00009784 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009785 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009786 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009787 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009788 } else {
9789 if (size) *size = 0;
9790 return NULL;
9791 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009792}
Deanna Garciab26afb52023-04-25 13:37:18 -07009793UPB_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 +00009794 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 +00009795 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009796 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009797 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009798 }
9799 return arr;
9800}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009801UPB_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 +00009802 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 +00009803 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9804 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009805 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009806 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009807 }
9808 return arr;
9809}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009810
9811UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009812 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 +00009813 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009814}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009815UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009816 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 +00009817 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009818}
9819UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
9820 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg);
9821 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009822 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009823 if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub);
9824 }
9825 return sub;
9826}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009827UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009828 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 +00009829 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009830}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009831UPB_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 +00009832 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 +00009833 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009834 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009835 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009836 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009837 } else {
9838 if (size) *size = 0;
9839 return NULL;
9840 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009841}
Eric Salob7d54ac2022-12-29 11:59:42 -08009842UPB_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 +00009843 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 +00009844 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9845 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009846}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009847UPB_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 +00009848 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 +00009849 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9850 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009851 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009852 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009853 return NULL;
9854 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009855 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 -08009856 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009857 UPB_PRIVATE(_upb_Array_Set)
9858 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009859 return sub;
9860}
9861
9862/* google.protobuf.ServiceOptions */
9863
Joshua Habermanf41049a2022-01-21 14:41:25 -08009864UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009865 return (google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009866}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009867UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9868 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009869 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009870 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceOptions_msg_init, NULL, 0, arena) !=
9871 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009872 return NULL;
9873 }
9874 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009875}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009876UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size,
9877 const upb_ExtensionRegistry* extreg,
9878 int options, upb_Arena* arena) {
9879 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
9880 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009881 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceOptions_msg_init, extreg, options,
9882 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009883 return NULL;
9884 }
9885 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009886}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009887UPB_INLINE char* google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009888 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009889 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009890 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009891}
9892UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options,
9893 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009894 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009895 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009896 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009897}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009898UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009899 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 +00009900 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009901}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009902UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009903 bool default_val = false;
9904 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009905 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 +00009906 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9907 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009908 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009909}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009910UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009911 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 +00009912 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009913}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009914UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009915 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 +00009916 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009917}
9918UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) {
9919 const google_protobuf_FeatureSet* default_val = NULL;
9920 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009921 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 +00009922 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9923 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009924 return ret;
9925}
9926UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009927 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 +00009928 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009929}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009930UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009931 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 +00009932 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009933}
Eric Salob7d54ac2022-12-29 11:59:42 -08009934UPB_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 +00009935 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 +00009936 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009937 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009938 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009939 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009940 } else {
9941 if (size) *size = 0;
9942 return NULL;
9943 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009944}
Deanna Garciab26afb52023-04-25 13:37:18 -07009945UPB_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 +00009946 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 +00009947 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009948 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009949 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009950 }
9951 return arr;
9952}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009953UPB_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 +00009954 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 +00009955 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9956 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009957 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009958 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009959 }
9960 return arr;
9961}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009962
9963UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009964 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 +00009965 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009966}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009967UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009968 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 +00009969 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009970}
9971UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
9972 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg);
9973 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009974 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009975 if (sub) google_protobuf_ServiceOptions_set_features(msg, sub);
9976 }
9977 return sub;
9978}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009979UPB_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 +00009980 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 +00009981 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009982 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009983 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009984 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009985 } else {
9986 if (size) *size = 0;
9987 return NULL;
9988 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009989}
Eric Salob7d54ac2022-12-29 11:59:42 -08009990UPB_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 +00009991 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 +00009992 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9993 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009994}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009995UPB_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 +00009996 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 +00009997 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9998 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009999 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010000 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010001 return NULL;
10002 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010003 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 -080010004 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010005 UPB_PRIVATE(_upb_Array_Set)
10006 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010007 return sub;
10008}
10009
10010/* google.protobuf.MethodOptions */
10011
Joshua Habermanf41049a2022-01-21 14:41:25 -080010012UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010013 return (google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010014}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010015UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
10016 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010017 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010018 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodOptions_msg_init, NULL, 0, arena) !=
10019 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010020 return NULL;
10021 }
10022 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010023}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010024UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size,
10025 const upb_ExtensionRegistry* extreg,
10026 int options, upb_Arena* arena) {
10027 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
10028 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010029 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodOptions_msg_init, extreg, options,
10030 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010031 return NULL;
10032 }
10033 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010034}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010035UPB_INLINE char* google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010036 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010037 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010038 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010039}
10040UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options,
10041 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010042 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010043 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010044 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010045}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010046UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010047 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 +000010048 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010049}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010050UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010051 bool default_val = false;
10052 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010053 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 +000010054 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10055 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010056 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010057}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010058UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010059 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 +000010060 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010061}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010062UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010063 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 +000010064 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010065}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010066UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010067 int32_t default_val = 0;
10068 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010069 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 +000010070 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10071 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010072 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010073}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010074UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010075 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 +000010076 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010077}
10078UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010079 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 +000010080 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010081}
10082UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) {
10083 const google_protobuf_FeatureSet* default_val = NULL;
10084 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010085 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 +000010086 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10087 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010088 return ret;
10089}
10090UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010091 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 +000010092 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010093}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010094UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010095 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 +000010096 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010097}
Eric Salob7d54ac2022-12-29 11:59:42 -080010098UPB_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 +000010099 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 +000010100 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010101 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010102 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010103 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010104 } else {
10105 if (size) *size = 0;
10106 return NULL;
10107 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010108}
Deanna Garciab26afb52023-04-25 13:37:18 -070010109UPB_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 +000010110 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 +000010111 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010112 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010113 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010114 }
10115 return arr;
10116}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010117UPB_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 +000010118 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 +000010119 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10120 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010121 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010122 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010123 }
10124 return arr;
10125}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010126
10127UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010128 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 +000010129 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010130}
10131UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010132 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 +000010133 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010134}
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010135UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010136 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 +000010137 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010138}
10139UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
10140 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg);
10141 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010142 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010143 if (sub) google_protobuf_MethodOptions_set_features(msg, sub);
10144 }
10145 return sub;
10146}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010147UPB_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 +000010148 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 +000010149 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010150 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010151 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010152 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010153 } else {
10154 if (size) *size = 0;
10155 return NULL;
10156 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010157}
Eric Salob7d54ac2022-12-29 11:59:42 -080010158UPB_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 +000010159 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 +000010160 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10161 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010162}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010163UPB_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 +000010164 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 +000010165 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10166 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010167 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010168 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010169 return NULL;
10170 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010171 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 -080010172 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010173 UPB_PRIVATE(_upb_Array_Set)
10174 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010175 return sub;
10176}
10177
10178/* google.protobuf.UninterpretedOption */
10179
Joshua Habermanf41049a2022-01-21 14:41:25 -080010180UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010181 return (google_protobuf_UninterpretedOption*)_upb_Message_New(&google__protobuf__UninterpretedOption_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010182}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010183UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) {
10184 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010185 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010186 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption_msg_init, NULL, 0, arena) !=
10187 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010188 return NULL;
10189 }
10190 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010191}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010192UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size,
10193 const upb_ExtensionRegistry* extreg,
10194 int options, upb_Arena* arena) {
10195 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
10196 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010197 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption_msg_init, extreg, options,
10198 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010199 return NULL;
10200 }
10201 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010202}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010203UPB_INLINE char* google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010204 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010205 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010206 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010207}
10208UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options,
10209 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010210 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010211 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010212 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010213}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010214UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010215 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 +000010216 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010217}
Eric Salob7d54ac2022-12-29 11:59:42 -080010218UPB_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 +000010219 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 +000010220 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010221 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010222 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010223 return (const google_protobuf_UninterpretedOption_NamePart* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010224 } else {
10225 if (size) *size = 0;
10226 return NULL;
10227 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010228}
Deanna Garciab26afb52023-04-25 13:37:18 -070010229UPB_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 +000010230 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 +000010231 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010232 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010233 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010234 }
10235 return arr;
10236}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010237UPB_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 +000010238 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 +000010239 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10240 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010241 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010242 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010243 }
10244 return arr;
10245}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010246UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010247 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 +000010248 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010249}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010250UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010251 upb_StringView default_val = upb_StringView_FromString("");
10252 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010253 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 +000010254 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10255 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010256 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010257}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010258UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010259 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 +000010260 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010261}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010262UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010263 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 +000010264 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010265}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010266UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010267 uint64_t default_val = (uint64_t)0ull;
10268 uint64_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010269 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 +000010270 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10271 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010272 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010273}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010274UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010275 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 +000010276 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010277}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010278UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010279 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 +000010280 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010281}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010282UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010283 int64_t default_val = (int64_t)0ll;
10284 int64_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010285 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 +000010286 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10287 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010288 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010289}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010290UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010291 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 +000010292 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010293}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010294UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010295 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 +000010296 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010297}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010298UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010299 double default_val = 0;
10300 double ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010301 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 +000010302 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10303 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010304 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010305}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010306UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010307 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 +000010308 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010309}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010310UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010311 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 +000010312 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010313}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010314UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010315 upb_StringView default_val = upb_StringView_FromString("");
10316 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010317 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 +000010318 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10319 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010320 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010321}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010322UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010323 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 +000010324 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010325}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010326UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010327 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 +000010328 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010329}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010330UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010331 upb_StringView default_val = upb_StringView_FromString("");
10332 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010333 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 +000010334 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10335 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010336 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010337}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010338UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010339 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 +000010340 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010341}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010342
Eric Salob7d54ac2022-12-29 11:59:42 -080010343UPB_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 +000010344 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 +000010345 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010346 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010347 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010348 return (google_protobuf_UninterpretedOption_NamePart**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010349 } else {
10350 if (size) *size = 0;
10351 return NULL;
10352 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010353}
Eric Salob7d54ac2022-12-29 11:59:42 -080010354UPB_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 +000010355 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 +000010356 return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10357 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010358}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010359UPB_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 +000010360 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 +000010361 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10362 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010363 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010364 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010365 return NULL;
10366 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010367 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 -080010368 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010369 UPB_PRIVATE(_upb_Array_Set)
10370 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010371 return sub;
10372}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010373UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010374 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 +000010375 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010376}
10377UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010378 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 +000010379 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010380}
10381UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010382 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 +000010383 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010384}
10385UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010386 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 +000010387 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010388}
10389UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010390 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 +000010391 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010392}
10393UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010394 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 +000010395 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010396}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010397
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010398/* google.protobuf.UninterpretedOption.NamePart */
10399
Joshua Habermanf41049a2022-01-21 14:41:25 -080010400UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010401 return (google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google__protobuf__UninterpretedOption__NamePart_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010402}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010403UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) {
10404 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010405 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010406 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption__NamePart_msg_init, NULL, 0, arena) !=
10407 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010408 return NULL;
10409 }
10410 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010411}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010412UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size,
10413 const upb_ExtensionRegistry* extreg,
10414 int options, upb_Arena* arena) {
10415 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
10416 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010417 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption__NamePart_msg_init, extreg, options,
10418 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010419 return NULL;
10420 }
10421 return ret;
10422}
10423UPB_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 -070010424 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010425 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption__NamePart_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010426 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010427}
10428UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options,
10429 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010430 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010431 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption__NamePart_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010432 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010433}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010434UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010435 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 +000010436 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010437}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010438UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010439 upb_StringView default_val = upb_StringView_FromString("");
10440 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010441 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 +000010442 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10443 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010444 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010445}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010446UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010447 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 +000010448 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010449}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010450UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010451 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 +000010452 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010453}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010454UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010455 bool default_val = false;
10456 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010457 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 +000010458 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10459 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010460 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010461}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010462UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010463 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 +000010464 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010465}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010466
Joshua Habermanf41049a2022-01-21 14:41:25 -080010467UPB_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 +000010468 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 +000010469 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010470}
10471UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010472 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 +000010473 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010474}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010475
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010476/* google.protobuf.FeatureSet */
10477
10478UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010479 return (google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010480}
10481UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) {
10482 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
10483 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010484 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSet_msg_init, NULL, 0, arena) !=
10485 kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010486 return NULL;
10487 }
10488 return ret;
10489}
10490UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size,
10491 const upb_ExtensionRegistry* extreg,
10492 int options, upb_Arena* arena) {
10493 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
10494 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010495 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSet_msg_init, extreg, options,
10496 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010497 return NULL;
10498 }
10499 return ret;
10500}
10501UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) {
10502 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010503 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSet_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010504 return ptr;
10505}
10506UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options,
10507 upb_Arena* arena, size_t* len) {
10508 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010509 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSet_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010510 return ptr;
10511}
10512UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010513 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 +000010514 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010515}
10516UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) {
10517 int32_t default_val = 0;
10518 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010519 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 +000010520 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10521 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010522 return ret;
10523}
10524UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010525 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 +000010526 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010527}
10528UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010529 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 +000010530 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010531}
10532UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) {
10533 int32_t default_val = 0;
10534 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010535 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 +000010536 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10537 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010538 return ret;
10539}
10540UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010541 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 +000010542 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010543}
10544UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010545 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 +000010546 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010547}
10548UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
10549 int32_t default_val = 0;
10550 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010551 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 +000010552 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10553 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010554 return ret;
10555}
10556UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010557 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 +000010558 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010559}
Protobuf Team Bot61127952023-09-26 20:07:33 +000010560UPB_INLINE void google_protobuf_FeatureSet_clear_utf8_validation(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010561 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 +000010562 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010563}
10564UPB_INLINE int32_t google_protobuf_FeatureSet_utf8_validation(const google_protobuf_FeatureSet* msg) {
10565 int32_t default_val = 0;
10566 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010567 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 +000010568 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10569 &default_val, &ret);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010570 return ret;
10571}
10572UPB_INLINE bool google_protobuf_FeatureSet_has_utf8_validation(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010573 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 +000010574 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010575}
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010576UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010577 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 +000010578 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010579}
10580UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) {
10581 int32_t default_val = 0;
10582 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010583 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 +000010584 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10585 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010586 return ret;
10587}
10588UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010589 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 +000010590 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010591}
10592UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010593 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 +000010594 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010595}
10596UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) {
10597 int32_t default_val = 0;
10598 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010599 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 +000010600 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10601 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010602 return ret;
10603}
10604UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010605 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 +000010606 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010607}
10608
10609UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010610 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 +000010611 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010612}
10613UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010614 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 +000010615 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010616}
10617UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010618 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 +000010619 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010620}
Protobuf Team Bot61127952023-09-26 20:07:33 +000010621UPB_INLINE void google_protobuf_FeatureSet_set_utf8_validation(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010622 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 +000010623 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010624}
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010625UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010626 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 +000010627 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010628}
10629UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010630 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 +000010631 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010632}
10633
Mike Kruskalba964702023-08-22 17:37:48 -070010634/* google.protobuf.FeatureSetDefaults */
10635
10636UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010637 return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google__protobuf__FeatureSetDefaults_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010638}
10639UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) {
10640 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
10641 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010642 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults_msg_init, NULL, 0, arena) !=
10643 kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010644 return NULL;
10645 }
10646 return ret;
10647}
10648UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size,
10649 const upb_ExtensionRegistry* extreg,
10650 int options, upb_Arena* arena) {
10651 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
10652 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010653 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults_msg_init, extreg, options,
10654 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010655 return NULL;
10656 }
10657 return ret;
10658}
10659UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) {
10660 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010661 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010662 return ptr;
10663}
10664UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options,
10665 upb_Arena* arena, size_t* len) {
10666 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010667 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010668 return ptr;
10669}
10670UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_defaults(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010671 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 +000010672 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010673}
10674UPB_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 +000010675 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 +000010676 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010677 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010678 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010679 return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)upb_Array_DataPtr(arr);
Mike Kruskalba964702023-08-22 17:37:48 -070010680 } else {
10681 if (size) *size = 0;
10682 return NULL;
10683 }
10684}
10685UPB_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 +000010686 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 +000010687 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010688 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010689 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskalba964702023-08-22 17:37:48 -070010690 }
10691 return arr;
10692}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010693UPB_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 +000010694 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 +000010695 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10696 &field, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010697 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010698 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskalba964702023-08-22 17:37:48 -070010699 }
10700 return arr;
10701}
Mike Kruskalba964702023-08-22 17:37:48 -070010702UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010703 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 +000010704 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010705}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010706UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
10707 int32_t default_val = 0;
10708 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010709 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 +000010710 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10711 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010712 return ret;
10713}
10714UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010715 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 +000010716 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010717}
10718UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010719 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 +000010720 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010721}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010722UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
10723 int32_t default_val = 0;
10724 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010725 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 +000010726 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10727 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010728 return ret;
10729}
10730UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010731 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 +000010732 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010733}
10734
10735UPB_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 +000010736 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 +000010737 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010738 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010739 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010740 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Array_MutableDataPtr(arr);
Mike Kruskalba964702023-08-22 17:37:48 -070010741 } else {
10742 if (size) *size = 0;
10743 return NULL;
10744 }
10745}
10746UPB_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 +000010747 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 +000010748 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10749 &field, size, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010750}
10751UPB_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 +000010752 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 +000010753 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10754 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010755 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010756 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskalba964702023-08-22 17:37:48 -070010757 return NULL;
10758 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010759 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 -070010760 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010761 UPB_PRIVATE(_upb_Array_Set)
10762 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskalba964702023-08-22 17:37:48 -070010763 return sub;
10764}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010765UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010766 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 +000010767 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010768}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010769UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010770 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 +000010771 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010772}
10773
10774/* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */
10775
10776UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010777 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010778}
10779UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
10780 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
10781 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010782 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, NULL, 0, arena) !=
10783 kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010784 return NULL;
10785 }
10786 return ret;
10787}
10788UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size,
10789 const upb_ExtensionRegistry* extreg,
10790 int options, upb_Arena* arena) {
10791 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
10792 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010793 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, extreg, options,
10794 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010795 return NULL;
10796 }
10797 return ret;
10798}
10799UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) {
10800 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010801 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010802 return ptr;
10803}
10804UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options,
10805 upb_Arena* arena, size_t* len) {
10806 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010807 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010808 return ptr;
10809}
Mike Kruskalba964702023-08-22 17:37:48 -070010810UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010811 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 +000010812 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010813}
10814UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10815 const google_protobuf_FeatureSet* default_val = NULL;
10816 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010817 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 +000010818 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10819 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010820 return ret;
10821}
10822UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010823 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 +000010824 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010825}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010826UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010827 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 +000010828 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010829}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010830UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010831 int32_t default_val = 0;
10832 int32_t ret;
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010833 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 +000010834 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10835 &default_val, &ret);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010836 return ret;
10837}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010838UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010839 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
10840 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
10841}
10842UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10843 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)};
10844 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
10845}
10846UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_overridable_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10847 const google_protobuf_FeatureSet* default_val = NULL;
10848 const google_protobuf_FeatureSet* ret;
10849 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)};
10850 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10851 &default_val, &ret);
10852 return ret;
10853}
10854UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_overridable_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10855 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)};
10856 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
10857}
10858UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10859 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)};
10860 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
10861}
10862UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_fixed_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10863 const google_protobuf_FeatureSet* default_val = NULL;
10864 const google_protobuf_FeatureSet* ret;
10865 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)};
10866 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10867 &default_val, &ret);
10868 return ret;
10869}
10870UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_fixed_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10871 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 +000010872 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010873}
Mike Kruskalba964702023-08-22 17:37:48 -070010874
Mike Kruskalba964702023-08-22 17:37:48 -070010875UPB_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 +000010876 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 +000010877 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010878}
10879UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10880 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg);
10881 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010882 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010883 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub);
10884 }
10885 return sub;
10886}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010887UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010888 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 +000010889 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010890}
Protobuf Team Bot85edb7e2024-04-03 02:43:54 +000010891UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
10892 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)};
10893 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10894}
10895UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_overridable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10896 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_overridable_features(msg);
10897 if (sub == NULL) {
10898 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
10899 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_overridable_features(msg, sub);
10900 }
10901 return sub;
10902}
10903UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
10904 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)};
10905 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
10906}
10907UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_fixed_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10908 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_fixed_features(msg);
10909 if (sub == NULL) {
10910 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
10911 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_fixed_features(msg, sub);
10912 }
10913 return sub;
10914}
Mike Kruskalba964702023-08-22 17:37:48 -070010915
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010916/* google.protobuf.SourceCodeInfo */
10917
Joshua Habermanf41049a2022-01-21 14:41:25 -080010918UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010919 return (google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010920}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010921UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
10922 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010923 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010924 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo_msg_init, NULL, 0, arena) !=
10925 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010926 return NULL;
10927 }
10928 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010929}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010930UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size,
10931 const upb_ExtensionRegistry* extreg,
10932 int options, upb_Arena* arena) {
10933 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
10934 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010935 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo_msg_init, extreg, options,
10936 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010937 return NULL;
10938 }
10939 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010940}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010941UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010942 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010943 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010944 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010945}
10946UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options,
10947 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010948 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010949 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010950 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010951}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010952UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010953 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 +000010954 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010955}
Eric Salob7d54ac2022-12-29 11:59:42 -080010956UPB_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 +000010957 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 +000010958 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010959 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010960 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010961 return (const google_protobuf_SourceCodeInfo_Location* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010962 } else {
10963 if (size) *size = 0;
10964 return NULL;
10965 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010966}
Deanna Garciab26afb52023-04-25 13:37:18 -070010967UPB_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 +000010968 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 +000010969 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010970 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010971 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010972 }
10973 return arr;
10974}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010975UPB_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 +000010976 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 +000010977 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10978 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010979 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010980 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010981 }
10982 return arr;
10983}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010984
Eric Salob7d54ac2022-12-29 11:59:42 -080010985UPB_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 +000010986 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 +000010987 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010988 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010989 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010990 return (google_protobuf_SourceCodeInfo_Location**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010991 } else {
10992 if (size) *size = 0;
10993 return NULL;
10994 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010995}
Eric Salob7d54ac2022-12-29 11:59:42 -080010996UPB_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 +000010997 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 +000010998 return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10999 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011000}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011001UPB_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 +000011002 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 +000011003 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11004 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011005 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011006 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011007 return NULL;
11008 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011009 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 -080011010 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011011 UPB_PRIVATE(_upb_Array_Set)
11012 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011013 return sub;
11014}
11015
11016/* google.protobuf.SourceCodeInfo.Location */
11017
Joshua Habermanf41049a2022-01-21 14:41:25 -080011018UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011019 return (google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google__protobuf__SourceCodeInfo__Location_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011020}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011021UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) {
11022 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070011023 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011024 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo__Location_msg_init, NULL, 0, arena) !=
11025 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070011026 return NULL;
11027 }
11028 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011029}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011030UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size,
11031 const upb_ExtensionRegistry* extreg,
11032 int options, upb_Arena* arena) {
11033 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
11034 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011035 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo__Location_msg_init, extreg, options,
11036 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080011037 return NULL;
11038 }
11039 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011040}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011041UPB_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 -070011042 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011043 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo__Location_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011044 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011045}
11046UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options,
11047 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011048 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011049 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo__Location_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011050 return ptr;
11051}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011052UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011053 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 +000011054 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080011055}
Eric Salob7d54ac2022-12-29 11:59:42 -080011056UPB_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 +000011057 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 +000011058 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011059 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011060 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011061 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011062 } else {
11063 if (size) *size = 0;
11064 return NULL;
11065 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070011066}
Deanna Garciab26afb52023-04-25 13:37:18 -070011067UPB_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 +000011068 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 +000011069 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011070 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011071 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011072 }
11073 return arr;
11074}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011075UPB_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 +000011076 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 +000011077 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11078 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011079 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011080 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011081 }
11082 return arr;
11083}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011084UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011085 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 +000011086 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011087}
Eric Salob7d54ac2022-12-29 11:59:42 -080011088UPB_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 +000011089 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 +000011090 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011091 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011092 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011093 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011094 } else {
11095 if (size) *size = 0;
11096 return NULL;
11097 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011098}
Deanna Garciab26afb52023-04-25 13:37:18 -070011099UPB_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 +000011100 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 +000011101 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011102 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011103 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011104 }
11105 return arr;
11106}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011107UPB_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 +000011108 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 +000011109 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11110 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011111 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011112 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011113 }
11114 return arr;
11115}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011116UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011117 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 +000011118 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011119}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011120UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011121 upb_StringView default_val = upb_StringView_FromString("");
11122 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011123 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 +000011124 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11125 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011126 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011127}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011128UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011129 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 +000011130 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011131}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011132UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011133 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 +000011134 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011135}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011136UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011137 upb_StringView default_val = upb_StringView_FromString("");
11138 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011139 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 +000011140 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11141 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011142 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011143}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011144UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011145 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 +000011146 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080011147}
11148UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011149 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 +000011150 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080011151}
Eric Salob7d54ac2022-12-29 11:59:42 -080011152UPB_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 +000011153 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 +000011154 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011155 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011156 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011157 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011158 } else {
11159 if (size) *size = 0;
11160 return NULL;
11161 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011162}
Deanna Garciab26afb52023-04-25 13:37:18 -070011163UPB_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 +000011164 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 +000011165 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011166 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011167 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011168 }
11169 return arr;
11170}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011171UPB_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 +000011172 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 +000011173 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11174 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011175 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011176 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011177 }
11178 return arr;
11179}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011180
Eric Salob7d54ac2022-12-29 11:59:42 -080011181UPB_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 +000011182 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 +000011183 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011184 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011185 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011186 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011187 } else {
11188 if (size) *size = 0;
11189 return NULL;
11190 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011191}
Eric Salob7d54ac2022-12-29 11:59:42 -080011192UPB_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 +000011193 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 +000011194 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11195 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011196}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011197UPB_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 +000011198 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 +000011199 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11200 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011201 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011202 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011203 return false;
11204 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011205 UPB_PRIVATE(_upb_Array_Set)
11206 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011207 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011208}
Eric Salob7d54ac2022-12-29 11:59:42 -080011209UPB_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 +000011210 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 +000011211 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011212 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011213 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011214 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011215 } else {
11216 if (size) *size = 0;
11217 return NULL;
11218 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011219}
Eric Salob7d54ac2022-12-29 11:59:42 -080011220UPB_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 +000011221 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 +000011222 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11223 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011224}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011225UPB_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 +000011226 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 +000011227 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11228 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011229 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011230 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011231 return false;
11232 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011233 UPB_PRIVATE(_upb_Array_Set)
11234 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011235 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011236}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011237UPB_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 +000011238 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 +000011239 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011240}
11241UPB_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 +000011242 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 +000011243 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011244}
11245UPB_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 +000011246 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 +000011247 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011248 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011249 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011250 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011251 } else {
11252 if (size) *size = 0;
11253 return NULL;
11254 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011255}
Eric Salob7d54ac2022-12-29 11:59:42 -080011256UPB_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 +000011257 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 +000011258 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11259 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011260}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011261UPB_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 +000011262 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 +000011263 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11264 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011265 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011266 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011267 return false;
11268 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011269 UPB_PRIVATE(_upb_Array_Set)
11270 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011271 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011272}
11273
11274/* google.protobuf.GeneratedCodeInfo */
11275
Joshua Habermanf41049a2022-01-21 14:41:25 -080011276UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011277 return (google_protobuf_GeneratedCodeInfo*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011278}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011279UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
11280 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070011281 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011282 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo_msg_init, NULL, 0, arena) !=
11283 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070011284 return NULL;
11285 }
11286 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011287}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011288UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size,
11289 const upb_ExtensionRegistry* extreg,
11290 int options, upb_Arena* arena) {
11291 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
11292 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011293 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo_msg_init, extreg, options,
11294 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080011295 return NULL;
11296 }
11297 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011298}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011299UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011300 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011301 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011302 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011303}
11304UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options,
11305 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011306 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011307 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011308 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011309}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011310UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011311 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 +000011312 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011313}
Eric Salob7d54ac2022-12-29 11:59:42 -080011314UPB_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 +000011315 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 +000011316 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011317 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011318 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011319 return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011320 } else {
11321 if (size) *size = 0;
11322 return NULL;
11323 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011324}
Deanna Garciab26afb52023-04-25 13:37:18 -070011325UPB_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 +000011326 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 +000011327 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011328 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011329 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011330 }
11331 return arr;
11332}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011333UPB_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 +000011334 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 +000011335 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11336 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011337 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011338 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011339 }
11340 return arr;
11341}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011342
Eric Salob7d54ac2022-12-29 11:59:42 -080011343UPB_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 +000011344 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 +000011345 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011346 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011347 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011348 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011349 } else {
11350 if (size) *size = 0;
11351 return NULL;
11352 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011353}
Eric Salob7d54ac2022-12-29 11:59:42 -080011354UPB_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 +000011355 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 +000011356 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11357 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011358}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011359UPB_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 +000011360 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 +000011361 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11362 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011363 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011364 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011365 return NULL;
11366 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011367 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 -080011368 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011369 UPB_PRIVATE(_upb_Array_Set)
11370 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011371 return sub;
11372}
11373
11374/* google.protobuf.GeneratedCodeInfo.Annotation */
11375
Joshua Habermanf41049a2022-01-21 14:41:25 -080011376UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011377 return (google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo__Annotation_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011378}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011379UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) {
11380 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070011381 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011382 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, NULL, 0, arena) !=
11383 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070011384 return NULL;
11385 }
11386 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011387}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011388UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size,
11389 const upb_ExtensionRegistry* extreg,
11390 int options, upb_Arena* arena) {
11391 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
11392 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011393 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, extreg, options,
11394 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080011395 return NULL;
11396 }
11397 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011398}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011399UPB_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 -070011400 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011401 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011402 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011403}
11404UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options,
11405 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011406 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011407 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011408 return ptr;
11409}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011410UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011411 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 +000011412 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080011413}
Eric Salob7d54ac2022-12-29 11:59:42 -080011414UPB_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 +000011415 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 +000011416 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011417 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011418 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011419 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011420 } else {
11421 if (size) *size = 0;
11422 return NULL;
11423 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011424}
Deanna Garciab26afb52023-04-25 13:37:18 -070011425UPB_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 +000011426 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 +000011427 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011428 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011429 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011430 }
11431 return arr;
11432}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011433UPB_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 +000011434 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 +000011435 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11436 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011437 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011438 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011439 }
11440 return arr;
11441}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011442UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011443 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 +000011444 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011445}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011446UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011447 upb_StringView default_val = upb_StringView_FromString("");
11448 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011449 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 +000011450 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11451 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011452 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011453}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011454UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011455 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 +000011456 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011457}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011458UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011459 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 +000011460 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011461}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011462UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011463 int32_t default_val = (int32_t)0;
11464 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011465 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 +000011466 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11467 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011468 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011469}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011470UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011471 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 +000011472 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011473}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011474UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011475 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 +000011476 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011477}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011478UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011479 int32_t default_val = (int32_t)0;
11480 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011481 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 +000011482 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11483 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011484 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011485}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011486UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011487 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 +000011488 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011489}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011490UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011491 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 +000011492 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011493}
11494UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011495 int32_t default_val = 0;
11496 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011497 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 +000011498 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11499 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011500 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011501}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011502UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011503 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 +000011504 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080011505}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011506
Eric Salob7d54ac2022-12-29 11:59:42 -080011507UPB_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 +000011508 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 +000011509 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011510 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011511 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011512 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011513 } else {
11514 if (size) *size = 0;
11515 return NULL;
11516 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011517}
Eric Salob7d54ac2022-12-29 11:59:42 -080011518UPB_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 +000011519 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 +000011520 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11521 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011522}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011523UPB_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 +000011524 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 +000011525 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11526 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011527 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011528 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011529 return false;
11530 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011531 UPB_PRIVATE(_upb_Array_Set)
11532 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011533 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011534}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011535UPB_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 +000011536 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 +000011537 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011538}
11539UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011540 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 +000011541 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011542}
11543UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011544 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 +000011545 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011546}
11547UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011548 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 +000011549 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011550}
Mike Kruskal232ecf42023-01-14 00:09:40 -080011551
Joshua Habermanf41049a2022-01-21 14:41:25 -080011552/* Max size 32 is google.protobuf.FileOptions */
11553/* Max size 64 is google.protobuf.FileOptions */
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011554#define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200)
Joshua Habermanf41049a2022-01-21 14:41:25 -080011555
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011556#ifdef __cplusplus
11557} /* extern "C" */
11558#endif
11559
11560
11561#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
Mike Kruskal232ecf42023-01-14 00:09:40 -080011562// end:github_only
Eric Salo8809a112022-11-21 13:01:06 -080011563
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000011564typedef enum {
11565 kUpb_Syntax_Proto2 = 2,
11566 kUpb_Syntax_Proto3 = 3,
11567 kUpb_Syntax_Editions = 99
11568} upb_Syntax;
Eric Salo8809a112022-11-21 13:01:06 -080011569
11570// Forward declarations for circular references.
11571typedef struct upb_DefPool upb_DefPool;
11572typedef struct upb_EnumDef upb_EnumDef;
11573typedef struct upb_EnumReservedRange upb_EnumReservedRange;
11574typedef struct upb_EnumValueDef upb_EnumValueDef;
11575typedef struct upb_ExtensionRange upb_ExtensionRange;
11576typedef struct upb_FieldDef upb_FieldDef;
11577typedef struct upb_FileDef upb_FileDef;
11578typedef struct upb_MessageDef upb_MessageDef;
11579typedef struct upb_MessageReservedRange upb_MessageReservedRange;
11580typedef struct upb_MethodDef upb_MethodDef;
11581typedef struct upb_OneofDef upb_OneofDef;
11582typedef struct upb_ServiceDef upb_ServiceDef;
11583
11584// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
11585
11586typedef struct upb_DefBuilder upb_DefBuilder;
11587
11588#endif /* UPB_REFLECTION_COMMON_H_ */
11589
11590#ifndef UPB_REFLECTION_DEF_TYPE_H_
11591#define UPB_REFLECTION_DEF_TYPE_H_
11592
11593
11594// Must be last.
11595
11596// Inside a symtab we store tagged pointers to specific def types.
11597typedef enum {
11598 UPB_DEFTYPE_MASK = 7,
11599
11600 // Only inside symtab table.
11601 UPB_DEFTYPE_EXT = 0,
11602 UPB_DEFTYPE_MSG = 1,
11603 UPB_DEFTYPE_ENUM = 2,
11604 UPB_DEFTYPE_ENUMVAL = 3,
11605 UPB_DEFTYPE_SERVICE = 4,
11606
11607 // Only inside message table.
11608 UPB_DEFTYPE_FIELD = 0,
11609 UPB_DEFTYPE_ONEOF = 1,
Eric Salo8809a112022-11-21 13:01:06 -080011610} upb_deftype_t;
11611
11612#ifdef __cplusplus
11613extern "C" {
11614#endif
11615
11616// Our 3-bit pointer tagging requires all pointers to be multiples of 8.
11617// The arena will always yield 8-byte-aligned addresses, however we put
11618// the defs into arrays. For each element in the array to be 8-byte-aligned,
11619// the sizes of each def type must also be a multiple of 8.
11620//
11621// If any of these asserts fail, we need to add or remove padding on 32-bit
11622// machines (64-bit machines will have 8-byte alignment already due to
11623// pointers, which all of these structs have).
11624UPB_INLINE void _upb_DefType_CheckPadding(size_t size) {
11625 UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0);
11626}
11627
11628upb_deftype_t _upb_DefType_Type(upb_value v);
11629
11630upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type);
11631
11632const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type);
11633
11634#ifdef __cplusplus
11635} /* extern "C" */
11636#endif
11637
11638
11639#endif /* UPB_REFLECTION_DEF_TYPE_H_ */
11640
11641// Must be last.
11642
11643#ifdef __cplusplus
11644extern "C" {
11645#endif
11646
Jason Lunn67dee292023-07-13 13:15:26 -070011647UPB_API void upb_DefPool_Free(upb_DefPool* s);
Eric Salo8809a112022-11-21 13:01:06 -080011648
Jason Lunn67dee292023-07-13 13:15:26 -070011649UPB_API upb_DefPool* upb_DefPool_New(void);
Eric Salo8809a112022-11-21 13:01:06 -080011650
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011651UPB_API const UPB_DESC(FeatureSetDefaults) *
11652 upb_DefPool_FeatureSetDefaults(const upb_DefPool* s);
11653
Protobuf Team Botc6b149c2023-11-10 23:37:46 +000011654UPB_API bool upb_DefPool_SetFeatureSetDefaults(upb_DefPool* s,
11655 const char* serialized_defaults,
11656 size_t serialized_len,
11657 upb_Status* status);
11658
Jason Lunn67dee292023-07-13 13:15:26 -070011659UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName(
11660 const upb_DefPool* s, const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080011661
11662const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize(
11663 const upb_DefPool* s, const char* sym, size_t len);
11664
Jason Lunn67dee292023-07-13 13:15:26 -070011665UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s,
11666 const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080011667
11668const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s,
11669 const char* sym);
11670
11671const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s,
11672 const char* name);
11673
11674const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s,
11675 const char* name,
11676 size_t len);
11677
11678const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable(
11679 const upb_DefPool* s, const upb_MiniTableExtension* ext);
11680
Protobuf Team Bot8aad0582023-11-14 23:47:47 +000011681UPB_API const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s,
Eric Salo8809a112022-11-21 13:01:06 -080011682 const char* sym);
11683
11684const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize(
11685 const upb_DefPool* s, const char* name, size_t size);
11686
11687const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
11688 const upb_MessageDef* m,
11689 int32_t fieldnum);
11690
Protobuf Team Bot312240c2024-03-22 17:47:13 +000011691UPB_API const upb_ServiceDef* upb_DefPool_FindServiceByName(
11692 const upb_DefPool* s, const char* name);
Eric Salo8809a112022-11-21 13:01:06 -080011693
11694const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
11695 const upb_DefPool* s, const char* name, size_t size);
11696
11697const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s,
11698 const char* name);
11699
Jason Lunn67dee292023-07-13 13:15:26 -070011700UPB_API const upb_FileDef* upb_DefPool_AddFile(
11701 upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto,
11702 upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011703
Protobuf Team Bot8aad0582023-11-14 23:47:47 +000011704UPB_API const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry(
Eric Salo8809a112022-11-21 13:01:06 -080011705 const upb_DefPool* s);
11706
11707const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s,
11708 const upb_MessageDef* m,
11709 size_t* count);
11710
11711#ifdef __cplusplus
11712} /* extern "C" */
11713#endif
11714
11715
11716#endif /* UPB_REFLECTION_DEF_POOL_H_ */
11717
Protobuf Team Bot06310352023-09-26 21:54:58 +000011718// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011719
11720#ifndef UPB_REFLECTION_ENUM_DEF_H_
11721#define UPB_REFLECTION_ENUM_DEF_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -070011722
11723
11724// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011725
11726#ifdef __cplusplus
11727extern "C" {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011728#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011729
Eric Salo8809a112022-11-21 13:01:06 -080011730bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num);
11731const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e);
11732int32_t upb_EnumDef_Default(const upb_EnumDef* e);
Jason Lunn67dee292023-07-13 13:15:26 -070011733UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011734const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
11735 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011736UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011737 const upb_EnumDef* e, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011738UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
11739 const upb_EnumDef* e, int32_t num);
11740UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011741bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
11742bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
Protobuf Team Bot5e8d7e52024-03-15 22:28:30 +000011743bool upb_EnumDef_IsSpecifiedAsClosed(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011744
11745// Creates a mini descriptor string for an enum, returns true on success.
11746bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
11747 upb_StringView* out);
11748
11749const char* upb_EnumDef_Name(const upb_EnumDef* e);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011750const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011751const UPB_DESC(FeatureSet) * upb_EnumDef_ResolvedFeatures(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011752
11753upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i);
11754int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e);
11755
11756const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e,
11757 int i);
11758int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e);
11759
Jason Lunn67dee292023-07-13 13:15:26 -070011760UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i);
11761UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011762
11763#ifdef __cplusplus
11764} /* extern "C" */
11765#endif
11766
11767
11768#endif /* UPB_REFLECTION_ENUM_DEF_H_ */
11769
Protobuf Team Bot06310352023-09-26 21:54:58 +000011770// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011771
11772#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_
11773#define UPB_REFLECTION_ENUM_VALUE_DEF_H_
11774
11775
11776// Must be last.
11777
11778#ifdef __cplusplus
11779extern "C" {
11780#endif
11781
11782const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v);
11783const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v);
11784bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v);
11785uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v);
Jason Lunn67dee292023-07-13 13:15:26 -070011786UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v);
11787UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011788const UPB_DESC(EnumValueOptions) *
11789 upb_EnumValueDef_Options(const upb_EnumValueDef* v);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011790const UPB_DESC(FeatureSet) *
11791 upb_EnumValueDef_ResolvedFeatures(const upb_EnumValueDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011792
11793#ifdef __cplusplus
11794} /* extern "C" */
11795#endif
11796
11797
11798#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */
11799
Protobuf Team Bot06310352023-09-26 21:54:58 +000011800// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011801
11802#ifndef UPB_REFLECTION_EXTENSION_RANGE_H_
11803#define UPB_REFLECTION_EXTENSION_RANGE_H_
11804
11805
11806// Must be last.
11807
11808#ifdef __cplusplus
11809extern "C" {
11810#endif
11811
11812int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r);
11813int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r);
11814
11815bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011816const UPB_DESC(ExtensionRangeOptions) *
11817 upb_ExtensionRange_Options(const upb_ExtensionRange* r);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011818const UPB_DESC(FeatureSet) *
11819 upb_ExtensionRange_ResolvedFeatures(const upb_ExtensionRange* e);
Eric Salo8809a112022-11-21 13:01:06 -080011820
11821#ifdef __cplusplus
11822} /* extern "C" */
11823#endif
11824
11825
11826#endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */
11827
Protobuf Team Bot06310352023-09-26 21:54:58 +000011828// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011829
11830#ifndef UPB_REFLECTION_FIELD_DEF_H_
11831#define UPB_REFLECTION_FIELD_DEF_H_
11832
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011833#include <stdint.h>
11834
Eric Salo8809a112022-11-21 13:01:06 -080011835
11836// Must be last.
11837
11838// Maximum field number allowed for FieldDefs.
11839// This is an inherent limit of the protobuf wire format.
11840#define kUpb_MaxFieldNumber ((1 << 29) - 1)
11841
11842#ifdef __cplusplus
11843extern "C" {
11844#endif
11845
11846const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011847UPB_API const upb_MessageDef* upb_FieldDef_ContainingType(
11848 const upb_FieldDef* f);
11849UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f);
11850UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f);
11851UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011852const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011853UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011854const char* upb_FieldDef_FullName(const upb_FieldDef* f);
11855bool upb_FieldDef_HasDefault(const upb_FieldDef* f);
11856bool upb_FieldDef_HasJsonName(const upb_FieldDef* f);
11857bool upb_FieldDef_HasOptions(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011858UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011859bool upb_FieldDef_HasSubDef(const upb_FieldDef* f);
11860uint32_t upb_FieldDef_Index(const upb_FieldDef* f);
11861bool upb_FieldDef_IsExtension(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011862UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011863bool upb_FieldDef_IsOptional(const upb_FieldDef* f);
Protobuf Team Botf2c187d2024-01-09 17:58:04 +000011864UPB_API bool upb_FieldDef_IsPacked(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011865bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011866UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011867bool upb_FieldDef_IsRequired(const upb_FieldDef* f);
11868bool upb_FieldDef_IsString(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011869UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
11870UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
11871UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
Protobuf Team Botb361c9c2024-03-22 00:27:43 +000011872uint32_t upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011873UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
Protobuf Team Botb58bd402023-09-19 15:42:34 +000011874bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011875
11876// Creates a mini descriptor string for a field, returns true on success.
11877bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a,
11878 upb_StringView* out);
11879
11880const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011881const upb_MiniTableExtension* upb_FieldDef_MiniTableExtension(
11882 const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011883UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f);
11884UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011885const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011886const UPB_DESC(FeatureSet) *
11887 upb_FieldDef_ResolvedFeatures(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011888UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof(
11889 const upb_FieldDef* f);
11890UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011891
11892#ifdef __cplusplus
11893} /* extern "C" */
11894#endif
11895
11896
11897#endif /* UPB_REFLECTION_FIELD_DEF_H_ */
11898
Protobuf Team Bot06310352023-09-26 21:54:58 +000011899// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011900
11901#ifndef UPB_REFLECTION_FILE_DEF_H_
11902#define UPB_REFLECTION_FILE_DEF_H_
11903
11904
11905// Must be last.
11906
11907#ifdef __cplusplus
11908extern "C" {
11909#endif
11910
Protobuf Team Botc6b149c2023-11-10 23:37:46 +000011911UPB_API const char* upb_FileDef_EditionName(int edition);
11912
Eric Salo8809a112022-11-21 13:01:06 -080011913const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i);
11914int upb_FileDef_DependencyCount(const upb_FileDef* f);
11915bool upb_FileDef_HasOptions(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011916UPB_API const char* upb_FileDef_Name(const upb_FileDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011917const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011918const UPB_DESC(FeatureSet) * upb_FileDef_ResolvedFeatures(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011919const char* upb_FileDef_Package(const upb_FileDef* f);
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000011920UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011921UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011922
11923const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i);
11924int upb_FileDef_PublicDependencyCount(const upb_FileDef* f);
11925
11926const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i);
11927int upb_FileDef_ServiceCount(const upb_FileDef* f);
11928
Jason Lunn67dee292023-07-13 13:15:26 -070011929UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011930
11931const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i);
11932int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f);
11933
11934const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i);
11935int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f);
11936
11937const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i);
11938int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f);
11939
11940const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i);
11941int upb_FileDef_WeakDependencyCount(const upb_FileDef* f);
11942
11943#ifdef __cplusplus
11944} /* extern "C" */
11945#endif
11946
11947
11948#endif /* UPB_REFLECTION_FILE_DEF_H_ */
11949
Protobuf Team Bot06310352023-09-26 21:54:58 +000011950// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011951
11952#ifndef UPB_REFLECTION_MESSAGE_DEF_H_
11953#define UPB_REFLECTION_MESSAGE_DEF_H_
11954
11955
11956// Must be last.
11957
11958// Well-known field tag numbers for map-entry messages.
11959#define kUpb_MapEntry_KeyFieldNumber 1
11960#define kUpb_MapEntry_ValueFieldNumber 2
11961
11962// Well-known field tag numbers for Any messages.
11963#define kUpb_Any_TypeFieldNumber 1
11964#define kUpb_Any_ValueFieldNumber 2
11965
11966// Well-known field tag numbers for duration messages.
11967#define kUpb_Duration_SecondsFieldNumber 1
11968#define kUpb_Duration_NanosFieldNumber 2
11969
11970// Well-known field tag numbers for timestamp messages.
11971#define kUpb_Timestamp_SecondsFieldNumber 1
11972#define kUpb_Timestamp_NanosFieldNumber 2
11973
11974// All the different kind of well known type messages. For simplicity of check,
11975// number wrappers and string wrappers are grouped together. Make sure the
11976// order and number of these groups are not changed.
11977typedef enum {
11978 kUpb_WellKnown_Unspecified,
11979 kUpb_WellKnown_Any,
11980 kUpb_WellKnown_FieldMask,
11981 kUpb_WellKnown_Duration,
11982 kUpb_WellKnown_Timestamp,
11983
11984 // number wrappers
11985 kUpb_WellKnown_DoubleValue,
11986 kUpb_WellKnown_FloatValue,
11987 kUpb_WellKnown_Int64Value,
11988 kUpb_WellKnown_UInt64Value,
11989 kUpb_WellKnown_Int32Value,
11990 kUpb_WellKnown_UInt32Value,
11991
11992 // string wrappers
11993 kUpb_WellKnown_StringValue,
11994 kUpb_WellKnown_BytesValue,
11995 kUpb_WellKnown_BoolValue,
11996 kUpb_WellKnown_Value,
11997 kUpb_WellKnown_ListValue,
11998 kUpb_WellKnown_Struct,
11999} upb_WellKnown;
12000
12001#ifdef __cplusplus
12002extern "C" {
12003#endif
12004
12005const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m);
12006
12007const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m,
12008 int i);
12009int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m);
12010
Jason Lunn67dee292023-07-13 13:15:26 -070012011UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m,
12012 int i);
12013UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012014
Jason Lunn67dee292023-07-13 13:15:26 -070012015UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012016
12017// Returns a field by either JSON name or regular proto name.
12018const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
12019 const upb_MessageDef* m, const char* name, size_t size);
12020UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName(
12021 const upb_MessageDef* m, const char* name) {
12022 return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name));
12023}
12024
12025// Lookup of either field or oneof by name. Returns whether either was found.
12026// If the return is true, then the found def will be set, and the non-found
12027// one set to NULL.
Jason Lunn67dee292023-07-13 13:15:26 -070012028UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
12029 const char* name, size_t size,
12030 const upb_FieldDef** f,
12031 const upb_OneofDef** o);
Eric Salo8809a112022-11-21 13:01:06 -080012032UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m,
12033 const char* name,
12034 const upb_FieldDef** f,
12035 const upb_OneofDef** o) {
12036 return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o);
12037}
12038
12039const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m,
12040 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070012041UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080012042 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070012043UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber(
12044 const upb_MessageDef* m, uint32_t i);
Eric Salo8809a112022-11-21 13:01:06 -080012045const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m,
12046 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070012047UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080012048 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070012049UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012050bool upb_MessageDef_HasOptions(const upb_MessageDef* m);
12051bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m);
12052bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m);
12053
12054// Creates a mini descriptor string for a message, returns true on success.
12055bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a,
12056 upb_StringView* out);
12057
Jason Lunn67dee292023-07-13 13:15:26 -070012058UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012059const char* upb_MessageDef_Name(const upb_MessageDef* m);
12060
12061const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i);
12062const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m,
12063 int i);
12064const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m,
12065 int i);
12066
12067int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m);
12068int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m);
12069int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m);
12070
Jason Lunn67dee292023-07-13 13:15:26 -070012071UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m,
12072 int i);
12073UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080012074int upb_MessageDef_RealOneofCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012075
Mike Kruskal232ecf42023-01-14 00:09:40 -080012076const UPB_DESC(MessageOptions) *
12077 upb_MessageDef_Options(const upb_MessageDef* m);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012078const UPB_DESC(FeatureSet) *
12079 upb_MessageDef_ResolvedFeatures(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012080
12081upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i);
12082int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m);
12083
12084const upb_MessageReservedRange* upb_MessageDef_ReservedRange(
12085 const upb_MessageDef* m, int i);
12086int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m);
12087
Jason Lunn67dee292023-07-13 13:15:26 -070012088UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m);
12089UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012090
12091#ifdef __cplusplus
12092} /* extern "C" */
12093#endif
12094
12095
12096#endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */
12097
Protobuf Team Bot06310352023-09-26 21:54:58 +000012098// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012099
12100#ifndef UPB_REFLECTION_METHOD_DEF_H_
12101#define UPB_REFLECTION_METHOD_DEF_H_
12102
12103
12104// Must be last.
12105
12106#ifdef __cplusplus
12107extern "C" {
12108#endif
12109
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012110UPB_API bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012111const char* upb_MethodDef_FullName(const upb_MethodDef* m);
12112bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
12113int upb_MethodDef_Index(const upb_MethodDef* m);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012114UPB_API const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
12115UPB_API const char* upb_MethodDef_Name(const upb_MethodDef* m);
12116UPB_API const UPB_DESC(MethodOptions) *
12117 upb_MethodDef_Options(const upb_MethodDef* m);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012118const UPB_DESC(FeatureSet) *
12119 upb_MethodDef_ResolvedFeatures(const upb_MethodDef* m);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012120UPB_API const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
12121UPB_API bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
12122UPB_API const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012123
12124#ifdef __cplusplus
12125} /* extern "C" */
12126#endif
12127
12128
12129#endif /* UPB_REFLECTION_METHOD_DEF_H_ */
12130
Protobuf Team Bot06310352023-09-26 21:54:58 +000012131// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012132
12133#ifndef UPB_REFLECTION_ONEOF_DEF_H_
12134#define UPB_REFLECTION_ONEOF_DEF_H_
12135
12136
12137// Must be last.
12138
12139#ifdef __cplusplus
12140extern "C" {
12141#endif
12142
Jason Lunn67dee292023-07-13 13:15:26 -070012143UPB_API const upb_MessageDef* upb_OneofDef_ContainingType(
12144 const upb_OneofDef* o);
12145UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i);
12146UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012147const char* upb_OneofDef_FullName(const upb_OneofDef* o);
12148bool upb_OneofDef_HasOptions(const upb_OneofDef* o);
12149uint32_t upb_OneofDef_Index(const upb_OneofDef* o);
12150bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o);
12151const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o,
12152 const char* name);
12153const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o,
12154 const char* name,
12155 size_t size);
12156const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o,
12157 uint32_t num);
Jason Lunn67dee292023-07-13 13:15:26 -070012158UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012159int upb_OneofDef_numfields(const upb_OneofDef* o);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012160const UPB_DESC(OneofOptions*) upb_OneofDef_Options(const upb_OneofDef* o);
12161const UPB_DESC(FeatureSet*)
12162 upb_OneofDef_ResolvedFeatures(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012163
12164#ifdef __cplusplus
12165} /* extern "C" */
12166#endif
12167
12168
12169#endif /* UPB_REFLECTION_ONEOF_DEF_H_ */
12170
Protobuf Team Bot06310352023-09-26 21:54:58 +000012171// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012172
12173#ifndef UPB_REFLECTION_SERVICE_DEF_H_
12174#define UPB_REFLECTION_SERVICE_DEF_H_
12175
12176
12177// Must be last.
12178
12179#ifdef __cplusplus
12180extern "C" {
12181#endif
12182
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012183UPB_API const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012184const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
12185 const char* name);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012186UPB_API const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012187bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
12188int upb_ServiceDef_Index(const upb_ServiceDef* s);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012189UPB_API const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s,
12190 int i);
12191UPB_API int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012192const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
Protobuf Team Bot312240c2024-03-22 17:47:13 +000012193UPB_API const UPB_DESC(ServiceOptions) *
Mike Kruskal232ecf42023-01-14 00:09:40 -080012194 upb_ServiceDef_Options(const upb_ServiceDef* s);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012195const UPB_DESC(FeatureSet) *
12196 upb_ServiceDef_ResolvedFeatures(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012197
12198#ifdef __cplusplus
12199} /* extern "C" */
12200#endif
12201
12202
12203#endif /* UPB_REFLECTION_SERVICE_DEF_H_ */
Protobuf Team Botffc56ba2023-09-08 15:29:06 +000012204// IWYU pragma: end_exports
Eric Salo8809a112022-11-21 13:01:06 -080012205
12206#endif /* UPB_REFLECTION_DEF_H_ */
12207
12208// Must be last.
12209
12210#ifdef __cplusplus
12211extern "C" {
12212#endif
12213
12214enum { upb_JsonDecode_IgnoreUnknown = 1 };
12215
Jason Lunn67dee292023-07-13 13:15:26 -070012216UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
12217 const upb_MessageDef* m, const upb_DefPool* symtab,
12218 int options, upb_Arena* arena, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080012219
12220#ifdef __cplusplus
12221} /* extern "C" */
12222#endif
12223
12224
12225#endif /* UPB_JSONDECODE_H_ */
12226
12227#ifndef UPB_LEX_ATOI_H_
12228#define UPB_LEX_ATOI_H_
12229
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012230#include <stdint.h>
12231
Eric Salo8809a112022-11-21 13:01:06 -080012232// Must be last.
12233
12234#ifdef __cplusplus
12235extern "C" {
12236#endif
12237
12238// We use these hand-written routines instead of strto[u]l() because the "long
12239// long" variants aren't in c89. Also our version allows setting a ptr limit.
12240// Return the new position of the pointer after parsing the int, or NULL on
12241// integer overflow.
12242
12243const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val);
12244const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
12245 bool* is_neg);
12246
12247#ifdef __cplusplus
12248} /* extern "C" */
12249#endif
12250
12251
12252#endif /* UPB_LEX_ATOI_H_ */
12253
12254#ifndef UPB_LEX_UNICODE_H_
12255#define UPB_LEX_UNICODE_H_
12256
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012257#include <stdint.h>
12258
Eric Salo8809a112022-11-21 13:01:06 -080012259// Must be last.
12260
12261#ifdef __cplusplus
12262extern "C" {
12263#endif
12264
12265// Returns true iff a codepoint is the value for a high surrogate.
12266UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) {
12267 return (cp >= 0xd800 && cp <= 0xdbff);
12268}
12269
12270// Returns true iff a codepoint is the value for a low surrogate.
12271UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) {
12272 return (cp >= 0xdc00 && cp <= 0xdfff);
12273}
12274
12275// Returns the high 16-bit surrogate value for a supplementary codepoint.
12276// Does not sanity-check the input.
12277UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) {
12278 return (cp >> 10) + 0xd7c0;
12279}
12280
12281// Returns the low 16-bit surrogate value for a supplementary codepoint.
12282// Does not sanity-check the input.
12283UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) {
12284 return (cp & 0x3ff) | 0xdc00;
12285}
12286
12287// Returns the 32-bit value corresponding to a pair of 16-bit surrogates.
12288// Does not sanity-check the input.
12289UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) {
12290 return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000;
12291}
12292
12293// Outputs a codepoint as UTF8.
12294// Returns the number of bytes written (1-4 on success, 0 on error).
12295// Does not sanity-check the input. Specifically does not check for surrogates.
12296int upb_Unicode_ToUTF8(uint32_t cp, char* out);
12297
12298#ifdef __cplusplus
12299} /* extern "C" */
12300#endif
12301
12302
12303#endif /* UPB_LEX_UNICODE_H_ */
12304
12305#ifndef UPB_REFLECTION_MESSAGE_H_
12306#define UPB_REFLECTION_MESSAGE_H_
12307
Protobuf Team Bot473d20d2023-09-15 22:27:16 +000012308#include <stddef.h>
12309
Eric Salo8809a112022-11-21 13:01:06 -080012310
12311// Must be last.
12312
12313#ifdef __cplusplus
12314extern "C" {
12315#endif
12316
Eric Salo3f36a912022-12-05 14:12:25 -080012317// Returns a mutable pointer to a map, array, or submessage value. If the given
12318// arena is non-NULL this will construct a new object if it was not previously
12319// present. May not be called for primitive fields.
Jason Lunn67dee292023-07-13 13:15:26 -070012320UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg,
12321 const upb_FieldDef* f,
12322 upb_Arena* a);
Eric Salo8809a112022-11-21 13:01:06 -080012323
Eric Salo3f36a912022-12-05 14:12:25 -080012324// Returns the field that is set in the oneof, or NULL if none are set.
Jason Lunn67dee292023-07-13 13:15:26 -070012325UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
12326 const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012327
Eric Salo3f36a912022-12-05 14:12:25 -080012328// Clear all data and unknown fields.
12329void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012330
Eric Salo3f36a912022-12-05 14:12:25 -080012331// Clears any field presence and sets the value back to its default.
Jason Lunn67dee292023-07-13 13:15:26 -070012332UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg,
12333 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012334
Eric Salo3f36a912022-12-05 14:12:25 -080012335// May only be called for fields where upb_FieldDef_HasPresence(f) == true.
Jason Lunn67dee292023-07-13 13:15:26 -070012336UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg,
12337 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012338
Eric Salo3f36a912022-12-05 14:12:25 -080012339// Returns the value in the message associated with this field def.
Jason Lunn67dee292023-07-13 13:15:26 -070012340UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
12341 const upb_FieldDef* f);
Eric Salo3f36a912022-12-05 14:12:25 -080012342
12343// Sets the given field to the given value. For a msg/array/map/string, the
12344// caller must ensure that the target data outlives |msg| (by living either in
12345// the same arena or a different arena that outlives it).
12346//
12347// Returns false if allocation fails.
Jason Lunn67dee292023-07-13 13:15:26 -070012348UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
12349 upb_MessageValue val, upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -080012350
12351// Iterate over present fields.
12352//
12353// size_t iter = kUpb_Message_Begin;
12354// const upb_FieldDef *f;
12355// upb_MessageValue val;
12356// while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) {
12357// process_field(f, val);
12358// }
12359//
12360// If ext_pool is NULL, no extensions will be returned. If the given symtab
12361// returns extensions that don't match what is in this message, those extensions
12362// will be skipped.
Eric Salo8809a112022-11-21 13:01:06 -080012363
12364#define kUpb_Message_Begin -1
Eric Salo3f36a912022-12-05 14:12:25 -080012365
Protobuf Team Bot7e324502024-01-04 18:12:49 +000012366UPB_API bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
12367 const upb_DefPool* ext_pool,
12368 const upb_FieldDef** f, upb_MessageValue* val,
12369 size_t* iter);
Eric Salo8809a112022-11-21 13:01:06 -080012370
Eric Salo3f36a912022-12-05 14:12:25 -080012371// Clears all unknown field data from this message and all submessages.
Jason Lunn67dee292023-07-13 13:15:26 -070012372UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg,
12373 const upb_MessageDef* m, int maxdepth);
Eric Salo8809a112022-11-21 13:01:06 -080012374
12375#ifdef __cplusplus
12376} /* extern "C" */
12377#endif
12378
12379
12380#endif /* UPB_REFLECTION_MESSAGE_H_ */
12381
12382#ifndef UPB_JSON_ENCODE_H_
12383#define UPB_JSON_ENCODE_H_
12384
12385
12386// Must be last.
12387
12388#ifdef __cplusplus
12389extern "C" {
12390#endif
12391
12392enum {
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000012393 /* When set, emits 0/default values. TODO: proto3 only? */
Eric Salo8809a112022-11-21 13:01:06 -080012394 upb_JsonEncode_EmitDefaults = 1 << 0,
12395
12396 /* When set, use normal (snake_case) field names instead of JSON (camelCase)
12397 names. */
12398 upb_JsonEncode_UseProtoNames = 1 << 1,
12399
12400 /* When set, emits enums as their integer values instead of as their names. */
12401 upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2
12402};
12403
12404/* Encodes the given |msg| to JSON format. The message's reflection is given in
Protobuf Team Botad884532023-09-05 18:31:02 +000012405 * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL,
12406 * extensions will not be printed).
Eric Salo8809a112022-11-21 13:01:06 -080012407 *
12408 * Output is placed in the given buffer, and always NULL-terminated. The output
12409 * size (excluding NULL) is returned. This means that a return value >= |size|
12410 * implies that the output was truncated. (These are the same semantics as
12411 * snprintf()). */
Jason Lunn67dee292023-07-13 13:15:26 -070012412UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m,
12413 const upb_DefPool* ext_pool, int options,
12414 char* buf, size_t size, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080012415
12416#ifdef __cplusplus
12417} /* extern "C" */
12418#endif
12419
12420
12421#endif /* UPB_JSONENCODE_H_ */
12422
12423#ifndef UPB_LEX_ROUND_TRIP_H_
12424#define UPB_LEX_ROUND_TRIP_H_
12425
12426// Must be last.
12427
12428// Encodes a float or double that is round-trippable, but as short as possible.
12429// These routines are not fully optimal (not guaranteed to be shortest), but are
12430// short-ish and match the implementation that has been used in protobuf since
12431// the beginning.
12432
12433// The given buffer size must be at least kUpb_RoundTripBufferSize.
12434enum { kUpb_RoundTripBufferSize = 32 };
12435
12436#ifdef __cplusplus
12437extern "C" {
12438#endif
12439
12440void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size);
12441void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size);
12442
12443#ifdef __cplusplus
12444} /* extern "C" */
12445#endif
12446
12447
12448#endif /* UPB_LEX_ROUND_TRIP_H_ */
12449
12450#ifndef UPB_PORT_VSNPRINTF_COMPAT_H_
12451#define UPB_PORT_VSNPRINTF_COMPAT_H_
12452
12453// Must be last.
12454
12455UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt,
12456 va_list ap) {
12457#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
12458 // The msvc runtime has a non-conforming vsnprintf() that requires the
12459 // following compatibility code to become conformant.
12460 int n = -1;
12461 if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap);
12462 if (n == -1) n = _vscprintf(fmt, ap);
12463 return n;
12464#else
12465 return vsnprintf(buf, size, fmt, ap);
12466#endif
12467}
12468
12469
12470#endif // UPB_PORT_VSNPRINTF_COMPAT_H_
12471
Eric Salodfb71552023-03-22 12:35:09 -070012472#ifndef UPB_PORT_ATOMIC_H_
12473#define UPB_PORT_ATOMIC_H_
12474
12475
12476#ifdef UPB_USE_C11_ATOMICS
12477
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012478// IWYU pragma: begin_exports
Eric Salodfb71552023-03-22 12:35:09 -070012479#include <stdatomic.h>
12480#include <stdbool.h>
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012481// IWYU pragma: end_exports
Eric Salodfb71552023-03-22 12:35:09 -070012482
Deanna Garciac7d979d2023-04-14 17:22:13 -070012483#define upb_Atomic_Init(addr, val) atomic_init(addr, val)
12484#define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order)
12485#define upb_Atomic_Store(addr, val, order) \
12486 atomic_store_explicit(addr, val, order)
12487#define upb_Atomic_Add(addr, val, order) \
12488 atomic_fetch_add_explicit(addr, val, order)
12489#define upb_Atomic_Sub(addr, val, order) \
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070012490 atomic_fetch_sub_explicit(addr, val, order)
12491#define upb_Atomic_Exchange(addr, val, order) \
12492 atomic_exchange_explicit(addr, val, order)
Deanna Garciac7d979d2023-04-14 17:22:13 -070012493#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
12494 success_order, failure_order) \
12495 atomic_compare_exchange_strong_explicit(addr, expected, desired, \
12496 success_order, failure_order)
12497#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
12498 failure_order) \
12499 atomic_compare_exchange_weak_explicit(addr, expected, desired, \
12500 success_order, failure_order)
Eric Salodfb71552023-03-22 12:35:09 -070012501
12502#else // !UPB_USE_C11_ATOMICS
12503
Deanna Garciac7d979d2023-04-14 17:22:13 -070012504#include <string.h>
Eric Salodfb71552023-03-22 12:35:09 -070012505
Deanna Garciac7d979d2023-04-14 17:22:13 -070012506#define upb_Atomic_Init(addr, val) (*addr = val)
12507#define upb_Atomic_Load(addr, order) (*addr)
12508#define upb_Atomic_Store(addr, val, order) (*(addr) = val)
12509#define upb_Atomic_Add(addr, val, order) (*(addr) += val)
12510#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val)
Eric Salodfb71552023-03-22 12:35:09 -070012511
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070012512UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) {
12513 void* old;
12514 memcpy(&old, addr, sizeof(value));
12515 memcpy(addr, &value, sizeof(value));
12516 return old;
12517}
12518
12519#define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val)
12520
Deanna Garciac7d979d2023-04-14 17:22:13 -070012521// `addr` and `expected` are logically double pointers.
12522UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
12523 void* expected,
12524 void* desired) {
12525 if (memcmp(addr, expected, sizeof(desired)) == 0) {
12526 memcpy(addr, &desired, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070012527 return true;
12528 } else {
Deanna Garciac7d979d2023-04-14 17:22:13 -070012529 memcpy(expected, addr, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070012530 return false;
12531 }
12532}
12533
Deanna Garciac7d979d2023-04-14 17:22:13 -070012534#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
12535 success_order, failure_order) \
12536 _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \
12537 (void*)desired)
12538#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
12539 failure_order) \
12540 upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0)
12541
Eric Salodfb71552023-03-22 12:35:09 -070012542#endif
12543
12544
12545#endif // UPB_PORT_ATOMIC_H_
12546
Protobuf Team Bot95d7dc02023-12-13 04:09:17 +000012547#ifndef UPB_MESSAGE_COMPAT_H_
12548#define UPB_MESSAGE_COMPAT_H_
12549
12550#include <stdint.h>
12551
12552
12553// Must be last.
12554
12555// upb does not support mixing minitables from different sources but these
12556// functions are still used by some existing users so for now we make them
12557// available here. This may or may not change in the future so do not add
12558// them to new code.
12559
12560#ifdef __cplusplus
12561extern "C" {
12562#endif
12563
Protobuf Team Bot64441a22024-01-23 23:46:32 +000012564const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
12565 const upb_Message* msg, size_t index);
Protobuf Team Botf2845222023-12-19 04:57:32 +000012566
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012567// Returns the minitable with the given field number, or NULL on failure.
12568const upb_MiniTableExtension* upb_Message_FindExtensionByNumber(
12569 const upb_Message* msg, uint32_t field_number);
Protobuf Team Bot95d7dc02023-12-13 04:09:17 +000012570
12571#ifdef __cplusplus
12572} /* extern "C" */
12573#endif
12574
12575
12576#endif /* UPB_MESSAGE_COMPAT_H_ */
12577
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012578// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
12579
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012580#ifndef UPB_MESSAGE_INTERNAL_MAP_SORTER_H_
12581#define UPB_MESSAGE_INTERNAL_MAP_SORTER_H_
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012582
12583#include <stdlib.h>
12584
12585
Protobuf Team Botc12c96e2024-01-16 07:41:08 +000012586#ifndef UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
12587#define UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012588
12589#include <stdint.h>
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012590
12591
12592// Map entries aren't actually stored for map fields, they are only used during
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012593// parsing. (It helps a lot if all map entry messages have the same layout.)
12594// The mini_table layout code will ensure that all map entries have this layout.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012595//
12596// Note that users can and do create map entries directly, which will also use
12597// this layout.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012598
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012599typedef struct {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012600 struct upb_Message message;
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012601 // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
12602 // and the uint64_t helps make this clear.
12603 uint64_t hasbits;
12604 union {
12605 upb_StringView str; // For str/bytes.
12606 upb_value val; // For all other types.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012607 double d[2]; // Padding for 32-bit builds.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012608 } k;
12609 union {
12610 upb_StringView str; // For str/bytes.
12611 upb_value val; // For all other types.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012612 double d[2]; // Padding for 32-bit builds.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012613 } v;
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012614} upb_MapEntry;
12615
Protobuf Team Botc12c96e2024-01-16 07:41:08 +000012616#endif // UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012617
12618// Must be last.
12619
12620#ifdef __cplusplus
12621extern "C" {
12622#endif
12623
12624// _upb_mapsorter sorts maps and provides ordered iteration over the entries.
12625// Since maps can be recursive (map values can be messages which contain other
12626// maps), _upb_mapsorter can contain a stack of maps.
12627
12628typedef struct {
12629 void const** entries;
12630 int size;
12631 int cap;
12632} _upb_mapsorter;
12633
12634typedef struct {
12635 int start;
12636 int pos;
12637 int end;
12638} _upb_sortedmap;
12639
12640UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) {
12641 s->entries = NULL;
12642 s->size = 0;
12643 s->cap = 0;
12644}
12645
12646UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) {
Protobuf Team Botddc54062023-12-12 20:03:38 +000012647 if (s->entries) upb_gfree(s->entries);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012648}
12649
Protobuf Team Bot499c7482023-12-30 01:42:17 +000012650UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s,
12651 const struct upb_Map* map,
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012652 _upb_sortedmap* sorted, upb_MapEntry* ent) {
12653 if (sorted->pos == sorted->end) return false;
12654 const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++];
12655 upb_StringView key = upb_tabstrview(tabent->key);
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012656 _upb_map_fromkey(key, &ent->k, map->key_size);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012657 upb_value val = {tabent->val.val};
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012658 _upb_map_fromvalue(val, &ent->v, map->val_size);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012659 return true;
12660}
12661
12662UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s,
12663 _upb_sortedmap* sorted,
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012664 const upb_Extension** ext) {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012665 if (sorted->pos == sorted->end) return false;
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012666 *ext = (const upb_Extension*)s->entries[sorted->pos++];
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012667 return true;
12668}
12669
12670UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s,
12671 _upb_sortedmap* sorted) {
12672 s->size = sorted->start;
12673}
12674
12675bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
Protobuf Team Bot499c7482023-12-30 01:42:17 +000012676 const struct upb_Map* map, _upb_sortedmap* sorted);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012677
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012678bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts,
12679 size_t count, _upb_sortedmap* sorted);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012680
12681#ifdef __cplusplus
12682} /* extern "C" */
12683#endif
12684
12685
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012686#endif /* UPB_MESSAGE_INTERNAL_MAP_SORTER_H_ */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012687
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000012688#ifndef UPB_BASE_INTERNAL_LOG2_H_
12689#define UPB_BASE_INTERNAL_LOG2_H_
12690
12691// Must be last.
12692
12693#ifdef __cplusplus
12694extern "C" {
12695#endif
12696
12697UPB_INLINE int upb_Log2Ceiling(int x) {
12698 if (x <= 1) return 0;
12699#ifdef __GNUC__
12700 return 32 - __builtin_clz(x - 1);
12701#else
12702 int lg2 = 0;
12703 while ((1 << lg2) < x) lg2++;
12704 return lg2;
12705#endif
12706}
12707
12708UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
12709
12710#ifdef __cplusplus
12711} /* extern "C" */
12712#endif
12713
12714
12715#endif /* UPB_BASE_INTERNAL_LOG2_H_ */
12716
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012717#ifndef UPB_MESSAGE_COMPARE_H_
12718#define UPB_MESSAGE_COMPARE_H_
12719
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012720#include <stddef.h>
12721
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012722
12723// Must be last.
12724
12725#ifdef __cplusplus
12726extern "C" {
12727#endif
12728
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012729// Returns true if no known fields or extensions are set in the message.
12730UPB_API bool upb_Message_IsEmpty(const upb_Message* msg,
12731 const upb_MiniTable* m);
12732
12733UPB_API bool upb_Message_IsEqual(const upb_Message* msg1,
12734 const upb_Message* msg2,
Protobuf Team Botdb9cc392024-03-11 17:27:18 +000012735 const upb_MiniTable* m, int options);
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012736
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012737// If |ctype| is a message then |m| must point to its minitable.
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012738UPB_API_INLINE bool upb_MessageValue_IsEqual(upb_MessageValue val1,
12739 upb_MessageValue val2,
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012740 upb_CType ctype,
Protobuf Team Botdb9cc392024-03-11 17:27:18 +000012741 const upb_MiniTable* m,
12742 int options) {
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012743 switch (ctype) {
12744 case kUpb_CType_Bool:
12745 return val1.bool_val == val2.bool_val;
12746
12747 case kUpb_CType_Float:
12748 case kUpb_CType_Int32:
12749 case kUpb_CType_UInt32:
12750 case kUpb_CType_Enum:
12751 return val1.int32_val == val2.int32_val;
12752
12753 case kUpb_CType_Double:
12754 case kUpb_CType_Int64:
12755 case kUpb_CType_UInt64:
12756 return val1.int64_val == val2.int64_val;
12757
12758 case kUpb_CType_String:
12759 case kUpb_CType_Bytes:
12760 return upb_StringView_IsEqual(val1.str_val, val2.str_val);
12761
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012762 case kUpb_CType_Message:
Protobuf Team Botdb9cc392024-03-11 17:27:18 +000012763 return upb_Message_IsEqual(val1.msg_val, val2.msg_val, m, options);
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012764
12765 default:
12766 UPB_UNREACHABLE();
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012767 return false;
12768 }
12769}
12770
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012771#ifdef __cplusplus
12772} /* extern "C" */
12773#endif
12774
12775
12776#endif // UPB_MESSAGE_COMPARE_H_
12777
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012778#ifndef UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
12779#define UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
12780
12781#include <stddef.h>
12782
12783// Must be last.
12784
12785#ifdef __cplusplus
12786extern "C" {
12787#endif
12788
12789// Returns true if unknown fields from the two messages are equal when sorted
12790// and varints are made canonical.
12791//
12792// This function is discouraged, as the comparison is inherently lossy without
12793// schema data:
12794//
12795// 1. We don't know whether delimited fields are sub-messages. Unknown
12796// sub-messages will therefore not have their fields sorted and varints
12797// canonicalized.
12798// 2. We don't know about oneof/non-repeated fields, which should semantically
12799// discard every value except the last.
12800
12801typedef enum {
12802 kUpb_UnknownCompareResult_Equal = 0,
12803 kUpb_UnknownCompareResult_NotEqual = 1,
12804 kUpb_UnknownCompareResult_OutOfMemory = 2,
12805 kUpb_UnknownCompareResult_MaxDepthExceeded = 3,
12806} upb_UnknownCompareResult;
12807
12808upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(
12809 const char* buf1, size_t size1, const char* buf2, size_t size2,
12810 int max_depth);
12811
12812#ifdef __cplusplus
12813} /* extern "C" */
12814#endif
12815
12816
12817#endif /* UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_ */
12818
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012819#ifndef UPB_MESSAGE_COPY_H_
12820#define UPB_MESSAGE_COPY_H_
12821
12822
12823// Must be last.
12824
12825#ifdef __cplusplus
12826extern "C" {
12827#endif
12828
12829// Deep clones a message using the provided target arena.
12830upb_Message* upb_Message_DeepClone(const upb_Message* msg,
12831 const upb_MiniTable* m, upb_Arena* arena);
12832
12833// Shallow clones a message using the provided target arena.
12834upb_Message* upb_Message_ShallowClone(const upb_Message* msg,
12835 const upb_MiniTable* m, upb_Arena* arena);
12836
12837// Deep clones array contents.
12838upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type,
12839 const upb_MiniTable* sub, upb_Arena* arena);
12840
12841// Deep clones map contents.
12842upb_Map* upb_Map_DeepClone(const upb_Map* map, upb_CType key_type,
12843 upb_CType value_type,
12844 const upb_MiniTable* map_entry_table,
12845 upb_Arena* arena);
12846
12847// Deep copies the message from src to dst.
12848bool upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
12849 const upb_MiniTable* m, upb_Arena* arena);
12850
12851// Shallow copies the message from src to dst.
12852void upb_Message_ShallowCopy(upb_Message* dst, const upb_Message* src,
12853 const upb_MiniTable* m);
12854
12855#ifdef __cplusplus
12856} /* extern "C" */
12857#endif
12858
12859
12860#endif // UPB_MESSAGE_COPY_H_
12861
Adam Cozzette8059da22023-08-16 07:57:14 -070012862#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12863#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12864
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012865#include <stdint.h>
12866
Adam Cozzette8059da22023-08-16 07:57:14 -070012867
12868// Must be last.
12869
12870#ifdef __cplusplus
12871extern "C" {
12872#endif
12873
12874UPB_INLINE char _upb_ToBase92(int8_t ch) {
12875 extern const char _kUpb_ToBase92[];
12876 UPB_ASSERT(0 <= ch && ch < 92);
12877 return _kUpb_ToBase92[ch];
12878}
12879
12880UPB_INLINE char _upb_FromBase92(uint8_t ch) {
12881 extern const int8_t _kUpb_FromBase92[];
12882 if (' ' > ch || ch > '~') return -1;
12883 return _kUpb_FromBase92[ch - ' '];
12884}
12885
12886UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr,
12887 const char* end, char first_ch,
12888 uint8_t min, uint8_t max,
12889 uint32_t* out_val) {
12890 uint32_t val = 0;
12891 uint32_t shift = 0;
12892 const int bits_per_char =
12893 upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min));
12894 char ch = first_ch;
12895 while (1) {
12896 uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min);
12897 val |= bits << shift;
12898 if (ptr == end || *ptr < min || max < *ptr) {
12899 *out_val = val;
12900 UPB_ASSUME(ptr != NULL);
12901 return ptr;
12902 }
12903 ch = *ptr++;
12904 shift += bits_per_char;
12905 if (shift >= 32) return NULL;
12906 }
12907}
12908
12909#ifdef __cplusplus
12910} /* extern "C" */
12911#endif
12912
12913
12914#endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12915
Protobuf Team Bot91cfce92023-11-27 21:05:28 +000012916#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12917#define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12918
12919
Adam Cozzette8059da22023-08-16 07:57:14 -070012920// Must be last.
12921
12922// upb_MdDecoder: used internally for decoding MiniDescriptors for messages,
12923// extensions, and enums.
12924typedef struct {
12925 const char* end;
12926 upb_Status* status;
12927 jmp_buf err;
12928} upb_MdDecoder;
12929
12930UPB_PRINTF(2, 3)
12931UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d,
12932 const char* fmt, ...) {
12933 if (d->status) {
12934 va_list argp;
12935 upb_Status_SetErrorMessage(d->status, "Error building mini table: ");
12936 va_start(argp, fmt);
12937 upb_Status_VAppendErrorFormat(d->status, fmt, argp);
12938 va_end(argp);
12939 }
12940 UPB_LONGJMP(d->err, 1);
12941}
12942
12943UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d,
12944 const void* ptr) {
12945 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory");
12946}
12947
12948UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint(
12949 upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max,
12950 uint32_t* out_val) {
12951 ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val);
12952 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint");
12953 return ptr;
12954}
12955
12956
12957#endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12958
12959#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12960#define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12961
12962
12963// Must be last.
12964
12965typedef enum {
12966 kUpb_EncodedType_Double = 0,
12967 kUpb_EncodedType_Float = 1,
12968 kUpb_EncodedType_Fixed32 = 2,
12969 kUpb_EncodedType_Fixed64 = 3,
12970 kUpb_EncodedType_SFixed32 = 4,
12971 kUpb_EncodedType_SFixed64 = 5,
12972 kUpb_EncodedType_Int32 = 6,
12973 kUpb_EncodedType_UInt32 = 7,
12974 kUpb_EncodedType_SInt32 = 8,
12975 kUpb_EncodedType_Int64 = 9,
12976 kUpb_EncodedType_UInt64 = 10,
12977 kUpb_EncodedType_SInt64 = 11,
12978 kUpb_EncodedType_OpenEnum = 12,
12979 kUpb_EncodedType_Bool = 13,
12980 kUpb_EncodedType_Bytes = 14,
12981 kUpb_EncodedType_String = 15,
12982 kUpb_EncodedType_Group = 16,
12983 kUpb_EncodedType_Message = 17,
12984 kUpb_EncodedType_ClosedEnum = 18,
12985
12986 kUpb_EncodedType_RepeatedBase = 20,
12987} upb_EncodedType;
12988
12989typedef enum {
12990 kUpb_EncodedFieldModifier_FlipPacked = 1 << 0,
12991 kUpb_EncodedFieldModifier_IsRequired = 1 << 1,
12992 kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012993 kUpb_EncodedFieldModifier_FlipValidateUtf8 = 1 << 3,
Adam Cozzette8059da22023-08-16 07:57:14 -070012994} upb_EncodedFieldModifier;
12995
12996enum {
12997 kUpb_EncodedValue_MinField = ' ',
12998 kUpb_EncodedValue_MaxField = 'I',
12999 kUpb_EncodedValue_MinModifier = 'L',
13000 kUpb_EncodedValue_MaxModifier = '[',
13001 kUpb_EncodedValue_End = '^',
13002 kUpb_EncodedValue_MinSkip = '_',
13003 kUpb_EncodedValue_MaxSkip = '~',
13004 kUpb_EncodedValue_OneofSeparator = '~',
13005 kUpb_EncodedValue_FieldSeparator = '|',
13006 kUpb_EncodedValue_MinOneofField = ' ',
13007 kUpb_EncodedValue_MaxOneofField = 'b',
13008 kUpb_EncodedValue_MaxEnumMask = 'A',
13009};
13010
13011enum {
13012 kUpb_EncodedVersion_EnumV1 = '!',
13013 kUpb_EncodedVersion_ExtensionV1 = '#',
13014 kUpb_EncodedVersion_MapV1 = '%',
13015 kUpb_EncodedVersion_MessageV1 = '$',
13016 kUpb_EncodedVersion_MessageSetV1 = '&',
13017};
13018
13019
13020#endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
13021
13022#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
13023#define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
13024
13025// Must be last.
13026
13027typedef enum {
13028 kUpb_FieldModifier_IsRepeated = 1 << 0,
13029 kUpb_FieldModifier_IsPacked = 1 << 1,
13030 kUpb_FieldModifier_IsClosedEnum = 1 << 2,
13031 kUpb_FieldModifier_IsProto3Singular = 1 << 3,
13032 kUpb_FieldModifier_IsRequired = 1 << 4,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000013033 kUpb_FieldModifier_ValidateUtf8 = 1 << 5,
Adam Cozzette8059da22023-08-16 07:57:14 -070013034} kUpb_FieldModifier;
13035
Protobuf Team Botb58bd402023-09-19 15:42:34 +000013036// These modifiers are also used on the wire.
Adam Cozzette8059da22023-08-16 07:57:14 -070013037typedef enum {
13038 kUpb_MessageModifier_ValidateUtf8 = 1 << 0,
13039 kUpb_MessageModifier_DefaultIsPacked = 1 << 1,
13040 kUpb_MessageModifier_IsExtendable = 1 << 2,
13041} kUpb_MessageModifier;
13042
13043
13044#endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
13045
Protobuf Team Botc4a7b032023-12-27 00:12:48 +000013046#ifndef UPB_MINI_TABLE_COMPAT_H_
13047#define UPB_MINI_TABLE_COMPAT_H_
13048
13049
13050// Must be last.
13051
13052// upb does not support mixing minitables from different sources but these
13053// functions are still used by some existing users so for now we make them
13054// available here. This may or may not change in the future so do not add
13055// them to new code.
13056
13057#ifdef __cplusplus
13058extern "C" {
13059#endif
13060
13061// Checks if memory layout of src is compatible with dst.
13062bool upb_MiniTable_Compatible(const upb_MiniTable* src,
13063 const upb_MiniTable* dst);
13064
13065typedef enum {
13066 kUpb_MiniTableEquals_NotEqual,
13067 kUpb_MiniTableEquals_Equal,
13068 kUpb_MiniTableEquals_OutOfMemory,
13069} upb_MiniTableEquals_Status;
13070
13071// Checks equality of mini tables originating from different language runtimes.
13072upb_MiniTableEquals_Status upb_MiniTable_Equals(const upb_MiniTable* src,
13073 const upb_MiniTable* dst);
13074
13075#ifdef __cplusplus
13076} /* extern "C" */
13077#endif
13078
13079
13080#endif /* UPB_MINI_TABLE_COMPAT_H_ */
13081
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013082#ifndef UPB_HASH_INT_TABLE_H_
13083#define UPB_HASH_INT_TABLE_H_
13084
13085
13086// Must be last.
13087
13088typedef struct {
13089 upb_table t; // For entries that don't fit in the array part.
13090 const upb_tabval* array; // Array part of the table. See const note above.
13091 size_t array_size; // Array part size.
13092 size_t array_count; // Array part number of elements.
13093} upb_inttable;
13094
13095#ifdef __cplusplus
13096extern "C" {
13097#endif
13098
13099// Initialize a table. If memory allocation failed, false is returned and
13100// the table is uninitialized.
13101bool upb_inttable_init(upb_inttable* table, upb_Arena* a);
13102
13103// Returns the number of values in the table.
13104size_t upb_inttable_count(const upb_inttable* t);
13105
13106// Inserts the given key into the hashtable with the given value.
13107// The key must not already exist in the hash table.
13108// The value must not be UINTPTR_MAX.
13109//
13110// If a table resize was required but memory allocation failed, false is
13111// returned and the table is unchanged.
13112bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val,
13113 upb_Arena* a);
13114
13115// Looks up key in this table, returning "true" if the key was found.
13116// If v is non-NULL, copies the value for this key into *v.
13117bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v);
13118
13119// Removes an item from the table. Returns true if the remove was successful,
13120// and stores the removed item in *val if non-NULL.
13121bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val);
13122
13123// Updates an existing entry in an inttable.
13124// If the entry does not exist, returns false and does nothing.
13125// Unlike insert/remove, this does not invalidate iterators.
13126bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val);
13127
13128// Optimizes the table for the current set of entries, for both memory use and
13129// lookup time. Client should call this after all entries have been inserted;
13130// inserting more entries is legal, but will likely require a table resize.
13131void upb_inttable_compact(upb_inttable* t, upb_Arena* a);
13132
13133// Iteration over inttable:
13134//
13135// intptr_t iter = UPB_INTTABLE_BEGIN;
13136// uintptr_t key;
13137// upb_value val;
13138// while (upb_inttable_next(t, &key, &val, &iter)) {
13139// // ...
13140// }
13141
13142#define UPB_INTTABLE_BEGIN -1
13143
13144bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val,
13145 intptr_t* iter);
13146void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter);
13147
13148#ifdef __cplusplus
13149} /* extern "C" */
13150#endif
13151
13152
13153#endif /* UPB_HASH_INT_TABLE_H_ */
13154
13155#ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_
13156#define UPB_WIRE_INTERNAL_CONSTANTS_H_
13157
13158#define kUpb_WireFormat_DefaultDepthLimit 100
13159
13160// MessageSet wire format is:
13161// message MessageSet {
13162// repeated group Item = 1 {
13163// required int32 type_id = 2;
13164// required bytes message = 3;
13165// }
13166// }
13167
13168enum {
13169 kUpb_MsgSet_Item = 1,
13170 kUpb_MsgSet_TypeId = 2,
13171 kUpb_MsgSet_Message = 3,
13172};
13173
13174#endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */
13175
13176/*
13177 * Internal implementation details of the decoder that are shared between
13178 * decode.c and decode_fast.c.
13179 */
13180
13181#ifndef UPB_WIRE_INTERNAL_DECODER_H_
13182#define UPB_WIRE_INTERNAL_DECODER_H_
13183
13184#include "utf8_range.h"
13185
13186// Must be last.
13187
13188#define DECODE_NOGROUP (uint32_t) - 1
13189
13190typedef struct upb_Decoder {
13191 upb_EpsCopyInputStream input;
13192 const upb_ExtensionRegistry* extreg;
13193 const char* unknown; // Start of unknown data, preserve at buffer flip
13194 upb_Message* unknown_msg; // Pointer to preserve data to
13195 int depth; // Tracks recursion depth to bound stack usage.
13196 uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP.
13197 uint16_t options;
13198 bool missing_required;
13199 union {
13200 upb_Arena arena;
13201 void* foo[UPB_ARENA_SIZE_HACK];
13202 };
13203 upb_DecodeStatus status;
13204 jmp_buf err;
13205
13206#ifndef NDEBUG
13207 const char* debug_tagstart;
13208 const char* debug_valstart;
13209#endif
13210} upb_Decoder;
13211
13212/* Error function that will abort decoding with longjmp(). We can't declare this
13213 * UPB_NORETURN, even though it is appropriate, because if we do then compilers
13214 * will "helpfully" refuse to tailcall to it
13215 * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
13216 * of our optimizations. That is also why we must declare it in a separate file,
13217 * otherwise the compiler will see that it calls longjmp() and deduce that it is
13218 * noreturn. */
13219const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status);
13220
13221extern const uint8_t upb_utf8_offsets[];
13222
13223UPB_INLINE
13224bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) {
13225 return utf8_range_IsValid(ptr, len);
13226}
13227
13228const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr,
13229 const upb_Message* msg,
13230 const upb_MiniTable* m);
13231
13232/* x86-64 pointers always have the high 16 bits matching. So we can shift
13233 * left 8 and right 8 without loss of information. */
13234UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) {
13235 return ((intptr_t)tablep << 8) | tablep->UPB_PRIVATE(table_mask);
13236}
13237
13238UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) {
13239 return (const upb_MiniTable*)(table >> 8);
13240}
13241
13242const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
13243 const char* ptr, int overrun);
13244
13245UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) {
13246 return upb_EpsCopyInputStream_IsDoneWithCallback(
13247 &d->input, ptr, &_upb_Decoder_IsDoneFallback);
13248}
13249
13250UPB_INLINE const char* _upb_Decoder_BufferFlipCallback(
13251 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) {
13252 upb_Decoder* d = (upb_Decoder*)e;
13253 if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
13254
13255 if (d->unknown) {
13256 if (!UPB_PRIVATE(_upb_Message_AddUnknown)(
13257 d->unknown_msg, d->unknown, old_end - d->unknown, &d->arena)) {
13258 _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
13259 }
13260 d->unknown = new_start;
13261 }
13262 return new_start;
13263}
13264
13265#if UPB_FASTTABLE
13266UPB_INLINE
13267const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr,
13268 upb_Message* msg, intptr_t table,
13269 uint64_t hasbits, uint64_t tag) {
13270 const upb_MiniTable* table_p = decode_totablep(table);
13271 uint8_t mask = table;
13272 uint64_t data;
13273 size_t idx = tag & mask;
13274 UPB_ASSUME((idx & 7) == 0);
13275 idx >>= 3;
13276 data = table_p->UPB_PRIVATE(fasttable)[idx].field_data ^ tag;
13277 UPB_MUSTTAIL return table_p->UPB_PRIVATE(fasttable)[idx].field_parser(
13278 d, ptr, msg, table, hasbits, data);
13279}
13280#endif
13281
13282UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) {
13283 uint16_t tag;
13284 memcpy(&tag, ptr, 2);
13285 return tag;
13286}
13287
13288
13289#endif /* UPB_WIRE_INTERNAL_DECODER_H_ */
13290
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013291#ifndef UPB_WIRE_READER_H_
13292#define UPB_WIRE_READER_H_
13293
13294
13295#ifndef UPB_WIRE_INTERNAL_READER_H_
13296#define UPB_WIRE_INTERNAL_READER_H_
13297
13298// Must be last.
13299
13300#define kUpb_WireReader_WireTypeBits 3
13301#define kUpb_WireReader_WireTypeMask 7
13302
13303typedef struct {
13304 const char* ptr;
13305 uint64_t val;
13306} UPB_PRIVATE(_upb_WireReader_LongVarint);
13307
13308#ifdef __cplusplus
13309extern "C" {
13310#endif
13311
13312UPB_PRIVATE(_upb_WireReader_LongVarint)
13313UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(const char* ptr, uint64_t val);
13314
Protobuf Team Bot1d143b52024-01-25 20:29:43 +000013315UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)(
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013316 const char* ptr, uint64_t* val, int maxlen, uint64_t maxval) {
13317 uint64_t byte = (uint8_t)*ptr;
13318 if (UPB_LIKELY((byte & 0x80) == 0)) {
13319 *val = (uint32_t)byte;
13320 return ptr + 1;
13321 }
13322 const char* start = ptr;
13323 UPB_PRIVATE(_upb_WireReader_LongVarint)
13324 res = UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(ptr, byte);
13325 if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) ||
13326 res.val > maxval) {
13327 return NULL; // Malformed.
13328 }
13329 *val = res.val;
13330 return res.ptr;
13331}
13332
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013333UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013334 return tag >> kUpb_WireReader_WireTypeBits;
13335}
13336
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013337UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013338 return tag & kUpb_WireReader_WireTypeMask;
13339}
13340
13341#ifdef __cplusplus
13342} /* extern "C" */
13343#endif
13344
13345
13346#endif // UPB_WIRE_INTERNAL_READER_H_
13347
13348#ifndef UPB_WIRE_TYPES_H_
13349#define UPB_WIRE_TYPES_H_
13350
13351// A list of types as they are encoded on the wire.
13352typedef enum {
13353 kUpb_WireType_Varint = 0,
13354 kUpb_WireType_64Bit = 1,
13355 kUpb_WireType_Delimited = 2,
13356 kUpb_WireType_StartGroup = 3,
13357 kUpb_WireType_EndGroup = 4,
13358 kUpb_WireType_32Bit = 5
13359} upb_WireType;
13360
13361#endif /* UPB_WIRE_TYPES_H_ */
13362
13363// Must be last.
13364
13365// The upb_WireReader interface is suitable for general-purpose parsing of
13366// protobuf binary wire format. It is designed to be used along with
13367// upb_EpsCopyInputStream for buffering, and all parsing routines in this file
13368// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is
13369// available to read without any bounds checks.
13370
13371#ifdef __cplusplus
13372extern "C" {
13373#endif
13374
13375// Parses a tag into `tag`, and returns a pointer past the end of the tag, or
13376// NULL if there was an error in the tag data.
13377//
13378// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13379// Bounds checks must be performed before calling this function, preferably
13380// by calling upb_EpsCopyInputStream_IsDone().
Protobuf Team Bot1d143b52024-01-25 20:29:43 +000013381UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
13382 uint32_t* tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013383 uint64_t val;
13384 ptr = UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, &val, 5, UINT32_MAX);
13385 if (!ptr) return NULL;
13386 *tag = val;
13387 return ptr;
13388}
13389
13390// Given a tag, returns the field number.
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013391UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013392
13393// Given a tag, returns the wire type.
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013394UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013395
13396UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr,
13397 uint64_t* val) {
13398 return UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, val, 10, UINT64_MAX);
13399}
13400
13401// Skips data for a varint, returning a pointer past the end of the varint, or
13402// NULL if there was an error in the varint data.
13403//
13404// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13405// Bounds checks must be performed before calling this function, preferably
13406// by calling upb_EpsCopyInputStream_IsDone().
13407UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) {
13408 uint64_t val;
13409 return upb_WireReader_ReadVarint(ptr, &val);
13410}
13411
13412// Reads a varint indicating the size of a delimited field into `size`, or
13413// NULL if there was an error in the varint data.
13414//
13415// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13416// Bounds checks must be performed before calling this function, preferably
13417// by calling upb_EpsCopyInputStream_IsDone().
13418UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) {
13419 uint64_t size64;
13420 ptr = upb_WireReader_ReadVarint(ptr, &size64);
13421 if (!ptr || size64 >= INT32_MAX) return NULL;
13422 *size = size64;
13423 return ptr;
13424}
13425
13426// Reads a fixed32 field, performing byte swapping if necessary.
13427//
13428// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
13429// Bounds checks must be performed before calling this function, preferably
13430// by calling upb_EpsCopyInputStream_IsDone().
13431UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) {
13432 uint32_t uval;
13433 memcpy(&uval, ptr, 4);
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +000013434 uval = upb_BigEndian32(uval);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013435 memcpy(val, &uval, 4);
13436 return ptr + 4;
13437}
13438
13439// Reads a fixed64 field, performing byte swapping if necessary.
13440//
13441// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
13442// Bounds checks must be performed before calling this function, preferably
13443// by calling upb_EpsCopyInputStream_IsDone().
13444UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) {
13445 uint64_t uval;
13446 memcpy(&uval, ptr, 8);
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +000013447 uval = upb_BigEndian64(uval);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013448 memcpy(val, &uval, 8);
13449 return ptr + 8;
13450}
13451
13452const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)(
13453 const char* ptr, uint32_t tag, int depth_limit,
13454 upb_EpsCopyInputStream* stream);
13455
13456// Skips data for a group, returning a pointer past the end of the group, or
13457// NULL if there was an error parsing the group. The `tag` argument should be
13458// the start group tag that begins the group. The `depth_limit` argument
13459// indicates how many levels of recursion the group is allowed to have before
13460// reporting a parse error (this limit exists to protect against stack
13461// overflow).
13462//
13463// TODO: evaluate how the depth_limit should be specified. Do users need
13464// control over this?
13465UPB_INLINE const char* upb_WireReader_SkipGroup(
13466 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
13467 return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, 100, stream);
13468}
13469
13470UPB_INLINE const char* _upb_WireReader_SkipValue(
13471 const char* ptr, uint32_t tag, int depth_limit,
13472 upb_EpsCopyInputStream* stream) {
13473 switch (upb_WireReader_GetWireType(tag)) {
13474 case kUpb_WireType_Varint:
13475 return upb_WireReader_SkipVarint(ptr);
13476 case kUpb_WireType_32Bit:
13477 return ptr + 4;
13478 case kUpb_WireType_64Bit:
13479 return ptr + 8;
13480 case kUpb_WireType_Delimited: {
13481 int size;
13482 ptr = upb_WireReader_ReadSize(ptr, &size);
13483 if (!ptr) return NULL;
13484 ptr += size;
13485 return ptr;
13486 }
13487 case kUpb_WireType_StartGroup:
13488 return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, depth_limit,
13489 stream);
13490 case kUpb_WireType_EndGroup:
13491 return NULL; // Should be handled before now.
13492 default:
13493 return NULL; // Unknown wire type.
13494 }
13495}
13496
13497// Skips data for a wire value of any type, returning a pointer past the end of
13498// the data, or NULL if there was an error parsing the group. The `tag` argument
13499// should be the tag that was just parsed. The `depth_limit` argument indicates
13500// how many levels of recursion a group is allowed to have before reporting a
13501// parse error (this limit exists to protect against stack overflow).
13502//
13503// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13504// Bounds checks must be performed before calling this function, preferably
13505// by calling upb_EpsCopyInputStream_IsDone().
13506//
13507// TODO: evaluate how the depth_limit should be specified. Do users need
13508// control over this?
13509UPB_INLINE const char* upb_WireReader_SkipValue(
13510 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
13511 return _upb_WireReader_SkipValue(ptr, tag, 100, stream);
13512}
13513
13514#ifdef __cplusplus
13515} /* extern "C" */
13516#endif
13517
13518
13519#endif // UPB_WIRE_READER_H_
13520
13521#ifndef UPB_LEX_STRTOD_H_
13522#define UPB_LEX_STRTOD_H_
13523
13524// Must be last.
13525
13526#ifdef __cplusplus
13527extern "C" {
13528#endif
13529
13530double _upb_NoLocaleStrtod(const char *str, char **endptr);
13531
13532#ifdef __cplusplus
13533} /* extern "C" */
13534#endif
13535
13536
13537#endif /* UPB_LEX_STRTOD_H_ */
13538
13539#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
13540#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
13541
13542#include <stdint.h>
13543
13544
13545// Must be last.
13546
13547// If the input buffer has at least this many bytes available, the encoder call
13548// is guaranteed to succeed (as long as field number order is maintained).
13549#define kUpb_MtDataEncoder_MinSize 16
13550
13551typedef struct {
13552 char* end; // Limit of the buffer passed as a parameter.
13553 // Aliased to internal-only members in .cc.
13554 char internal[32];
13555} upb_MtDataEncoder;
13556
13557#ifdef __cplusplus
13558extern "C" {
13559#endif
13560
13561// Encodes field/oneof information for a given message. The sequence of calls
13562// should look like:
13563//
13564// upb_MtDataEncoder e;
13565// char buf[256];
13566// char* ptr = buf;
13567// e.end = ptr + sizeof(buf);
13568// unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero
13569// ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod);
13570// // Fields *must* be in field number order.
13571// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13572// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13573// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13574//
13575// // If oneofs are present. Oneofs must be encoded after regular fields.
13576// ptr = upb_MiniTable_StartOneof(&e, ptr)
13577// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13578// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13579//
13580// ptr = upb_MiniTable_StartOneof(&e, ptr);
13581// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13582// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13583//
13584// Oneofs must be encoded after all regular fields.
13585char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr,
13586 uint64_t msg_mod);
13587char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr,
13588 upb_FieldType type, uint32_t field_num,
13589 uint64_t field_mod);
13590char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr);
13591char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr,
13592 uint32_t field_num);
13593
13594// Encodes the set of values for a given enum. The values must be given in
13595// order (after casting to uint32_t), and repeats are not allowed.
13596char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr);
13597char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr,
13598 uint32_t val);
13599char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr);
13600
13601// Encodes an entire mini descriptor for an extension.
13602char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr,
13603 upb_FieldType type, uint32_t field_num,
13604 uint64_t field_mod);
13605
13606// Encodes an entire mini descriptor for a map.
13607char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr,
13608 upb_FieldType key_type,
13609 upb_FieldType value_type, uint64_t key_mod,
13610 uint64_t value_mod);
13611
13612// Encodes an entire mini descriptor for a message set.
13613char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr);
13614
13615#ifdef __cplusplus
13616} /* extern "C" */
13617#endif
13618
13619
13620#endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */
13621
Eric Salo8809a112022-11-21 13:01:06 -080013622#ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_
13623#define UPB_REFLECTION_DEF_POOL_INTERNAL_H_
13624
13625
13626// Must be last.
13627
13628#ifdef __cplusplus
13629extern "C" {
13630#endif
13631
13632upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s);
13633size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s);
13634upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s);
13635
13636bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext,
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013637 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080013638bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v,
13639 upb_Status* status);
13640bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size,
13641 upb_value* v);
13642
13643void** _upb_DefPool_ScratchData(const upb_DefPool* s);
13644size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080013645void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform);
Eric Salo8809a112022-11-21 13:01:06 -080013646
13647// For generated code only: loads a generated descriptor.
13648typedef struct _upb_DefPool_Init {
13649 struct _upb_DefPool_Init** deps; // Dependencies of this file.
13650 const upb_MiniTableFile* layout;
13651 const char* filename;
13652 upb_StringView descriptor; // Serialized descriptor.
13653} _upb_DefPool_Init;
13654
13655bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init);
13656
13657// Should only be directly called by tests. This variant lets us suppress
13658// the use of compiled-in tables, forcing a rebuild of the tables at runtime.
13659bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init,
13660 bool rebuild_minitable);
13661
13662#ifdef __cplusplus
13663} /* extern "C" */
13664#endif
13665
13666
13667#endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */
13668
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000013669#ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
13670#define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
13671
13672
Eric Salo8809a112022-11-21 13:01:06 -080013673// Must be last.
13674
13675// We want to copy the options verbatim into the destination options proto.
13676// We use serialize+parse as our deep copy.
Mike Kruskal232ecf42023-01-14 00:09:40 -080013677#define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \
13678 if (UPB_DESC(desc_type##_has_options)(proto)) { \
13679 size_t size; \
13680 char* pb = UPB_DESC(options_type##_serialize)( \
13681 UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \
13682 if (!pb) _upb_DefBuilder_OomErr(ctx); \
13683 target = \
13684 UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \
13685 if (!target) _upb_DefBuilder_OomErr(ctx); \
13686 } else { \
13687 target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \
Eric Salo8809a112022-11-21 13:01:06 -080013688 }
13689
13690#ifdef __cplusplus
13691extern "C" {
13692#endif
13693
13694struct upb_DefBuilder {
13695 upb_DefPool* symtab;
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013696 upb_strtable feature_cache; // Caches features by identity.
13697 UPB_DESC(FeatureSet*) legacy_features; // For computing legacy features.
13698 char* tmp_buf; // Temporary buffer in tmp_arena.
13699 size_t tmp_buf_size; // Size of temporary buffer.
Eric Salo8809a112022-11-21 13:01:06 -080013700 upb_FileDef* file; // File we are building.
13701 upb_Arena* arena; // Allocate defs here.
13702 upb_Arena* tmp_arena; // For temporary allocations.
13703 upb_Status* status; // Record errors here.
13704 const upb_MiniTableFile* layout; // NULL if we should build layouts.
Mike Kruskal232ecf42023-01-14 00:09:40 -080013705 upb_MiniTablePlatform platform; // Platform we are targeting.
Eric Salo8809a112022-11-21 13:01:06 -080013706 int enum_count; // Count of enums built so far.
13707 int msg_count; // Count of messages built so far.
13708 int ext_count; // Count of extensions built so far.
13709 jmp_buf err; // longjmp() on error.
13710};
13711
13712extern const char* kUpbDefOptDefault;
13713
13714// ctx->status has already been set elsewhere so just fail/longjmp()
13715UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx);
13716
13717UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt,
13718 ...) UPB_PRINTF(2, 3);
13719UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx);
13720
13721const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx,
13722 const char* prefix,
13723 upb_StringView name);
13724
13725// Given a symbol and the base symbol inside which it is defined,
13726// find the symbol's definition.
13727const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx,
13728 const char* from_name_dbg,
13729 const char* base, upb_StringView sym,
13730 upb_deftype_t* type);
13731
13732const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx,
13733 const char* from_name_dbg, const char* base,
13734 upb_StringView sym, upb_deftype_t type);
13735
13736char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f,
13737 const char** src, const char* end);
13738
13739const char* _upb_DefBuilder_FullToShort(const char* fullname);
13740
13741UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) {
13742 if (bytes == 0) return NULL;
13743 void* ret = upb_Arena_Malloc(ctx->arena, bytes);
13744 if (!ret) _upb_DefBuilder_OomErr(ctx);
13745 return ret;
13746}
13747
13748// Adds a symbol |v| to the symtab, which must be a def pointer previously
13749// packed with pack_def(). The def's pointer to upb_FileDef* must be set before
13750// adding, so we know which entries to remove if building this file fails.
13751UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name,
13752 upb_value v) {
13753 upb_StringView sym = {.data = name, .size = strlen(name)};
13754 bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status);
13755 if (!ok) _upb_DefBuilder_FailJmp(ctx);
13756}
13757
13758UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) {
13759 return ctx->arena;
13760}
13761
13762UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) {
13763 return ctx->file;
13764}
13765
13766// This version of CheckIdent() is only called by other, faster versions after
13767// they detect a parsing error.
13768void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name,
13769 bool full);
13770
Eric Salo8809a112022-11-21 13:01:06 -080013771// Verify a full identifier string. This is slightly more complicated than
13772// verifying a relative identifier string because we must track '.' chars.
13773UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx,
13774 upb_StringView name) {
13775 bool good = name.size > 0;
13776 bool start = true;
13777
13778 for (size_t i = 0; i < name.size; i++) {
13779 const char c = name.data[i];
13780 const char d = c | 0x20; // force lowercase
13781 const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_');
13782 const bool is_numer = ('0' <= c) & (c <= '9') & !start;
13783 const bool is_dot = (c == '.') & !start;
13784
13785 good &= is_alpha | is_numer | is_dot;
13786 start = is_dot;
13787 }
13788
13789 if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true);
13790}
13791
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013792// Returns true if the returned feature set is new and must be populated.
13793bool _upb_DefBuilder_GetOrCreateFeatureSet(upb_DefBuilder* ctx,
13794 const UPB_DESC(FeatureSet*) parent,
13795 upb_StringView key,
13796 UPB_DESC(FeatureSet**) set);
13797
13798const UPB_DESC(FeatureSet*)
13799 _upb_DefBuilder_DoResolveFeatures(upb_DefBuilder* ctx,
13800 const UPB_DESC(FeatureSet*) parent,
13801 const UPB_DESC(FeatureSet*) child,
13802 bool is_implicit);
13803
13804UPB_INLINE const UPB_DESC(FeatureSet*)
13805 _upb_DefBuilder_ResolveFeatures(upb_DefBuilder* ctx,
13806 const UPB_DESC(FeatureSet*) parent,
13807 const UPB_DESC(FeatureSet*) child) {
13808 return _upb_DefBuilder_DoResolveFeatures(ctx, parent, child, false);
13809}
13810
Eric Salo8809a112022-11-21 13:01:06 -080013811#ifdef __cplusplus
13812} /* extern "C" */
13813#endif
13814
13815
13816#endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */
13817
13818#ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
13819#define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
13820
13821
13822// Must be last.
13823
13824#ifdef __cplusplus
13825extern "C" {
13826#endif
13827
13828upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i);
13829bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a);
13830const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e);
13831
13832// Allocate and initialize an array of |n| enum defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013833upb_EnumDef* _upb_EnumDefs_New(upb_DefBuilder* ctx, int n,
13834 const UPB_DESC(EnumDescriptorProto*)
13835 const* protos,
13836 const UPB_DESC(FeatureSet*) parent_features,
13837 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080013838
13839#ifdef __cplusplus
13840} /* extern "C" */
13841#endif
13842
13843
13844#endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */
13845
13846#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
13847#define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
13848
13849
13850// Must be last.
13851
13852#ifdef __cplusplus
13853extern "C" {
13854#endif
13855
13856upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i);
13857
13858// Allocate and initialize an array of |n| enum value defs owned by |e|.
13859upb_EnumValueDef* _upb_EnumValueDefs_New(
13860 upb_DefBuilder* ctx, const char* prefix, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013861 const UPB_DESC(EnumValueDescriptorProto*) const* protos,
13862 const UPB_DESC(FeatureSet*) parent_features, upb_EnumDef* e,
Eric Salo8809a112022-11-21 13:01:06 -080013863 bool* is_sorted);
13864
13865const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v,
13866 int n, upb_Arena* a);
13867
13868#ifdef __cplusplus
13869} /* extern "C" */
13870#endif
13871
13872
13873#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */
13874
13875#ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
13876#define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
13877
13878
13879// Must be last.
13880
13881#ifdef __cplusplus
13882extern "C" {
13883#endif
13884
13885upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i);
13886
Eric Salo8809a112022-11-21 13:01:06 -080013887bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f);
13888bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f);
13889int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
13890uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f);
13891void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix,
13892 upb_FieldDef* f);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013893void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx,
13894 const upb_FieldDef* f);
13895
13896// Allocate and initialize an array of |n| extensions (field defs).
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013897upb_FieldDef* _upb_Extensions_New(upb_DefBuilder* ctx, int n,
13898 const UPB_DESC(FieldDescriptorProto*)
13899 const* protos,
13900 const UPB_DESC(FeatureSet*) parent_features,
13901 const char* prefix, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080013902
13903// Allocate and initialize an array of |n| field defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013904upb_FieldDef* _upb_FieldDefs_New(upb_DefBuilder* ctx, int n,
13905 const UPB_DESC(FieldDescriptorProto*)
13906 const* protos,
13907 const UPB_DESC(FeatureSet*) parent_features,
13908 const char* prefix, upb_MessageDef* m,
13909 bool* is_sorted);
Eric Salo8809a112022-11-21 13:01:06 -080013910
13911// Allocate and return a list of pointers to the |n| field defs in |ff|,
13912// sorted by field number.
13913const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n,
13914 upb_Arena* a);
13915
13916#ifdef __cplusplus
13917} /* extern "C" */
13918#endif
13919
13920
13921#endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */
13922
13923#ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_
13924#define UPB_REFLECTION_FILE_DEF_INTERNAL_H_
13925
13926
13927// Must be last.
13928
13929#ifdef __cplusplus
13930extern "C" {
13931#endif
13932
13933const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable(
13934 const upb_FileDef* f, int i);
13935const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f);
13936const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f);
13937
13938// upb_FileDef_Package() returns "" if f->package is NULL, this does not.
13939const char* _upb_FileDef_RawPackage(const upb_FileDef* f);
13940
13941void _upb_FileDef_Create(upb_DefBuilder* ctx,
Mike Kruskal232ecf42023-01-14 00:09:40 -080013942 const UPB_DESC(FileDescriptorProto) * file_proto);
Eric Salo8809a112022-11-21 13:01:06 -080013943
13944#ifdef __cplusplus
13945} /* extern "C" */
13946#endif
13947
13948
13949#endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */
13950
13951#ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
13952#define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
13953
13954
13955// Must be last.
13956
13957#ifdef __cplusplus
13958extern "C" {
13959#endif
13960
13961upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i);
13962bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m);
13963bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size,
13964 upb_value v, upb_Arena* a);
13965void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
13966 const upb_FieldDef* f);
13967bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013968void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080013969void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx,
13970 const upb_MessageDef* m);
13971void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m);
13972
13973// Allocate and initialize an array of |n| message defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013974upb_MessageDef* _upb_MessageDefs_New(upb_DefBuilder* ctx, int n,
13975 const UPB_DESC(DescriptorProto*)
13976 const* protos,
13977 const UPB_DESC(FeatureSet*)
13978 parent_features,
13979 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080013980
13981#ifdef __cplusplus
13982} /* extern "C" */
13983#endif
13984
13985
13986#endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */
13987
13988#ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
13989#define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
13990
13991
13992// Must be last.
13993
13994#ifdef __cplusplus
13995extern "C" {
13996#endif
13997
13998upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i);
13999
14000// Allocate and initialize an array of |n| service defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014001upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
14002 const UPB_DESC(ServiceDescriptorProto*)
14003 const* protos,
14004 const UPB_DESC(FeatureSet*)
14005 parent_features);
Eric Salo8809a112022-11-21 13:01:06 -080014006
14007#ifdef __cplusplus
14008} /* extern "C" */
14009#endif
14010
14011
14012#endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */
14013
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014014#ifndef UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
14015#define UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
14016
14017// This file contains the serialized FeatureSetDefaults object for
14018// language-independent features and (possibly at some point) for upb-specific
14019// features. This is used for feature resolution under Editions.
14020// NOLINTBEGIN
14021// clang-format off
Protobuf Team Bot5b8b87f2023-11-30 05:12:08 +000014022#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 +000014023// clang-format on
14024// NOLINTEND
14025
14026#endif // UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
14027
Eric Salo8809a112022-11-21 13:01:06 -080014028#ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_
14029#define UPB_REFLECTION_DESC_STATE_INTERNAL_H_
14030
14031
14032// Must be last.
14033
14034// Manages the storage for mini descriptor strings as they are being encoded.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000014035// TODO: Move some of this state directly into the encoder, maybe.
Eric Salo8809a112022-11-21 13:01:06 -080014036typedef struct {
14037 upb_MtDataEncoder e;
14038 size_t bufsize;
14039 char* buf;
14040 char* ptr;
14041} upb_DescState;
14042
14043#ifdef __cplusplus
14044extern "C" {
14045#endif
14046
14047UPB_INLINE void _upb_DescState_Init(upb_DescState* d) {
14048 d->bufsize = kUpb_MtDataEncoder_MinSize * 2;
14049 d->buf = NULL;
14050 d->ptr = NULL;
14051}
14052
14053bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a);
14054
14055#ifdef __cplusplus
14056} /* extern "C" */
14057#endif
14058
14059
14060#endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */
14061
14062#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
14063#define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
14064
14065
Protobuf Team Bot06310352023-09-26 21:54:58 +000014066// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080014067
14068#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
14069#define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
14070
14071
14072// Must be last.
14073
14074#ifdef __cplusplus
14075extern "C" {
14076#endif
14077
14078int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r);
14079int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r);
14080
14081#ifdef __cplusplus
14082} /* extern "C" */
14083#endif
14084
14085
14086#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */
14087
14088// Must be last.
14089
14090#ifdef __cplusplus
14091extern "C" {
14092#endif
14093
14094upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r,
14095 int i);
14096
14097// Allocate and initialize an array of |n| reserved ranges owned by |e|.
14098upb_EnumReservedRange* _upb_EnumReservedRanges_New(
14099 upb_DefBuilder* ctx, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014100 const UPB_DESC(EnumDescriptorProto_EnumReservedRange*) const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080014101 const upb_EnumDef* e);
14102
14103#ifdef __cplusplus
14104} /* extern "C" */
14105#endif
14106
14107
14108#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */
14109
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000014110#ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_
14111#define UPB_REFLECTION_INTERNAL_STRDUP2_H_
14112
14113#include <stddef.h>
14114
14115
14116// Must be last.
14117
14118#ifdef __cplusplus
14119extern "C" {
14120#endif
14121
14122// Variant that works with a length-delimited rather than NULL-delimited string,
14123// as supported by strtable.
14124char* upb_strdup2(const char* s, size_t len, upb_Arena* a);
14125
14126#ifdef __cplusplus
14127} /* extern "C" */
14128#endif
14129
14130
14131#endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */
14132
Eric Salo8809a112022-11-21 13:01:06 -080014133#ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
14134#define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
14135
14136
14137// Must be last.
14138
14139#ifdef __cplusplus
14140extern "C" {
14141#endif
14142
14143upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i);
14144
14145// Allocate and initialize an array of |n| extension ranges owned by |m|.
14146upb_ExtensionRange* _upb_ExtensionRanges_New(
14147 upb_DefBuilder* ctx, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014148 const UPB_DESC(DescriptorProto_ExtensionRange*) const* protos,
14149 const UPB_DESC(FeatureSet*) parent_features, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080014150
14151#ifdef __cplusplus
14152} /* extern "C" */
14153#endif
14154
14155
14156#endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */
14157
14158#ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
14159#define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
14160
14161
14162// Must be last.
14163
14164#ifdef __cplusplus
14165extern "C" {
14166#endif
14167
14168upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070014169void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o,
14170 const upb_FieldDef* f, const char* name, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -080014171
14172// Allocate and initialize an array of |n| oneof defs owned by |m|.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014173upb_OneofDef* _upb_OneofDefs_New(upb_DefBuilder* ctx, int n,
14174 const UPB_DESC(OneofDescriptorProto*)
14175 const* protos,
14176 const UPB_DESC(FeatureSet*) parent_features,
14177 upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080014178
14179size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m);
14180
14181#ifdef __cplusplus
14182} /* extern "C" */
14183#endif
14184
14185
14186#endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */
14187
14188#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
14189#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
14190
14191
Protobuf Team Bot06310352023-09-26 21:54:58 +000014192// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080014193
14194#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
14195#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
14196
14197
14198// Must be last.
14199
14200#ifdef __cplusplus
14201extern "C" {
14202#endif
14203
14204int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r);
14205int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r);
14206
14207#ifdef __cplusplus
14208} /* extern "C" */
14209#endif
14210
14211
14212#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */
14213
14214// Must be last.
14215
14216#ifdef __cplusplus
14217extern "C" {
14218#endif
14219
14220upb_MessageReservedRange* _upb_MessageReservedRange_At(
14221 const upb_MessageReservedRange* r, int i);
14222
14223// Allocate and initialize an array of |n| reserved ranges owned by |m|.
14224upb_MessageReservedRange* _upb_MessageReservedRanges_New(
14225 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080014226 const UPB_DESC(DescriptorProto_ReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080014227 const upb_MessageDef* m);
14228
14229#ifdef __cplusplus
14230} /* extern "C" */
14231#endif
14232
14233
14234#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */
14235
14236#ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
14237#define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
14238
14239
14240// Must be last.
14241
14242#ifdef __cplusplus
14243extern "C" {
14244#endif
14245
14246upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i);
14247
14248// Allocate and initialize an array of |n| method defs owned by |s|.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014249upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n,
14250 const UPB_DESC(MethodDescriptorProto*)
14251 const* protos,
14252 const UPB_DESC(FeatureSet*) parent_features,
14253 upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080014254
14255#ifdef __cplusplus
14256} /* extern "C" */
14257#endif
14258
14259
14260#endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */
14261
Eric Salo8809a112022-11-21 13:01:06 -080014262// This should #undef all macros #defined in def.inc
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014263
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014264#undef UPB_SIZE
14265#undef UPB_PTR_AT
Joshua Habermandd69a482021-05-17 22:40:33 -070014266#undef UPB_MAPTYPE_STRING
Eric Salo3f36a912022-12-05 14:12:25 -080014267#undef UPB_EXPORT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014268#undef UPB_INLINE
Eric Salo3f36a912022-12-05 14:12:25 -080014269#undef UPB_API
14270#undef UPB_API_INLINE
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014271#undef UPB_ALIGN_UP
14272#undef UPB_ALIGN_DOWN
14273#undef UPB_ALIGN_MALLOC
14274#undef UPB_ALIGN_OF
Protobuf Team Bote2785502023-12-21 21:28:36 +000014275#undef UPB_ALIGN_AS
Joshua Habermand3995ec2022-09-30 16:54:39 -070014276#undef UPB_MALLOC_ALIGN
Joshua Habermandd69a482021-05-17 22:40:33 -070014277#undef UPB_LIKELY
14278#undef UPB_UNLIKELY
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014279#undef UPB_FORCEINLINE
14280#undef UPB_NOINLINE
14281#undef UPB_NORETURN
Joshua Habermandd69a482021-05-17 22:40:33 -070014282#undef UPB_PRINTF
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014283#undef UPB_MAX
14284#undef UPB_MIN
14285#undef UPB_UNUSED
14286#undef UPB_ASSUME
14287#undef UPB_ASSERT
14288#undef UPB_UNREACHABLE
Joshua Habermandd69a482021-05-17 22:40:33 -070014289#undef UPB_SETJMP
14290#undef UPB_LONGJMP
14291#undef UPB_PTRADD
14292#undef UPB_MUSTTAIL
14293#undef UPB_FASTTABLE_SUPPORTED
Mike Kruskal232ecf42023-01-14 00:09:40 -080014294#undef UPB_FASTTABLE_MASK
Joshua Habermandd69a482021-05-17 22:40:33 -070014295#undef UPB_FASTTABLE
14296#undef UPB_FASTTABLE_INIT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014297#undef UPB_POISON_MEMORY_REGION
14298#undef UPB_UNPOISON_MEMORY_REGION
14299#undef UPB_ASAN
Sandy Zhange3b09432023-08-07 09:30:02 -070014300#undef UPB_ASAN_GUARD_SIZE
14301#undef UPB_CLANG_ASAN
Protobuf Team Bot5e8d7e52024-03-15 22:28:30 +000014302#undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN
Joshua Habermand3995ec2022-09-30 16:54:39 -070014303#undef UPB_DEPRECATED
14304#undef UPB_GNUC_MIN
Mike Kruskal232ecf42023-01-14 00:09:40 -080014305#undef UPB_DESCRIPTOR_UPB_H_FILENAME
14306#undef UPB_DESC
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014307#undef UPB_DESC_MINITABLE
Mike Kruskal232ecf42023-01-14 00:09:40 -080014308#undef UPB_IS_GOOGLE3
Eric Salodfb71552023-03-22 12:35:09 -070014309#undef UPB_ATOMIC
14310#undef UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -070014311#undef UPB_PRIVATE
Protobuf Team Bot07194fc2023-11-30 05:43:03 +000014312#undef UPB_ONLYBITS