summaryrefslogtreecommitdiff
path: root/upb/msgfactory.c
diff options
context:
space:
mode:
Diffstat (limited to 'upb/msgfactory.c')
-rw-r--r--upb/msgfactory.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/upb/msgfactory.c b/upb/msgfactory.c
index 593c9dc..73347b8 100644
--- a/upb/msgfactory.c
+++ b/upb/msgfactory.c
@@ -1,4 +1,5 @@
+#include "upb/handlers.h"
#include "upb/msgfactory.h"
static bool is_power_of_two(size_t val) {
@@ -45,6 +46,15 @@ static uint8_t upb_msg_fielddefsize(const upb_fielddef *f) {
}
}
+static bool upb_fielddef_haspresence(const upb_fielddef *f) {
+ if (upb_fielddef_isseq(f)) return false;
+ if (upb_fielddef_issubmsg(f)) return true;
+
+ /* Primitive field: return true unless there is a message that specifies
+ * presence should not exist. */
+ return upb_msgdef_syntax(upb_fielddef_containingtype(f)) == UPB_SYNTAX_PROTO2;
+}
+
/** upb_msglayout *************************************************************/
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback