use op::encode and op::decode in codegen
commita2cb87536fc8fd558254e579d88ef1b4470f3103
authorAmi Oka <aoka@fb.com>
Tue, 6 Sep 2022 19:09:10 +0000 (6 12:09 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 6 Sep 2022 19:09:10 +0000 (6 12:09 -0700)
tree9454c6f3d52d2123bfc80152c327eb110f581970
parent6411080bb71beb897e0e81f1f9f4af54d9dab931
use op::encode and op::decode in codegen

Summary: Updated codegen to use op::encode and op::decode when the struct has the annotation UseOpEncode. Since serializeSize and serializedSizeZC are not supported for adapted type in containers yet, it returns 0 as a workaround when the struct has UseOpEncode (this is fine as serializeSize is an optimization).

Reviewed By: Mizuchi

Differential Revision: D39069020

fbshipit-source-id: db2275e053d93eff2c27ece2be2b80e3776a6cf5
76 files changed:
third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_types.tcc.mustache
third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_field.mustache
third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_field.mustache
third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_struct.mustache
third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_union.mustache
third-party/thrift/src/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/any/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/basic-enum/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/basic-stack-arguments/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/basic-structured-annotations/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/basic/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/constants/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/coroutines/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/deprecated-clear/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/deprecated-enforce-required/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/deprecated-public-fields-for-cpp-ref/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/deprecated-public-required-fields/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/doctext/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/emptiable/gen-cpp2/simple_terse_writes_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/emptiable/gen-cpp2/simple_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/encode/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/enums/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/fatal/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/field_interceptor/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/frozen-struct/gen-cpp2/include1_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/frozen-struct/gen-cpp2/include2_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/frozen-struct/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/includes/gen-cpp2/includes_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/includes/gen-cpp2/matching_module_name_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/includes/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/includes/gen-cpp2/service_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/interactions/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/isset_bitpacking/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/lazy_deserialization/gen-cpp2/simple_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/lazy_deserialization/gen-cpp2/terse_writes_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/maps-with-incomplete-types/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/gen-cpp2/enums_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/gen-cpp2/extra_services_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/gen-cpp2/includes_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/gen-cpp2/reflection_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/mixin/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/nimble/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/no-legacy-apis/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/no_metadata/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/no_service_handler_coroutines/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/optionals/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/params/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/patch/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/py3/gen-py3cpp/empty_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/py3/gen-py3cpp/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/qualified/gen-cpp2/module2_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/refs/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/gen-cpp2/module_structs_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/sink/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/split/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/stream/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/tablebased/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/templated-deserialize/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/gen-cpp2/deprecated_terse_write_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/gen-cpp2/terse_write_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/compiler/test/fixtures/visitation/gen-cpp2/module_types.tcc
third-party/thrift/src/thrift/test/UseOpEncode.thrift [new file with mode: 0644]
third-party/thrift/src/thrift/test/UseOpEncodeTest.cpp [new file with mode: 0644]