Skip to content

Commit

Permalink
Revert D67627380: Fix build failure by moving some getters/setters fr…
Browse files Browse the repository at this point in the history
…om module_types.cpp back to module_types.h

Differential Revision:
D67627380

Original commit changeset: 8b2dc510d8c0

Original Phabricator Diff: D67627380

fbshipit-source-id: c75c01e915ee2288ea486c3f5f2b82506023dd62
  • Loading branch information
Eyal Flato authored and facebook-github-bot committed Dec 25, 2024
1 parent ac25177 commit 67546d1
Show file tree
Hide file tree
Showing 82 changed files with 1,590 additions and 971 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const {{type:cpp_type}}* {{struct:cpp_underlying_name}}::get_{{field:cpp_name}}(
return {{field:cpp_storage_name}};
}
{{#else}}
{{#if type:resolves_to_container_or_struct?}}

const {{type:cpp_type}}& {{struct:cpp_underlying_name}}::get_{{field:cpp_name}}() const& {
return {{field:cpp_storage_name}};
Expand All @@ -40,7 +39,6 @@ const {{type:cpp_type}}& {{struct:cpp_underlying_name}}::get_{{field:cpp_name}}(
{{type:cpp_type}} {{struct:cpp_underlying_name}}::get_{{field:cpp_name}}() && {
return static_cast<{{type:cpp_type}}&&>({{field:cpp_storage_name}});
}
{{/if type:resolves_to_container_or_struct?}}
{{/if type:resolves_to_fixed_size?}}
{{/if field:optional?}}
{{#if type:resolves_to_fixed_size?}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
[[deprecated("Use `FOO.{{field:cpp_name}}().value();` instead of `FOO.get_{{field:cpp_name}}();`")]]
{{type:cpp_type}} get_{{field:cpp_name}}() const;
{{#else}}
{{#if type:resolves_to_container_or_struct?}}

{{> common/field_docblock}}
[[deprecated("Use `FOO.{{field:cpp_name}}().value();` instead of `FOO.get_{{field:cpp_name}}();`")]]
Expand All @@ -42,20 +41,6 @@
{{> common/field_docblock}}
[[deprecated("Use `FOO.{{field:cpp_name}}().value();` instead of `FOO.get_{{field:cpp_name}}();`")]]
{{type:cpp_type}} get_{{field:cpp_name}}() &&;
{{#else}}

{{> common/field_docblock}}
[[deprecated("Use `FOO.{{field:cpp_name}}().value();` instead of `FOO.get_{{field:cpp_name}}();`")]]
const {{type:cpp_type}}& get_{{field:cpp_name}}() const& {
return {{field:cpp_storage_name}};
}

{{> common/field_docblock}}
[[deprecated("Use `FOO.{{field:cpp_name}}().value();` instead of `FOO.get_{{field:cpp_name}}();`")]]
{{type:cpp_type}} get_{{field:cpp_name}}() && {
return static_cast<{{type:cpp_type}}&&>({{field:cpp_storage_name}});
}
{{/if type:resolves_to_container_or_struct?}}
{{/if type:resolves_to_fixed_size?}}
{{/if field:optional?}}
{{#if type:resolves_to_fixed_size?}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ bool MyAnnotation::operator<([[maybe_unused]] const MyAnnotation& rhs) const {
}


const ::std::string& MyAnnotation::get_signature() const& {
return __fbthrift_field_signature;
}

::std::string MyAnnotation::get_signature() && {
return static_cast<::std::string&&>(__fbthrift_field_signature);
}

::facebook::thrift::test::Color MyAnnotation::get_color() const {
return __fbthrift_field_color;
}
Expand Down Expand Up @@ -1576,6 +1584,14 @@ bool Config::operator<([[maybe_unused]] const Config& rhs) const {
}


const ::std::string& Config::get_path() const& {
return __fbthrift_field_path;
}

::std::string Config::get_path() && {
return static_cast<::std::string&&>(__fbthrift_field_path);
}

void swap([[maybe_unused]] Config& a, [[maybe_unused]] Config& b) {
using ::std::swap;
swap(a.__fbthrift_field_path, b.__fbthrift_field_path);
Expand Down Expand Up @@ -1914,6 +1930,14 @@ bool AdaptTestStruct::operator<([[maybe_unused]] const AdaptTestStruct& rhs) con
}


const ::std::string& AdaptTestStruct::get_meta() const& {
return __fbthrift_field_meta;
}

::std::string AdaptTestStruct::get_meta() && {
return static_cast<::std::string&&>(__fbthrift_field_meta);
}

void swap([[maybe_unused]] AdaptTestStruct& a, [[maybe_unused]] AdaptTestStruct& b) {
using ::std::swap;
swap(a.__fbthrift_field_delay, b.__fbthrift_field_delay);
Expand Down Expand Up @@ -4147,6 +4171,14 @@ bool Person::operator<([[maybe_unused]] const Person& rhs) const {
}


const ::std::string& Person::get_name() const& {
return __fbthrift_field_name;
}

::std::string Person::get_name() && {
return static_cast<::std::string&&>(__fbthrift_field_name);
}

void swap([[maybe_unused]] Person& a, [[maybe_unused]] Person& b) {
using ::std::swap;
swap(a.__fbthrift_field_name, b.__fbthrift_field_name);
Expand Down Expand Up @@ -4248,6 +4280,14 @@ bool Person2::operator<([[maybe_unused]] const Person2& rhs) const {
}


const ::std::string& Person2::get_name() const& {
return __fbthrift_field_name;
}

::std::string Person2::get_name() && {
return static_cast<::std::string&&>(__fbthrift_field_name);
}

void swap([[maybe_unused]] Person2& a, [[maybe_unused]] Person2& b) {
using ::std::swap;
swap(a.__fbthrift_field_name, b.__fbthrift_field_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3513,15 +3513,11 @@ class MyAnnotation final {

/** Glean { "field": "signature" } */
[[deprecated("Use `FOO.signature().value();` instead of `FOO.get_signature();`")]]
const ::std::string& get_signature() const& {
return __fbthrift_field_signature;
}
const ::std::string& get_signature() const&;

/** Glean { "field": "signature" } */
[[deprecated("Use `FOO.signature().value();` instead of `FOO.get_signature();`")]]
::std::string get_signature() && {
return static_cast<::std::string&&>(__fbthrift_field_signature);
}
::std::string get_signature() &&;

/** Glean { "field": "signature" } */
template <typename T_MyAnnotation_signature_struct_setter = ::std::string>
Expand Down Expand Up @@ -4581,15 +4577,11 @@ class Config final {

/** Glean { "field": "path" } */
[[deprecated("Use `FOO.path().value();` instead of `FOO.get_path();`")]]
const ::std::string& get_path() const& {
return __fbthrift_field_path;
}
const ::std::string& get_path() const&;

/** Glean { "field": "path" } */
[[deprecated("Use `FOO.path().value();` instead of `FOO.get_path();`")]]
::std::string get_path() && {
return static_cast<::std::string&&>(__fbthrift_field_path);
}
::std::string get_path() &&;

/** Glean { "field": "path" } */
template <typename T_Config_path_struct_setter = ::std::string>
Expand Down Expand Up @@ -5439,15 +5431,11 @@ class AdaptTestStruct final {

/** Glean { "field": "meta" } */
[[deprecated("Use `FOO.meta().value();` instead of `FOO.get_meta();`")]]
const ::std::string& get_meta() const& {
return __fbthrift_field_meta;
}
const ::std::string& get_meta() const&;

/** Glean { "field": "meta" } */
[[deprecated("Use `FOO.meta().value();` instead of `FOO.get_meta();`")]]
::std::string get_meta() && {
return static_cast<::std::string&&>(__fbthrift_field_meta);
}
::std::string get_meta() &&;

/** Glean { "field": "meta" } */
template <typename T_AdaptTestStruct_meta_struct_setter = ::std::string>
Expand Down Expand Up @@ -9418,15 +9406,11 @@ class Person final {

/** Glean { "field": "name" } */
[[deprecated("Use `FOO.name().value();` instead of `FOO.get_name();`")]]
const ::std::string& get_name() const& {
return __fbthrift_field_name;
}
const ::std::string& get_name() const&;

/** Glean { "field": "name" } */
[[deprecated("Use `FOO.name().value();` instead of `FOO.get_name();`")]]
::std::string get_name() && {
return static_cast<::std::string&&>(__fbthrift_field_name);
}
::std::string get_name() &&;

/** Glean { "field": "name" } */
template <typename T_Person_name_struct_setter = ::std::string>
Expand Down Expand Up @@ -9594,15 +9578,11 @@ class Person2 final {

/** Glean { "field": "name" } */
[[deprecated("Use `FOO.name().value();` instead of `FOO.get_name();`")]]
const ::std::string& get_name() const& {
return __fbthrift_field_name;
}
const ::std::string& get_name() const&;

/** Glean { "field": "name" } */
[[deprecated("Use `FOO.name().value();` instead of `FOO.get_name();`")]]
::std::string get_name() && {
return static_cast<::std::string&&>(__fbthrift_field_name);
}
::std::string get_name() &&;

/** Glean { "field": "name" } */
template <typename T_Person2_name_struct_setter = ::std::string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ bool MyStruct::operator<([[maybe_unused]] const MyStruct& rhs) const {
}


const ::std::string& MyStruct::get_myString() const& {
return __fbthrift_field_myString;
}

::std::string MyStruct::get_myString() && {
return static_cast<::std::string&&>(__fbthrift_field_myString);
}

void swap([[maybe_unused]] MyStruct& a, [[maybe_unused]] MyStruct& b) {
using ::std::swap;
swap(a.__fbthrift_field_myString, b.__fbthrift_field_myString);
Expand Down Expand Up @@ -359,6 +367,14 @@ bool MyException::operator<([[maybe_unused]] const MyException& rhs) const {
}


const ::std::string& MyException::get_myString() const& {
return __fbthrift_field_myString;
}

::std::string MyException::get_myString() && {
return static_cast<::std::string&&>(__fbthrift_field_myString);
}

void swap([[maybe_unused]] MyException& a, [[maybe_unused]] MyException& b) {
using ::std::swap;
swap(a.__fbthrift_field_myString, b.__fbthrift_field_myString);
Expand Down
16 changes: 4 additions & 12 deletions thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,11 @@ class MyStruct final {

/** Glean { "field": "myString" } */
[[deprecated("Use `FOO.myString().value();` instead of `FOO.get_myString();`")]]
const ::std::string& get_myString() const& {
return __fbthrift_field_myString;
}
const ::std::string& get_myString() const&;

/** Glean { "field": "myString" } */
[[deprecated("Use `FOO.myString().value();` instead of `FOO.get_myString();`")]]
::std::string get_myString() && {
return static_cast<::std::string&&>(__fbthrift_field_myString);
}
::std::string get_myString() &&;

/** Glean { "field": "myString" } */
template <typename T_MyStruct_myString_struct_setter = ::std::string>
Expand Down Expand Up @@ -607,15 +603,11 @@ class FOLLY_EXPORT MyException : public virtual apache::thrift::TException {

/** Glean { "field": "myString" } */
[[deprecated("Use `FOO.myString().value();` instead of `FOO.get_myString();`")]]
const ::std::string& get_myString() const& {
return __fbthrift_field_myString;
}
const ::std::string& get_myString() const&;

/** Glean { "field": "myString" } */
[[deprecated("Use `FOO.myString().value();` instead of `FOO.get_myString();`")]]
::std::string get_myString() && {
return static_cast<::std::string&&>(__fbthrift_field_myString);
}
::std::string get_myString() &&;

/** Glean { "field": "myString" } */
template <typename T_MyException_myString_struct_setter = ::std::string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ bool MyStructNestedAnnotation::operator<([[maybe_unused]] const MyStructNestedAn
}


const ::std::string& MyStructNestedAnnotation::get_name() const& {
return __fbthrift_field_name;
}

::std::string MyStructNestedAnnotation::get_name() && {
return static_cast<::std::string&&>(__fbthrift_field_name);
}

void swap([[maybe_unused]] MyStructNestedAnnotation& a, [[maybe_unused]] MyStructNestedAnnotation& b) {
using ::std::swap;
swap(a.__fbthrift_field_name, b.__fbthrift_field_name);
Expand Down Expand Up @@ -484,6 +492,46 @@ ::std::int64_t& YourStruct::set_majorVer(::std::int64_t majorVer_) {
return __fbthrift_field_majorVer;
}

const ::std::string& YourStruct::get_abstract() const& {
return __fbthrift_field_abstract;
}

::std::string YourStruct::get_abstract() && {
return static_cast<::std::string&&>(__fbthrift_field_abstract);
}

const ::std::string& YourStruct::get_annotation_with_quote() const& {
return __fbthrift_field_annotation_with_quote;
}

::std::string YourStruct::get_annotation_with_quote() && {
return static_cast<::std::string&&>(__fbthrift_field_annotation_with_quote);
}

const ::std::string& YourStruct::get_class_() const& {
return __fbthrift_field_class_;
}

::std::string YourStruct::get_class_() && {
return static_cast<::std::string&&>(__fbthrift_field_class_);
}

const ::std::string& YourStruct::get_annotation_with_trailing_comma() const& {
return __fbthrift_field_annotation_with_trailing_comma;
}

::std::string YourStruct::get_annotation_with_trailing_comma() && {
return static_cast<::std::string&&>(__fbthrift_field_annotation_with_trailing_comma);
}

const ::std::string& YourStruct::get_empty_annotations() const& {
return __fbthrift_field_empty_annotations;
}

::std::string YourStruct::get_empty_annotations() && {
return static_cast<::std::string&&>(__fbthrift_field_empty_annotations);
}

::cpp2::YourEnum YourStruct::get_my_enum() const {
return __fbthrift_field_my_enum;
}
Expand Down Expand Up @@ -628,6 +676,14 @@ ::std::int64_t& SecretStruct::set_id(::std::int64_t id_) {
return __fbthrift_field_id;
}

const ::std::string& SecretStruct::get_password() const& {
return __fbthrift_field_password;
}

::std::string SecretStruct::get_password() && {
return static_cast<::std::string&&>(__fbthrift_field_password);
}

void swap([[maybe_unused]] SecretStruct& a, [[maybe_unused]] SecretStruct& b) {
using ::std::swap;
swap(a.__fbthrift_field_id, b.__fbthrift_field_id);
Expand Down
Loading

0 comments on commit 67546d1

Please sign in to comment.