Auto-generate files after cl/626485595
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h
index f88cd1f..76b6af3 100755
--- a/ruby/ext/google/protobuf_c/ruby-upb.h
+++ b/ruby/ext/google/protobuf_c/ruby-upb.h
@@ -1411,6 +1411,7 @@
#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
+#include <stddef.h>
#include <stdint.h>
@@ -1542,18 +1543,9 @@
return &m->UPB_ONLYBITS(fields)[i];
}
-UPB_INLINE const union upb_MiniTableSub* UPB_PRIVATE(
+UPB_INLINE const union upb_MiniTableSub UPB_PRIVATE(
_upb_MiniTable_GetSubByIndex)(const struct upb_MiniTable* m, uint32_t i) {
- return &m->UPB_PRIVATE(subs)[i];
-}
-
-UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_GetSubMessageTable(
- const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
- UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Message);
- const struct upb_MiniTable* ret = upb_MiniTableSub_Message(
- m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
- UPB_ASSUME(ret);
- return UPB_PRIVATE(_upb_MiniTable_IsEmpty)(ret) ? NULL : ret;
+ return m->UPB_PRIVATE(subs)[i];
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_SubMessage(
@@ -1561,15 +1553,34 @@
if (upb_MiniTableField_CType(f) != kUpb_CType_Message) {
return NULL;
}
- return upb_MiniTableSub_Message(
- m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
+ return m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(submsg);
+}
+
+UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_GetSubMessageTable(
+ const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
+ UPB_ASSUME(upb_MiniTableField_CType(f) == kUpb_CType_Message);
+ const struct upb_MiniTable* ret = upb_MiniTable_SubMessage(m, f);
+ UPB_ASSUME(ret);
+ return UPB_PRIVATE(_upb_MiniTable_IsEmpty)(ret) ? NULL : ret;
+}
+
+UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(
+ const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
+ return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
+}
+
+UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_MapEntrySubMessage(
+ const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
+ UPB_ASSERT(upb_MiniTable_FieldIsLinked(m, f)); // Map entries must be linked.
+ UPB_ASSERT(upb_MiniTableField_IsMap(f)); // Function precondition.
+ return upb_MiniTable_SubMessage(m, f);
}
UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Enum);
- return upb_MiniTableSub_Enum(
- m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
+ return m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(
+ subenum);
}
UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapKey(
@@ -1588,11 +1599,6 @@
return f;
}
-UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(
- const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
- return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
-}
-
// Computes a bitmask in which the |m->required_count| lowest bits are set.
//
// Sample output:
@@ -1647,10 +1653,20 @@
UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
const upb_MiniTable* m, const upb_MiniTableField* f);
-// Returns the MiniTable for a message field if it is a submessage.
+// Returns the MiniTable for a message field if it is a submessage, otherwise
+// returns NULL.
+//
+// WARNING: if dynamic tree shaking is in use, the return value may be the
+// "empty", zero-field placeholder message instead of the real message type.
+// If the message is later linked, this function will begin returning the real
+// message type.
UPB_API_INLINE const upb_MiniTable* upb_MiniTable_SubMessage(
const upb_MiniTable* m, const upb_MiniTableField* f);
+// Returns the MiniTable for a map field. The given field must refer to a map.
+UPB_API_INLINE const upb_MiniTable* upb_MiniTable_MapEntrySubMessage(
+ const upb_MiniTable* m, const upb_MiniTableField* f);
+
// Returns the MiniTableEnum for a message field, NULL if the field is unlinked.
UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
const upb_MiniTable* m, const upb_MiniTableField* f);
@@ -3049,12 +3065,6 @@
#endif /* UPB_MESSAGE_MAP_H_ */
-#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
-#define UPB_MINI_TABLE_TAGGED_PTR_H_
-
-#include <stdint.h>
-
-
// Public APIs for message operations that do not depend on the schema.
//
// MiniTable-based accessors live in accessors.h.
@@ -3110,6 +3120,12 @@
#endif /* UPB_MESSAGE_MESSAGE_H_ */
+#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
+#define UPB_MINI_TABLE_TAGGED_PTR_H_
+
+#include <stdint.h>
+
+
// Must be last.
// When a upb_Message* is stored in a message, array, or map, it is stored in a
@@ -3503,8 +3519,6 @@
UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
UPB_ASSUME(upb_MiniTableField_IsScalar(field));
- UPB_ASSERT(upb_MiniTableSub_Message(
- mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]));
upb_Message_SetBaseField(msg, field, &sub_message);
}
@@ -3528,8 +3542,8 @@
upb_Message* sub_message =
*UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*);
if (!sub_message) {
- const upb_MiniTable* sub_mini_table = upb_MiniTableSub_Message(
- mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]);
+ const upb_MiniTable* sub_mini_table =
+ upb_MiniTable_SubMessage(mini_table, field);
UPB_ASSERT(sub_mini_table);
sub_message = _upb_Message_New(sub_mini_table, arena);
*UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*) = sub_message;