Skip to content

Commit 3ba2e26

Browse files
thedavekwonfacebook-github-bot
authored andcommitted
Add @cpp.UseOpEncode fixtures
Summary: Add missing fixtures Reviewed By: Filip-F Differential Revision: D68918587 fbshipit-source-id: fb48b6bcfa0430a23d84d2d78d715205bfe88cbf
1 parent 2b8ada7 commit 3ba2e26

19 files changed

+1214
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cpp2: mstch_cpp2 src/module.thrift
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Autogenerated by Thrift for
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
#pragma once
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Autogenerated by Thrift for thrift/compiler/test/fixtures/use_op_encode/src/module.thrift
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
8+
#include "thrift/compiler/test/fixtures/use_op_encode/gen-cpp2/module_constants.h"
9+
10+
#include <thrift/lib/cpp2/gen/module_constants_cpp.h>
11+
12+
13+
namespace facebook::thrift::compiler::test {
14+
namespace module_constants {
15+
16+
17+
::std::string_view _fbthrift_schema_709b2525c0eb9689() {
18+
return "";
19+
}
20+
::folly::Range<const ::std::string_view*> _fbthrift_schema_709b2525c0eb9689_includes() {
21+
return {};
22+
}
23+
24+
} // namespace module_constants
25+
} // namespace facebook::thrift::compiler::test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Autogenerated by Thrift for thrift/compiler/test/fixtures/use_op_encode/src/module.thrift
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
#pragma once
8+
9+
#include <thrift/lib/cpp2/gen/module_constants_h.h>
10+
11+
#include "thrift/compiler/test/fixtures/use_op_encode/gen-cpp2/module_types.h"
12+
13+
namespace facebook::thrift::compiler::test {
14+
/** Glean {"file": "thrift/compiler/test/fixtures/use_op_encode/src/module.thrift"} */
15+
namespace module_constants {
16+
17+
FOLLY_EXPORT ::std::string_view _fbthrift_schema_709b2525c0eb9689();
18+
FOLLY_EXPORT ::folly::Range<const ::std::string_view*> _fbthrift_schema_709b2525c0eb9689_includes();
19+
20+
} // namespace module_constants
21+
} // namespace facebook::thrift::compiler::test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* Autogenerated by Thrift for thrift/compiler/test/fixtures/use_op_encode/src/module.thrift
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
8+
#include "thrift/compiler/test/fixtures/use_op_encode/gen-cpp2/module_data.h"
9+
10+
#include <thrift/lib/cpp2/gen/module_data_cpp.h>
11+
12+
FOLLY_CLANG_DISABLE_WARNING("-Wunused-macros")
13+
14+
#if defined(__GNUC__) && defined(__linux__) && !FOLLY_MOBILE
15+
// These attributes are applied to the static data members to ensure that they
16+
// are not stripped from the compiled binary, in order to keep them available
17+
// for use by debuggers at runtime.
18+
//
19+
// The "used" attribute is required to ensure the compiler always emits unused
20+
// data.
21+
//
22+
// The "section" attribute is required to stop the linker from stripping used
23+
// data. It works by forcing all of the data members (both used and unused ones)
24+
// into the same section. As the linker strips data on a per-section basis, it
25+
// is then unable to remove unused data without also removing used data.
26+
// This has a similar effect to the "retain" attribute, but works with older
27+
// toolchains.
28+
#define THRIFT_DATA_MEMBER [[gnu::used]] [[gnu::section(".rodata.thrift.data")]]
29+
#else
30+
#define THRIFT_DATA_MEMBER
31+
#endif
32+
33+
namespace apache {
34+
namespace thrift {
35+
36+
THRIFT_DATA_MEMBER const std::string_view TStructDataStorage<::facebook::thrift::compiler::test::MyStruct>::name = "MyStruct";
37+
THRIFT_DATA_MEMBER const std::array<std::string_view, 4> TStructDataStorage<::facebook::thrift::compiler::test::MyStruct>::fields_names = { {
38+
"def_field"sv,
39+
"opt_field"sv,
40+
"req_field"sv,
41+
"terse_field"sv,
42+
}};
43+
THRIFT_DATA_MEMBER const std::array<int16_t, 4> TStructDataStorage<::facebook::thrift::compiler::test::MyStruct>::fields_ids = { {
44+
1,
45+
2,
46+
3,
47+
4,
48+
}};
49+
THRIFT_DATA_MEMBER const std::array<protocol::TType, 4> TStructDataStorage<::facebook::thrift::compiler::test::MyStruct>::fields_types = { {
50+
TType::T_I32,
51+
TType::T_I32,
52+
TType::T_I32,
53+
TType::T_I32,
54+
}};
55+
THRIFT_DATA_MEMBER const std::array<std::string_view, 4> TStructDataStorage<::facebook::thrift::compiler::test::MyStruct>::storage_names = { {
56+
"__fbthrift_field_def_field"sv,
57+
"__fbthrift_field_opt_field"sv,
58+
"__fbthrift_field_req_field"sv,
59+
"__fbthrift_field_terse_field"sv,
60+
}};
61+
THRIFT_DATA_MEMBER const std::array<int, 4> TStructDataStorage<::facebook::thrift::compiler::test::MyStruct>::isset_indexes = { {
62+
0,
63+
1,
64+
-1,
65+
-1,
66+
}};
67+
68+
} // namespace thrift
69+
} // namespace apache
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Autogenerated by Thrift for thrift/compiler/test/fixtures/use_op_encode/src/module.thrift
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
#pragma once
8+
9+
#include <thrift/lib/cpp2/gen/module_data_h.h>
10+
11+
#include "thrift/compiler/test/fixtures/use_op_encode/gen-cpp2/module_types.h"
12+
13+
namespace apache { namespace thrift {
14+
15+
template <> struct TStructDataStorage<::facebook::thrift::compiler::test::MyStruct> {
16+
static constexpr const std::size_t fields_size = 4;
17+
static const std::string_view name;
18+
static const std::array<std::string_view, fields_size> fields_names;
19+
static const std::array<int16_t, fields_size> fields_ids;
20+
static const std::array<protocol::TType, fields_size> fields_types;
21+
22+
private:
23+
// The following fields describe internal storage metadata, and are private to
24+
// prevent user logic from accessing them, but they can be inspected by
25+
// debuggers.
26+
static const std::array<std::string_view, fields_size> storage_names;
27+
// -1 if the field has no isset.
28+
static const std::array<int, fields_size> isset_indexes;
29+
};
30+
31+
}} // apache::thrift
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Autogenerated by Thrift for thrift/compiler/test/fixtures/use_op_encode/src/module.thrift
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
#pragma once
8+
9+
#include "thrift/compiler/test/fixtures/use_op_encode/gen-cpp2/module_metadata.h"
10+
#include <thrift/lib/cpp2/visitation/for_each.h>
11+
12+
namespace apache {
13+
namespace thrift {
14+
namespace detail {
15+
16+
template <>
17+
struct ForEachField<::facebook::thrift::compiler::test::MyStruct> {
18+
template <typename F, typename... T>
19+
void operator()([[maybe_unused]] F&& f, [[maybe_unused]] T&&... t) const {
20+
f(0, static_cast<T&&>(t).def_field_ref()...);
21+
f(1, static_cast<T&&>(t).opt_field_ref()...);
22+
f(2, static_cast<T&&>(t).req_field_ref()...);
23+
f(3, static_cast<T&&>(t).terse_field_ref()...);
24+
}
25+
};
26+
} // namespace detail
27+
} // namespace thrift
28+
} // namespace apache
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Autogenerated by Thrift for
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
#pragma once
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Autogenerated by Thrift for thrift/compiler/test/fixtures/use_op_encode/src/module.thrift
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
8+
#include "thrift/compiler/test/fixtures/use_op_encode/gen-cpp2/module_metadata.h"
9+
10+
// some of these functions can be so large that the compiler gives up optimizing
11+
// them - and issues a warning which may be treated as an error!
12+
//
13+
// these functions are so rarely called that it is probably okay for them not to
14+
// be optimized in practice
15+
FOLLY_CLANG_DISABLE_WARNING("-Wignored-optimization-argument")
16+
17+
namespace apache {
18+
namespace thrift {
19+
namespace detail {
20+
namespace md {
21+
using ThriftMetadata = ::apache::thrift::metadata::ThriftMetadata;
22+
using ThriftPrimitiveType = ::apache::thrift::metadata::ThriftPrimitiveType;
23+
using ThriftType = ::apache::thrift::metadata::ThriftType;
24+
using ThriftService = ::apache::thrift::metadata::ThriftService;
25+
using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
26+
using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
27+
28+
29+
const ::apache::thrift::metadata::ThriftStruct&
30+
StructMetadata<::facebook::thrift::compiler::test::MyStruct>::gen(ThriftMetadata& metadata) {
31+
auto res = metadata.structs()->emplace("module.MyStruct", ::apache::thrift::metadata::ThriftStruct{});
32+
if (!res.second) {
33+
return res.first->second;
34+
}
35+
::apache::thrift::metadata::ThriftStruct& module_MyStruct = res.first->second;
36+
module_MyStruct.name() = "module.MyStruct";
37+
module_MyStruct.is_union() = false;
38+
static const auto* const
39+
module_MyStruct_fields = new std::array<EncodedThriftField, 4>{ {
40+
{ 1, "def_field", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }}, { 2, "opt_field", true, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }}, { 3, "req_field", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }}, { 4, "terse_field", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.TerseWrite", { }).cv_struct_ref(), }}, }};
41+
for (const auto& f : *module_MyStruct_fields) {
42+
::apache::thrift::metadata::ThriftField field;
43+
field.id() = f.id;
44+
field.name() = f.name;
45+
field.is_optional() = f.is_optional;
46+
f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
47+
field.structured_annotations() = f.structured_annotations;
48+
module_MyStruct.fields()->push_back(std::move(field));
49+
}
50+
return res.first->second;
51+
}
52+
53+
} // namespace md
54+
} // namespace detail
55+
} // namespace thrift
56+
} // namespace apache
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Autogenerated by Thrift for thrift/compiler/test/fixtures/use_op_encode/src/module.thrift
3+
*
4+
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5+
* @generated @nocommit
6+
*/
7+
#pragma once
8+
9+
#include <vector>
10+
11+
#include <thrift/lib/cpp2/gen/module_metadata_h.h>
12+
#include "thrift/compiler/test/fixtures/use_op_encode/gen-cpp2/module_types.h"
13+
14+
15+
namespace apache {
16+
namespace thrift {
17+
namespace detail {
18+
namespace md {
19+
20+
template <>
21+
class StructMetadata<::facebook::thrift::compiler::test::MyStruct> {
22+
public:
23+
static const ::apache::thrift::metadata::ThriftStruct& gen(ThriftMetadata& metadata);
24+
};
25+
} // namespace md
26+
} // namespace detail
27+
} // namespace thrift
28+
} // namespace apache

0 commit comments

Comments
 (0)