Skip to content

Commit aa35178

Browse files
Mizuchimeta-codesync[bot]
authored andcommitted
Generate structured annotations in metadata.thrift from schema.thrift for Enum
Summary: This diff added the code to generate structured annotations for Enum. Reviewed By: praihan Differential Revision: D85978392 fbshipit-source-id: 1d4d55e7fde5bf44f60551f42ab09ecbf3710913
1 parent bf4885a commit aa35178

File tree

88 files changed

+388
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+388
-70
lines changed

third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_metadata.cpp.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
{{> Autogen}}
2020
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
2121
#include "{{program:include_prefix}}{{program:name}}_metadata.h"
22+
#include "{{program:include_prefix}}{{program:name}}_data.h"
2223

2324
// some of these functions can be so large that the compiler gives up optimizing
2425
// them - and issues a warning which may be treated as an error!
@@ -43,7 +44,7 @@ using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
4344
4445
{{#program:enums}}
4546
void EnumMetadata<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::gen(ThriftMetadata& metadata) {
46-
auto res = genEnumMetadata<::{{program:qualified_namespace}}::{{enum:cpp_name}}>(metadata);
47+
auto res = genEnumMetadata<::{{program:qualified_namespace}}::{{enum:cpp_name}}>(metadata, false);
4748
if (res.preExists) {
4849
return;
4950
}

third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/adapter/gen-cpp2/module_metadata.h"
9+
#include "thrift/compiler/test/fixtures/adapter/gen-cpp2/module_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!
@@ -36,13 +37,13 @@ using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
3637
using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
3738

3839
void EnumMetadata<::facebook::thrift::test::Color>::gen(ThriftMetadata& metadata) {
39-
auto res = genEnumMetadata<::facebook::thrift::test::Color>(metadata);
40+
auto res = genEnumMetadata<::facebook::thrift::test::Color>(metadata, false);
4041
if (res.preExists) {
4142
return;
4243
}
4344
}
4445
void EnumMetadata<::facebook::thrift::test::ThriftAdaptedEnum>::gen(ThriftMetadata& metadata) {
45-
auto res = genEnumMetadata<::facebook::thrift::test::ThriftAdaptedEnum>(metadata);
46+
auto res = genEnumMetadata<::facebook::thrift::test::ThriftAdaptedEnum>(metadata, false);
4647
if (res.preExists) {
4748
return;
4849
}

third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/cpp2_no_uri/gen-cpp2/module_no_uri_metadata.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/adapter/gen-cpp2/module_no_uri_metadata.h"
9+
#include "thrift/compiler/test/fixtures/adapter/gen-cpp2/module_no_uri_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!

third-party/thrift/src/thrift/compiler/test/fixtures/aliasing/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/aliasing/gen-cpp2/module_metadata.h"
9+
#include "thrift/compiler/test/fixtures/aliasing/gen-cpp2/module_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!

third-party/thrift/src/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/any/gen-cpp2/module_metadata.h"
9+
#include "thrift/compiler/test/fixtures/any/gen-cpp2/module_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!

third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_metadata.h"
9+
#include "thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!
@@ -51,7 +52,7 @@ using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
5152
using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
5253

5354
void EnumMetadata<::cpp2::YourEnum>::gen(ThriftMetadata& metadata) {
54-
auto res = genEnumMetadata<::cpp2::YourEnum>(metadata);
55+
auto res = genEnumMetadata<::cpp2::YourEnum>(metadata, false);
5556
if (res.preExists) {
5657
return;
5758
}

third-party/thrift/src/thrift/compiler/test/fixtures/basic-enum/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/basic-enum/gen-cpp2/module_metadata.h"
9+
#include "thrift/compiler/test/fixtures/basic-enum/gen-cpp2/module_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!
@@ -26,26 +27,26 @@ using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
2627
using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
2728

2829
void EnumMetadata<::test::fixtures::enumstrict::EmptyEnum>::gen(ThriftMetadata& metadata) {
29-
auto res = genEnumMetadata<::test::fixtures::enumstrict::EmptyEnum>(metadata);
30+
auto res = genEnumMetadata<::test::fixtures::enumstrict::EmptyEnum>(metadata, false);
3031
if (res.preExists) {
3132
return;
3233
}
3334
}
3435
void EnumMetadata<::test::fixtures::enumstrict::MyEnum>::gen(ThriftMetadata& metadata) {
35-
auto res = genEnumMetadata<::test::fixtures::enumstrict::MyEnum>(metadata);
36+
auto res = genEnumMetadata<::test::fixtures::enumstrict::MyEnum>(metadata, false);
3637
if (res.preExists) {
3738
return;
3839
}
3940
}
4041
void EnumMetadata<::test::fixtures::enumstrict::MyUseIntrinsicDefaultEnum>::gen(ThriftMetadata& metadata) {
41-
auto res = genEnumMetadata<::test::fixtures::enumstrict::MyUseIntrinsicDefaultEnum>(metadata);
42+
auto res = genEnumMetadata<::test::fixtures::enumstrict::MyUseIntrinsicDefaultEnum>(metadata, false);
4243
if (res.preExists) {
4344
return;
4445
}
4546
res.metadata.structured_annotations()->push_back(*cvStruct("java.UseIntrinsicDefault", { }).cv_struct());
4647
}
4748
void EnumMetadata<::test::fixtures::enumstrict::MyBigEnum>::gen(ThriftMetadata& metadata) {
48-
auto res = genEnumMetadata<::test::fixtures::enumstrict::MyBigEnum>(metadata);
49+
auto res = genEnumMetadata<::test::fixtures::enumstrict::MyBigEnum>(metadata, false);
4950
if (res.preExists) {
5051
return;
5152
}

third-party/thrift/src/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/basic-stack-arguments/gen-cpp2/module_metadata.h"
9+
#include "thrift/compiler/test/fixtures/basic-stack-arguments/gen-cpp2/module_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!
@@ -41,7 +42,7 @@ using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
4142
using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
4243

4344
void EnumMetadata<::cpp2::MyEnum>::gen(ThriftMetadata& metadata) {
44-
auto res = genEnumMetadata<::cpp2::MyEnum>(metadata);
45+
auto res = genEnumMetadata<::cpp2::MyEnum>(metadata, false);
4546
if (res.preExists) {
4647
return;
4748
}

third-party/thrift/src/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/basic-structured-annotations/gen-cpp2/module_metadata.h"
9+
#include "thrift/compiler/test/fixtures/basic-structured-annotations/gen-cpp2/module_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!
@@ -31,7 +32,7 @@ using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
3132
using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
3233

3334
void EnumMetadata<::test::fixtures::basic_structured_annotations::MyEnum>::gen(ThriftMetadata& metadata) {
34-
auto res = genEnumMetadata<::test::fixtures::basic_structured_annotations::MyEnum>(metadata);
35+
auto res = genEnumMetadata<::test::fixtures::basic_structured_annotations::MyEnum>(metadata, false);
3536
if (res.preExists) {
3637
return;
3738
}

third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
88
#include "thrift/compiler/test/fixtures/basic/gen-cpp2/module_metadata.h"
9+
#include "thrift/compiler/test/fixtures/basic/gen-cpp2/module_data.h"
910

1011
// some of these functions can be so large that the compiler gives up optimizing
1112
// them - and issues a warning which may be treated as an error!
@@ -46,13 +47,13 @@ using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
4647
using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
4748

4849
void EnumMetadata<::test::fixtures::basic::MyEnum>::gen(ThriftMetadata& metadata) {
49-
auto res = genEnumMetadata<::test::fixtures::basic::MyEnum>(metadata);
50+
auto res = genEnumMetadata<::test::fixtures::basic::MyEnum>(metadata, false);
5051
if (res.preExists) {
5152
return;
5253
}
5354
}
5455
void EnumMetadata<::test::fixtures::basic::HackEnum>::gen(ThriftMetadata& metadata) {
55-
auto res = genEnumMetadata<::test::fixtures::basic::HackEnum>(metadata);
56+
auto res = genEnumMetadata<::test::fixtures::basic::HackEnum>(metadata, false);
5657
if (res.preExists) {
5758
return;
5859
}

0 commit comments

Comments
 (0)