WPILibC++ 2027.0.0-alpha-3
Loading...
Searching...
No Matches
tagged_ptr.h
Go to the documentation of this file.
1// Protocol Buffers - Google's data interchange format
2// Copyright 2023 Google LLC. All rights reserved.
3//
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
7
8#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
9#define UPB_MINI_TABLE_TAGGED_PTR_H_
10
11#include <stdint.h>
12
14#include "upb/message/message.h"
15
16// Must be last.
17#include "upb/port/def.inc"
18
19// When a upb_Message* is stored in a message, array, or map, it is stored in a
20// tagged form. If the tag bit is set, the referenced upb_Message is of type
21// _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of
22// that field's true message type. This forms the basis of what we call
23// "dynamic tree shaking."
24//
25// See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for
26// more information.
27
28typedef uintptr_t upb_TaggedMessagePtr;
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34// Users who enable unlinked sub-messages must use this to test whether a
35// message is empty before accessing it. If a message is empty, it must be
36// first promoted using the interfaces in message/promote.h.
38
41
42#ifdef __cplusplus
43} /* extern "C" */
44#endif
45
46#include "upb/port/undef.inc"
47
48#endif /* UPB_MINI_TABLE_TAGGED_PTR_H_ */
#define UPB_API_INLINE
Definition def.inc:163
auto ptr(T p) -> const void *
Converts p to const void* for pointer formatting.
Definition format.h:3963
UPB_API_INLINE struct upb_Message * upb_TaggedMessagePtr_GetNonEmptyMessage(uintptr_t ptr)
Definition tagged_ptr.h:38
UPB_API_INLINE bool upb_TaggedMessagePtr_IsEmpty(uintptr_t ptr)
Definition tagged_ptr.h:29
Definition types.h:18
uintptr_t upb_TaggedMessagePtr
Definition tagged_ptr.h:28