diff --git a/upb/message/accessors.h b/upb/message/accessors.h index ebdfa52bef..b0425dbc9c 100644 --- a/upb/message/accessors.h +++ b/upb/message/accessors.h @@ -153,9 +153,8 @@ UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg, int64_t value, upb_Arena* a); UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg, - const upb_MiniTable* m, const upb_MiniTableField* f, - upb_Message* sub_message); + upb_Message* value); UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, const upb_MiniTableField* f, diff --git a/upb/message/accessors_test.cc b/upb/message/accessors_test.cc index b6d8d42667..d14daf2312 100644 --- a/upb/message/accessors_test.cc +++ b/upb/message/accessors_test.cc @@ -329,10 +329,8 @@ TEST(GeneratedCode, SubMessage) { arena)); upb_Message_SetInt32(new_nested_message, nested_message_a_field, 123, nullptr); - upb_Message_SetMessage( - UPB_UPCAST(msg), - &protobuf_0test_0messages__proto2__TestAllTypesProto2_msg_init, - optional_message_field, new_nested_message); + upb_Message_SetMessage(UPB_UPCAST(msg), optional_message_field, + new_nested_message); upb_Message* mutable_message = upb_Message_GetOrCreateMutableMessage( UPB_UPCAST(msg), diff --git a/upb/message/copy_test.cc b/upb/message/copy_test.cc index 8434258cb2..1bdb3a3099 100644 --- a/upb/message/copy_test.cc +++ b/upb/message/copy_test.cc @@ -108,10 +108,8 @@ TEST(GeneratedCode, DeepCloneMessageSubMessage) { source_arena); protobuf_test_messages_proto2_TestAllTypesProto2_NestedMessage_set_a( nested, kTestNestedInt32); - upb_Message_SetMessage( - UPB_UPCAST(msg), - &protobuf_0test_0messages__proto2__TestAllTypesProto2_msg_init, - nested_message_field, UPB_UPCAST(nested)); + upb_Message_SetMessage(UPB_UPCAST(msg), nested_message_field, + UPB_UPCAST(nested)); upb_Arena* arena = upb_Arena_New(); protobuf_test_messages_proto2_TestAllTypesProto2* clone = (protobuf_test_messages_proto2_TestAllTypesProto2*)upb_Message_DeepClone( diff --git a/upb/message/internal/accessors.h b/upb/message/internal/accessors.h index d81ddd7e17..31d3ff8dd3 100644 --- a/upb/message/internal/accessors.h +++ b/upb/message/internal/accessors.h @@ -791,13 +791,12 @@ UPB_API_INLINE bool upb_Message_SetInt64(struct upb_Message* msg, } // Sets the value of a message-typed field. The mini_tables of `msg` and -// `sub_message` must have been linked for this to work correctly. +// `value` must have been linked for this to work correctly. UPB_API_INLINE void upb_Message_SetMessage(struct upb_Message* msg, - const upb_MiniTable* m, const upb_MiniTableField* f, - struct upb_Message* sub_message) { + struct upb_Message* value) { UPB_PRIVATE(_upb_Message_SetTaggedMessagePtr) - (msg, f, UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(sub_message, false)); + (msg, f, UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(value, false)); } // Sets the value of a `string` or `bytes` field. The bytes of the value are not diff --git a/upb/message/promote.c b/upb/message/promote.c index 6496e23a68..566049245a 100644 --- a/upb/message/promote.c +++ b/upb/message/promote.c @@ -188,7 +188,7 @@ upb_DecodeStatus upb_Message_PromoteMessage(upb_Message* parent, upb_Message_PromoteOne(&tagged, sub_table, decode_options, arena); if (ret == kUpb_DecodeStatus_Ok) { *promoted = upb_TaggedMessagePtr_GetNonEmptyMessage(tagged); - upb_Message_SetMessage(parent, mini_table, field, *promoted); + upb_Message_SetMessage(parent, field, *promoted); } return ret; } @@ -280,7 +280,7 @@ upb_UnknownToMessageRet upb_MiniTable_PromoteUnknownToMessage( if (is_oneof) { UPB_PRIVATE(_upb_Message_SetOneofCase)(msg, field); } - upb_Message_SetMessage(msg, mini_table, field, message); + upb_Message_SetMessage(msg, field, message); ret.message = message; } return ret;