|
|
|
@ -20,11 +20,13 @@ |
|
|
|
|
#include "absl/log/absl_check.h" |
|
|
|
|
#include "absl/log/absl_log.h" |
|
|
|
|
#include "absl/strings/escaping.h" |
|
|
|
|
#include "absl/strings/match.h" |
|
|
|
|
#include "absl/strings/str_cat.h" |
|
|
|
|
#include "absl/strings/str_replace.h" |
|
|
|
|
#include "absl/strings/string_view.h" |
|
|
|
|
#include "absl/strings/substitute.h" |
|
|
|
|
#include "upb/base/descriptor_constants.h" |
|
|
|
|
#include "upb/base/status.hpp" |
|
|
|
|
#include "upb/base/string_view.h" |
|
|
|
|
#include "upb/mini_table/field.h" |
|
|
|
|
#include "upb/reflection/def.hpp" |
|
|
|
@ -314,8 +316,7 @@ void GenerateExtensionInHeader(const DefPoolPair& pools, upb::FieldDefPtr ext, |
|
|
|
|
|
|
|
|
|
// Message extensions also have a Msg_mutable_foo() accessor that will
|
|
|
|
|
// create the sub-message if it doesn't already exist.
|
|
|
|
|
if (ext.ctype() == kUpb_CType_Message && |
|
|
|
|
!UPB_DESC(MessageOptions_map_entry)(ext.containing_type().options())) { |
|
|
|
|
if (ext.IsSubMessage()) { |
|
|
|
|
output( |
|
|
|
|
R"cc( |
|
|
|
|
UPB_INLINE struct $0* $1_mutable_$2(struct $3* msg, |
|
|
|
@ -603,8 +604,7 @@ void GenerateGetters(upb::FieldDefPtr field, const DefPoolPair& pools, |
|
|
|
|
const Options& options, Output& output) { |
|
|
|
|
if (field.IsMap()) { |
|
|
|
|
GenerateMapGetters(field, pools, msg_name, field_names, options, output); |
|
|
|
|
} else if (UPB_DESC(MessageOptions_map_entry)( |
|
|
|
|
field.containing_type().options())) { |
|
|
|
|
} else if (field.containing_type().mapentry()) { |
|
|
|
|
GenerateMapEntryGetters(field, msg_name, output); |
|
|
|
|
} else if (field.IsSequence()) { |
|
|
|
|
GenerateRepeatedGetters(field, pools, msg_name, field_names, options, |
|
|
|
@ -773,8 +773,7 @@ void GenerateNonRepeatedSetters(upb::FieldDefPtr field, |
|
|
|
|
|
|
|
|
|
// Message fields also have a Msg_mutable_foo() accessor that will create
|
|
|
|
|
// the sub-message if it doesn't already exist.
|
|
|
|
|
if (field.ctype() == kUpb_CType_Message && |
|
|
|
|
!UPB_DESC(MessageOptions_map_entry)(field.containing_type().options())) { |
|
|
|
|
if (field.IsSubMessage() && !field.containing_type().mapentry()) { |
|
|
|
|
output( |
|
|
|
|
R"cc( |
|
|
|
|
UPB_INLINE struct $0* $1_mutable_$2($1* msg, upb_Arena* arena) { |
|
|
|
@ -811,7 +810,7 @@ void GenerateMessageInHeader(upb::MessageDefPtr message, |
|
|
|
|
Output& output) { |
|
|
|
|
output("/* $0 */\n\n", message.full_name()); |
|
|
|
|
std::string msg_name = ToCIdent(message.full_name()); |
|
|
|
|
if (!UPB_DESC(MessageOptions_map_entry)(message.options())) { |
|
|
|
|
if (!message.mapentry()) { |
|
|
|
|
GenerateMessageFunctionsInHeader(message, options, output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|