summaryrefslogtreecommitdiff
path: root/upb/msgfactory.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2018-12-08 09:54:09 +0100
committerJoshua Haberman <jhaberman@gmail.com>2018-12-08 09:54:09 +0100
commit14c96a143c63a01c1080a23d9e1c0196d06f0e5e (patch)
treef59388c3d84b175c335581a0f065e2c31d22834a /upb/msgfactory.c
parente77ab811ba3e1ed069822cb5dccb4d643d3e56d3 (diff)
parent35fa3df8ecc3f451af0512e70a03f89ee407c85c (diff)
Merge branch 'cmake-mac-fixes' into defcleanup
Diffstat (limited to 'upb/msgfactory.c')
-rw-r--r--upb/msgfactory.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/upb/msgfactory.c b/upb/msgfactory.c
index 63df49e..73347b8 100644
--- a/upb/msgfactory.c
+++ b/upb/msgfactory.c
@@ -46,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