diff --git a/include/flatbuffers/reflection_generated.h b/include/flatbuffers/reflection_generated.h index 0424d6ae9..fc720599c 100644 --- a/include/flatbuffers/reflection_generated.h +++ b/include/flatbuffers/reflection_generated.h @@ -222,10 +222,12 @@ inline flatbuffers::Offset CreateKeyValueDirect( flatbuffers::FlatBufferBuilder &_fbb, const char *key = nullptr, const char *value = nullptr) { + auto key__ = key ? _fbb.CreateString(key) : 0; + auto value__ = value ? _fbb.CreateString(value) : 0; return reflection::CreateKeyValue( _fbb, - key ? _fbb.CreateString(key) : 0, - value ? _fbb.CreateString(value) : 0); + key__, + value__); } struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { @@ -327,13 +329,15 @@ inline flatbuffers::Offset CreateEnumValDirect( flatbuffers::Offset object = 0, flatbuffers::Offset union_type = 0, const std::vector> *documentation = nullptr) { + auto name__ = name ? _fbb.CreateString(name) : 0; + auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; return reflection::CreateEnumVal( _fbb, - name ? _fbb.CreateString(name) : 0, + name__, value, object, union_type, - documentation ? _fbb.CreateVector>(*documentation) : 0); + documentation__); } struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { @@ -451,14 +455,18 @@ inline flatbuffers::Offset CreateEnumDirect( flatbuffers::Offset underlying_type = 0, const std::vector> *attributes = nullptr, const std::vector> *documentation = nullptr) { + auto name__ = name ? _fbb.CreateString(name) : 0; + auto values__ = values ? _fbb.CreateVector>(*values) : 0; + auto attributes__ = attributes ? _fbb.CreateVector>(*attributes) : 0; + auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; return reflection::CreateEnum( _fbb, - name ? _fbb.CreateString(name) : 0, - values ? _fbb.CreateVector>(*values) : 0, + name__, + values__, is_union, underlying_type, - attributes ? _fbb.CreateVector>(*attributes) : 0, - documentation ? _fbb.CreateVector>(*documentation) : 0); + attributes__, + documentation__); } struct Field FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { @@ -628,9 +636,12 @@ inline flatbuffers::Offset CreateFieldDirect( bool key = false, const std::vector> *attributes = nullptr, const std::vector> *documentation = nullptr) { + auto name__ = name ? _fbb.CreateString(name) : 0; + auto attributes__ = attributes ? _fbb.CreateVector>(*attributes) : 0; + auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; return reflection::CreateField( _fbb, - name ? _fbb.CreateString(name) : 0, + name__, type, id, offset, @@ -639,8 +650,8 @@ inline flatbuffers::Offset CreateFieldDirect( deprecated, required, key, - attributes ? _fbb.CreateVector>(*attributes) : 0, - documentation ? _fbb.CreateVector>(*documentation) : 0); + attributes__, + documentation__); } struct Object FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { @@ -767,15 +778,19 @@ inline flatbuffers::Offset CreateObjectDirect( int32_t bytesize = 0, const std::vector> *attributes = nullptr, const std::vector> *documentation = nullptr) { + auto name__ = name ? _fbb.CreateString(name) : 0; + auto fields__ = fields ? _fbb.CreateVector>(*fields) : 0; + auto attributes__ = attributes ? _fbb.CreateVector>(*attributes) : 0; + auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; return reflection::CreateObject( _fbb, - name ? _fbb.CreateString(name) : 0, - fields ? _fbb.CreateVector>(*fields) : 0, + name__, + fields__, is_struct, minalign, bytesize, - attributes ? _fbb.CreateVector>(*attributes) : 0, - documentation ? _fbb.CreateVector>(*documentation) : 0); + attributes__, + documentation__); } struct RPCCall FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { @@ -881,13 +896,16 @@ inline flatbuffers::Offset CreateRPCCallDirect( flatbuffers::Offset response = 0, const std::vector> *attributes = nullptr, const std::vector> *documentation = nullptr) { + auto name__ = name ? _fbb.CreateString(name) : 0; + auto attributes__ = attributes ? _fbb.CreateVector>(*attributes) : 0; + auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; return reflection::CreateRPCCall( _fbb, - name ? _fbb.CreateString(name) : 0, + name__, request, response, - attributes ? _fbb.CreateVector>(*attributes) : 0, - documentation ? _fbb.CreateVector>(*documentation) : 0); + attributes__, + documentation__); } struct Service FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { @@ -980,12 +998,16 @@ inline flatbuffers::Offset CreateServiceDirect( const std::vector> *calls = nullptr, const std::vector> *attributes = nullptr, const std::vector> *documentation = nullptr) { + auto name__ = name ? _fbb.CreateString(name) : 0; + auto calls__ = calls ? _fbb.CreateVector>(*calls) : 0; + auto attributes__ = attributes ? _fbb.CreateVector>(*attributes) : 0; + auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; return reflection::CreateService( _fbb, - name ? _fbb.CreateString(name) : 0, - calls ? _fbb.CreateVector>(*calls) : 0, - attributes ? _fbb.CreateVector>(*attributes) : 0, - documentation ? _fbb.CreateVector>(*documentation) : 0); + name__, + calls__, + attributes__, + documentation__); } struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { @@ -1097,14 +1119,19 @@ inline flatbuffers::Offset CreateSchemaDirect( const char *file_ext = nullptr, flatbuffers::Offset root_table = 0, const std::vector> *services = nullptr) { + auto objects__ = objects ? _fbb.CreateVector>(*objects) : 0; + auto enums__ = enums ? _fbb.CreateVector>(*enums) : 0; + auto file_ident__ = file_ident ? _fbb.CreateString(file_ident) : 0; + auto file_ext__ = file_ext ? _fbb.CreateString(file_ext) : 0; + auto services__ = services ? _fbb.CreateVector>(*services) : 0; return reflection::CreateSchema( _fbb, - objects ? _fbb.CreateVector>(*objects) : 0, - enums ? _fbb.CreateVector>(*enums) : 0, - file_ident ? _fbb.CreateString(file_ident) : 0, - file_ext ? _fbb.CreateString(file_ext) : 0, + objects__, + enums__, + file_ident__, + file_ext__, root_table, - services ? _fbb.CreateVector>(*services) : 0); + services__); } inline const reflection::Schema *GetSchema(const void *buf) { diff --git a/samples/monster_generated.h b/samples/monster_generated.h index 153eac666..db79c2e5d 100644 --- a/samples/monster_generated.h +++ b/samples/monster_generated.h @@ -408,15 +408,18 @@ inline flatbuffers::Offset CreateMonsterDirect( const std::vector> *weapons = nullptr, Equipment equipped_type = Equipment_NONE, flatbuffers::Offset equipped = 0) { + auto name__ = name ? _fbb.CreateString(name) : 0; + auto inventory__ = inventory ? _fbb.CreateVector(*inventory) : 0; + auto weapons__ = weapons ? _fbb.CreateVector>(*weapons) : 0; return MyGame::Sample::CreateMonster( _fbb, pos, mana, hp, - name ? _fbb.CreateString(name) : 0, - inventory ? _fbb.CreateVector(*inventory) : 0, + name__, + inventory__, color, - weapons ? _fbb.CreateVector>(*weapons) : 0, + weapons__, equipped_type, equipped); } @@ -506,9 +509,10 @@ inline flatbuffers::Offset CreateWeaponDirect( flatbuffers::FlatBufferBuilder &_fbb, const char *name = nullptr, int16_t damage = 0) { + auto name__ = name ? _fbb.CreateString(name) : 0; return MyGame::Sample::CreateWeapon( _fbb, - name ? _fbb.CreateString(name) : 0, + name__, damage); } diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index 4c4cd43d3..f91f14e1f 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -2060,36 +2060,30 @@ class CppGenerator : public BaseGenerator { // Generate a CreateXDirect function with vector types as parameters if (has_string_or_vector_fields) { - code_ += - "inline flatbuffers::Offset<{{STRUCT_NAME}}> " - "Create{{STRUCT_NAME}}Direct("; + code_ += "inline flatbuffers::Offset<{{STRUCT_NAME}}> " + "Create{{STRUCT_NAME}}Direct("; code_ += " flatbuffers::FlatBufferBuilder &_fbb\\"; for (auto it = struct_def.fields.vec.begin(); it != struct_def.fields.vec.end(); ++it) { const auto &field = **it; if (!field.deprecated) { GenParam(field, true, ",\n "); } } - // Need to call "Create" with the struct namespace. const auto qualified_create_name = struct_def.defined_namespace->GetFullyQualifiedName("Create"); code_.SetValue("CREATE_NAME", TranslateNameSpace(qualified_create_name)); - code_ += ") {"; - code_ += " return {{CREATE_NAME}}{{STRUCT_NAME}}("; - code_ += " _fbb\\"; for (auto it = struct_def.fields.vec.begin(); it != struct_def.fields.vec.end(); ++it) { const auto &field = **it; if (!field.deprecated) { code_.SetValue("FIELD_NAME", Name(field)); - if (field.value.type.base_type == BASE_TYPE_STRING) { code_ += - ",\n {{FIELD_NAME}} ? " - "_fbb.CreateString({{FIELD_NAME}}) : 0\\"; + " auto {{FIELD_NAME}}__ = {{FIELD_NAME}} ? " + "_fbb.CreateString({{FIELD_NAME}}) : 0;"; } else if (field.value.type.base_type == BASE_TYPE_VECTOR) { - code_ += ",\n {{FIELD_NAME}} ? \\"; + code_ += " auto {{FIELD_NAME}}__ = {{FIELD_NAME}} ? \\"; const auto vtype = field.value.type.VectorType(); if (IsStruct(vtype)) { const auto type = WrapInNameSpace(*vtype.struct_def); @@ -2098,9 +2092,21 @@ class CppGenerator : public BaseGenerator { const auto type = GenTypeWire(vtype, "", false); code_ += "_fbb.CreateVector<" + type + ">\\"; } - code_ += "(*{{FIELD_NAME}}) : 0\\"; - } else { - code_ += ",\n {{FIELD_NAME}}\\"; + code_ += "(*{{FIELD_NAME}}) : 0;"; + } + } + } + code_ += " return {{CREATE_NAME}}{{STRUCT_NAME}}("; + code_ += " _fbb\\"; + for (auto it = struct_def.fields.vec.begin(); + it != struct_def.fields.vec.end(); ++it) { + const auto &field = **it; + if (!field.deprecated) { + code_.SetValue("FIELD_NAME", Name(field)); + code_ += ",\n {{FIELD_NAME}}\\"; + if (field.value.type.base_type == BASE_TYPE_STRING || + field.value.type.base_type == BASE_TYPE_VECTOR) { + code_ += "__\\"; } } } diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index 919681235..9e9f77c53 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -2652,14 +2652,15 @@ void Parser::Serialize() { service_offsets.push_back(offset); (*it)->serialized_location = offset.o; } - auto schema_offset = reflection::CreateSchema( - builder_, - builder_.CreateVectorOfSortedTables(&object_offsets), - builder_.CreateVectorOfSortedTables(&enum_offsets), - builder_.CreateString(file_identifier_), - builder_.CreateString(file_extension_), - (root_struct_def_ ? root_struct_def_->serialized_location : 0), - builder_.CreateVectorOfSortedTables(&service_offsets)); + auto objs__ = builder_.CreateVectorOfSortedTables(&object_offsets); + auto enum__ = builder_.CreateVectorOfSortedTables(&enum_offsets); + auto fiid__ = builder_.CreateString(file_identifier_); + auto fext__ = builder_.CreateString(file_extension_); + auto serv__ = builder_.CreateVectorOfSortedTables(&service_offsets); + auto schema_offset = + reflection::CreateSchema(builder_, objs__, enum__, fiid__, fext__, + (root_struct_def_ ? root_struct_def_->serialized_location : 0), + serv__); if (opts.size_prefixed) { builder_.FinishSizePrefixed(schema_offset, reflection::SchemaIdentifier()); } else { @@ -2675,49 +2676,49 @@ Offset StructDef::Serialize(FlatBufferBuilder *builder, builder, static_cast(it - fields.vec.begin()), parser)); } auto qualified_name = defined_namespace->GetFullyQualifiedName(name); - return reflection::CreateObject( - *builder, - builder->CreateString(qualified_name), - builder->CreateVectorOfSortedTables(&field_offsets), - fixed, - static_cast(minalign), - static_cast(bytesize), - SerializeAttributes(builder, parser), - parser.opts.binary_schema_comments - ? builder->CreateVectorOfStrings(doc_comment) - : 0); + auto name__ = builder->CreateString(qualified_name); + auto flds__ = builder->CreateVectorOfSortedTables(&field_offsets); + auto attr__ = SerializeAttributes(builder, parser); + auto docs__ = parser.opts.binary_schema_comments + ? builder->CreateVectorOfStrings(doc_comment) + : 0; + return reflection::CreateObject(*builder, name__, flds__, fixed, + static_cast(minalign), + static_cast(bytesize), + attr__, docs__); } Offset FieldDef::Serialize(FlatBufferBuilder *builder, uint16_t id, const Parser &parser) const { - return reflection::CreateField( - *builder, builder->CreateString(name), value.type.Serialize(builder), id, - value.offset, + auto name__ = builder->CreateString(name); + auto type__ = value.type.Serialize(builder); + auto attr__ = SerializeAttributes(builder, parser); + auto docs__ = parser.opts.binary_schema_comments + ? builder->CreateVectorOfStrings(doc_comment) + : 0; + return reflection::CreateField(*builder, name__, type__, id, value.offset, // Is uint64>max(int64) tested? IsInteger(value.type.base_type) ? StringToInt(value.constant.c_str()) : 0, // result may be platform-dependent if underlying is float (not double) IsFloat(value.type.base_type) ? strtod(value.constant.c_str(), nullptr) : 0.0, - deprecated, required, key, SerializeAttributes(builder, parser), - parser.opts.binary_schema_comments - ? builder->CreateVectorOfStrings(doc_comment) - : 0); + deprecated, required, key, attr__, docs__); // TODO: value.constant is almost always "0", we could save quite a bit of // space by sharing it. Same for common values of value.type. } Offset RPCCall::Serialize(FlatBufferBuilder *builder, const Parser &parser) const { - return reflection::CreateRPCCall( - *builder, - builder->CreateString(name), - request->serialized_location, - response->serialized_location, - SerializeAttributes(builder, parser), - parser.opts.binary_schema_comments - ? builder->CreateVectorOfStrings(doc_comment) - : 0); + auto name__ = builder->CreateString(name); + auto attr__ = SerializeAttributes(builder, parser); + auto docs__ = parser.opts.binary_schema_comments + ? builder->CreateVectorOfStrings(doc_comment) + : 0; + return reflection::CreateRPCCall(*builder, name__, + request->serialized_location, + response->serialized_location, + attr__, docs__); } Offset ServiceDef::Serialize(FlatBufferBuilder *builder, @@ -2727,14 +2728,13 @@ Offset ServiceDef::Serialize(FlatBufferBuilder *builder, servicecall_offsets.push_back((*it)->Serialize(builder, parser)); } auto qualified_name = defined_namespace->GetFullyQualifiedName(name); - return reflection::CreateService( - *builder, - builder->CreateString(qualified_name), - builder->CreateVector(servicecall_offsets), - SerializeAttributes(builder, parser), - parser.opts.binary_schema_comments - ? builder->CreateVectorOfStrings(doc_comment) - : 0); + auto name__ = builder->CreateString(qualified_name); + auto call__ = builder->CreateVector(servicecall_offsets); + auto attr__ = SerializeAttributes(builder, parser); + auto docs__ = parser.opts.binary_schema_comments + ? builder->CreateVectorOfStrings(doc_comment) + : 0; + return reflection::CreateService(*builder, name__, call__, attr__, docs__); } Offset EnumDef::Serialize(FlatBufferBuilder *builder, @@ -2744,29 +2744,27 @@ Offset EnumDef::Serialize(FlatBufferBuilder *builder, enumval_offsets.push_back((*it)->Serialize(builder, parser)); } auto qualified_name = defined_namespace->GetFullyQualifiedName(name); - return reflection::CreateEnum( - *builder, - builder->CreateString(qualified_name), - builder->CreateVector(enumval_offsets), - is_union, - underlying_type.Serialize(builder), - SerializeAttributes(builder, parser), - parser.opts.binary_schema_comments - ? builder->CreateVectorOfStrings(doc_comment) - : 0); + auto name__ = builder->CreateString(qualified_name); + auto vals__ = builder->CreateVector(enumval_offsets); + auto type__ = underlying_type.Serialize(builder); + auto attr__ = SerializeAttributes(builder, parser); + auto docs__ = parser.opts.binary_schema_comments + ? builder->CreateVectorOfStrings(doc_comment) + : 0; + return reflection::CreateEnum(*builder, name__, vals__, is_union, type__, + attr__, docs__); } Offset EnumVal::Serialize(FlatBufferBuilder *builder, const Parser &parser) const { - return reflection::CreateEnumVal( - *builder, - builder->CreateString(name), - value, + auto name__ = builder->CreateString(name); + auto type__ = union_type.Serialize(builder); + auto docs__ = parser.opts.binary_schema_comments + ? builder->CreateVectorOfStrings(doc_comment) + : 0; + return reflection::CreateEnumVal(*builder, name__, value, union_type.struct_def ? union_type.struct_def->serialized_location : 0, - union_type.Serialize(builder), - parser.opts.binary_schema_comments - ? builder->CreateVectorOfStrings(doc_comment) - : 0); + type__, docs__); } Offset Type::Serialize(FlatBufferBuilder *builder) const { @@ -2786,9 +2784,9 @@ Definition::SerializeAttributes(FlatBufferBuilder *builder, auto it = parser.known_attributes_.find(kv->first); FLATBUFFERS_ASSERT(it != parser.known_attributes_.end()); if (parser.opts.binary_schema_builtins || !it->second) { - attrs.push_back(reflection::CreateKeyValue( - *builder, builder->CreateString(kv->first), - builder->CreateString(kv->second->constant))); + auto key = builder->CreateString(kv->first); + auto val = builder->CreateString(kv->second->constant); + attrs.push_back(reflection::CreateKeyValue(*builder, key, val)); } } if (attrs.size()) { diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs index c4086e00f..2bfda2195 100644 Binary files a/tests/monster_test.bfbs and b/tests/monster_test.bfbs differ diff --git a/tests/monster_test_generated.h b/tests/monster_test_generated.h index bd3bfde36..ac8babb24 100644 --- a/tests/monster_test_generated.h +++ b/tests/monster_test_generated.h @@ -931,9 +931,10 @@ inline flatbuffers::Offset CreateStatDirect( const char *id = nullptr, int64_t val = 0, uint16_t count = 0) { + auto id__ = id ? _fbb.CreateString(id) : 0; return MyGame::Example::CreateStat( _fbb, - id ? _fbb.CreateString(id) : 0, + id__, val, count); } @@ -1923,21 +1924,40 @@ inline flatbuffers::Offset CreateMonsterDirect( AnyAmbiguousAliases any_ambiguous_type = AnyAmbiguousAliases_NONE, flatbuffers::Offset any_ambiguous = 0, const std::vector *vector_of_enums = nullptr) { + auto name__ = name ? _fbb.CreateString(name) : 0; + auto inventory__ = inventory ? _fbb.CreateVector(*inventory) : 0; + auto test4__ = test4 ? _fbb.CreateVectorOfStructs(*test4) : 0; + auto testarrayofstring__ = testarrayofstring ? _fbb.CreateVector>(*testarrayofstring) : 0; + auto testarrayoftables__ = testarrayoftables ? _fbb.CreateVector>(*testarrayoftables) : 0; + auto testnestedflatbuffer__ = testnestedflatbuffer ? _fbb.CreateVector(*testnestedflatbuffer) : 0; + auto testarrayofbools__ = testarrayofbools ? _fbb.CreateVector(*testarrayofbools) : 0; + auto testarrayofstring2__ = testarrayofstring2 ? _fbb.CreateVector>(*testarrayofstring2) : 0; + auto testarrayofsortedstruct__ = testarrayofsortedstruct ? _fbb.CreateVectorOfStructs(*testarrayofsortedstruct) : 0; + auto flex__ = flex ? _fbb.CreateVector(*flex) : 0; + auto test5__ = test5 ? _fbb.CreateVectorOfStructs(*test5) : 0; + auto vector_of_longs__ = vector_of_longs ? _fbb.CreateVector(*vector_of_longs) : 0; + auto vector_of_doubles__ = vector_of_doubles ? _fbb.CreateVector(*vector_of_doubles) : 0; + auto vector_of_referrables__ = vector_of_referrables ? _fbb.CreateVector>(*vector_of_referrables) : 0; + auto vector_of_weak_references__ = vector_of_weak_references ? _fbb.CreateVector(*vector_of_weak_references) : 0; + auto vector_of_strong_referrables__ = vector_of_strong_referrables ? _fbb.CreateVector>(*vector_of_strong_referrables) : 0; + auto vector_of_co_owning_references__ = vector_of_co_owning_references ? _fbb.CreateVector(*vector_of_co_owning_references) : 0; + auto vector_of_non_owning_references__ = vector_of_non_owning_references ? _fbb.CreateVector(*vector_of_non_owning_references) : 0; + auto vector_of_enums__ = vector_of_enums ? _fbb.CreateVector(*vector_of_enums) : 0; return MyGame::Example::CreateMonster( _fbb, pos, mana, hp, - name ? _fbb.CreateString(name) : 0, - inventory ? _fbb.CreateVector(*inventory) : 0, + name__, + inventory__, color, test_type, test, - test4 ? _fbb.CreateVectorOfStructs(*test4) : 0, - testarrayofstring ? _fbb.CreateVector>(*testarrayofstring) : 0, - testarrayoftables ? _fbb.CreateVector>(*testarrayoftables) : 0, + test4__, + testarrayofstring__, + testarrayoftables__, enemy, - testnestedflatbuffer ? _fbb.CreateVector(*testnestedflatbuffer) : 0, + testnestedflatbuffer__, testempty, testbool, testhashs32_fnv1, @@ -1948,30 +1968,30 @@ inline flatbuffers::Offset CreateMonsterDirect( testhashu32_fnv1a, testhashs64_fnv1a, testhashu64_fnv1a, - testarrayofbools ? _fbb.CreateVector(*testarrayofbools) : 0, + testarrayofbools__, testf, testf2, testf3, - testarrayofstring2 ? _fbb.CreateVector>(*testarrayofstring2) : 0, - testarrayofsortedstruct ? _fbb.CreateVectorOfStructs(*testarrayofsortedstruct) : 0, - flex ? _fbb.CreateVector(*flex) : 0, - test5 ? _fbb.CreateVectorOfStructs(*test5) : 0, - vector_of_longs ? _fbb.CreateVector(*vector_of_longs) : 0, - vector_of_doubles ? _fbb.CreateVector(*vector_of_doubles) : 0, + testarrayofstring2__, + testarrayofsortedstruct__, + flex__, + test5__, + vector_of_longs__, + vector_of_doubles__, parent_namespace_test, - vector_of_referrables ? _fbb.CreateVector>(*vector_of_referrables) : 0, + vector_of_referrables__, single_weak_reference, - vector_of_weak_references ? _fbb.CreateVector(*vector_of_weak_references) : 0, - vector_of_strong_referrables ? _fbb.CreateVector>(*vector_of_strong_referrables) : 0, + vector_of_weak_references__, + vector_of_strong_referrables__, co_owning_reference, - vector_of_co_owning_references ? _fbb.CreateVector(*vector_of_co_owning_references) : 0, + vector_of_co_owning_references__, non_owning_reference, - vector_of_non_owning_references ? _fbb.CreateVector(*vector_of_non_owning_references) : 0, + vector_of_non_owning_references__, any_unique_type, any_unique, any_ambiguous_type, any_ambiguous, - vector_of_enums ? _fbb.CreateVector(*vector_of_enums) : 0); + vector_of_enums__); } flatbuffers::Offset CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); @@ -2229,6 +2249,8 @@ inline flatbuffers::Offset CreateTypeAliasesDirect( double f64 = 0.0, const std::vector *v8 = nullptr, const std::vector *vf64 = nullptr) { + auto v8__ = v8 ? _fbb.CreateVector(*v8) : 0; + auto vf64__ = vf64 ? _fbb.CreateVector(*vf64) : 0; return MyGame::Example::CreateTypeAliases( _fbb, i8, @@ -2241,8 +2263,8 @@ inline flatbuffers::Offset CreateTypeAliasesDirect( u64, f32, f64, - v8 ? _fbb.CreateVector(*v8) : 0, - vf64 ? _fbb.CreateVector(*vf64) : 0); + v8__, + vf64__); } flatbuffers::Offset CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h index 6645ca289..f085bbcb6 100644 --- a/tests/union_vector/union_vector_generated.h +++ b/tests/union_vector/union_vector_generated.h @@ -429,12 +429,14 @@ inline flatbuffers::Offset CreateMovieDirect( flatbuffers::Offset main_character = 0, const std::vector *characters_type = nullptr, const std::vector> *characters = nullptr) { + auto characters_type__ = characters_type ? _fbb.CreateVector(*characters_type) : 0; + auto characters__ = characters ? _fbb.CreateVector>(*characters) : 0; return CreateMovie( _fbb, main_character_type, main_character, - characters_type ? _fbb.CreateVector(*characters_type) : 0, - characters ? _fbb.CreateVector>(*characters) : 0); + characters_type__, + characters__); } flatbuffers::Offset CreateMovie(flatbuffers::FlatBufferBuilder &_fbb, const MovieT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);