diff --git a/thrift/compiler/generate/templates/cpp2/module_types_cpp/getters_setters.mustache b/thrift/compiler/generate/templates/cpp2/module_types_cpp/getters_setters.mustache index a1e6c1e9e50..10cb617ccc4 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types_cpp/getters_setters.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types_cpp/getters_setters.mustache @@ -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}}; @@ -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?}} diff --git a/thrift/compiler/generate/templates/cpp2/module_types_h/getters_setters.mustache b/thrift/compiler/generate/templates/cpp2/module_types_h/getters_setters.mustache index 77091cc3442..b48025676d6 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types_h/getters_setters.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types_h/getters_setters.mustache @@ -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}}();`")]] @@ -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?}} diff --git a/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_types.cpp index da1dd4cf0ce..046d0732cdc 100644 --- a/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_types.cpp @@ -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; } @@ -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); @@ -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); @@ -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); @@ -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); diff --git a/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_types.h index f3bc35913cd..b26bb056c62 100644 --- a/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/adapter/out/cpp2/gen-cpp2/module_types.h @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.cpp index 71c404a2f37..eaa5d42a4f6 100644 --- a/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.cpp @@ -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); @@ -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); diff --git a/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.h index 82554d9687e..302d3d9da17 100644 --- a/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_types.h @@ -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 @@ -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 diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_types.cpp index 9fa58025d8f..bd03c6e9da4 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_types.cpp @@ -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); @@ -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; } @@ -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); diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_types.h index 007c11d853a..0768b8eab14 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_types.h @@ -868,15 +868,11 @@ class YourStruct final { /** Glean { "field": "abstract" } */ [[deprecated("Use `FOO.abstract().value();` instead of `FOO.get_abstract();`")]] - const ::std::string& get_abstract() const& { - return __fbthrift_field_abstract; - } + const ::std::string& get_abstract() const&; /** Glean { "field": "abstract" } */ [[deprecated("Use `FOO.abstract().value();` instead of `FOO.get_abstract();`")]] - ::std::string get_abstract() && { - return static_cast<::std::string&&>(__fbthrift_field_abstract); - } + ::std::string get_abstract() &&; /** Glean { "field": "abstract" } */ template @@ -888,15 +884,11 @@ class YourStruct final { /** Glean { "field": "annotation_with_quote" } */ [[deprecated("Use `FOO.annotation_with_quote().value();` instead of `FOO.get_annotation_with_quote();`")]] - const ::std::string& get_annotation_with_quote() const& { - return __fbthrift_field_annotation_with_quote; - } + const ::std::string& get_annotation_with_quote() const&; /** Glean { "field": "annotation_with_quote" } */ [[deprecated("Use `FOO.annotation_with_quote().value();` instead of `FOO.get_annotation_with_quote();`")]] - ::std::string get_annotation_with_quote() && { - return static_cast<::std::string&&>(__fbthrift_field_annotation_with_quote); - } + ::std::string get_annotation_with_quote() &&; /** Glean { "field": "annotation_with_quote" } */ template @@ -908,15 +900,11 @@ class YourStruct final { /** Glean { "field": "class_" } */ [[deprecated("Use `FOO.class_().value();` instead of `FOO.get_class_();`")]] - const ::std::string& get_class_() const& { - return __fbthrift_field_class_; - } + const ::std::string& get_class_() const&; /** Glean { "field": "class_" } */ [[deprecated("Use `FOO.class_().value();` instead of `FOO.get_class_();`")]] - ::std::string get_class_() && { - return static_cast<::std::string&&>(__fbthrift_field_class_); - } + ::std::string get_class_() &&; /** Glean { "field": "class_" } */ template @@ -928,15 +916,11 @@ class YourStruct final { /** Glean { "field": "annotation_with_trailing_comma" } */ [[deprecated("Use `FOO.annotation_with_trailing_comma().value();` instead of `FOO.get_annotation_with_trailing_comma();`")]] - const ::std::string& get_annotation_with_trailing_comma() const& { - return __fbthrift_field_annotation_with_trailing_comma; - } + const ::std::string& get_annotation_with_trailing_comma() const&; /** Glean { "field": "annotation_with_trailing_comma" } */ [[deprecated("Use `FOO.annotation_with_trailing_comma().value();` instead of `FOO.get_annotation_with_trailing_comma();`")]] - ::std::string get_annotation_with_trailing_comma() && { - return static_cast<::std::string&&>(__fbthrift_field_annotation_with_trailing_comma); - } + ::std::string get_annotation_with_trailing_comma() &&; /** Glean { "field": "annotation_with_trailing_comma" } */ template @@ -948,15 +932,11 @@ class YourStruct final { /** Glean { "field": "empty_annotations" } */ [[deprecated("Use `FOO.empty_annotations().value();` instead of `FOO.get_empty_annotations();`")]] - const ::std::string& get_empty_annotations() const& { - return __fbthrift_field_empty_annotations; - } + const ::std::string& get_empty_annotations() const&; /** Glean { "field": "empty_annotations" } */ [[deprecated("Use `FOO.empty_annotations().value();` instead of `FOO.get_empty_annotations();`")]] - ::std::string get_empty_annotations() && { - return static_cast<::std::string&&>(__fbthrift_field_empty_annotations); - } + ::std::string get_empty_annotations() &&; /** Glean { "field": "empty_annotations" } */ template @@ -1154,15 +1134,11 @@ class MyStructNestedAnnotation 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 @@ -1504,15 +1480,11 @@ class SecretStruct final { /** Glean { "field": "password" } */ [[deprecated("Use `FOO.password().value();` instead of `FOO.get_password();`")]] - const ::std::string& get_password() const& { - return __fbthrift_field_password; - } + const ::std::string& get_password() const&; /** Glean { "field": "password" } */ [[deprecated("Use `FOO.password().value();` instead of `FOO.get_password();`")]] - ::std::string get_password() && { - return static_cast<::std::string&&>(__fbthrift_field_password); - } + ::std::string get_password() &&; /** Glean { "field": "password" } */ template diff --git a/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_types.cpp index f9dd1642fd6..65131ad2786 100644 --- a/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_types.cpp @@ -124,6 +124,14 @@ ::std::int64_t& MyStruct::set_MyIntField(::std::int64_t MyIntField_) { return __fbthrift_field_MyIntField; } +const ::std::string& MyStruct::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyStruct::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + void swap([[maybe_unused]] MyStruct& a, [[maybe_unused]] MyStruct& b) { using ::std::swap; swap(a.__fbthrift_field_MyIntField, b.__fbthrift_field_MyIntField); diff --git a/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_types.h index d304fe8f00b..c28d1211d06 100644 --- a/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/basic-stack-arguments/out/cpp2/gen-cpp2/module_types.h @@ -299,15 +299,11 @@ class MyStruct final { /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template diff --git a/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_types.cpp index 88dbf040eec..9f930f2adbc 100644 --- a/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_types.cpp @@ -204,6 +204,14 @@ ::std::int64_t& structured_annotation_inline::set_count(::std::int64_t count_) { return __fbthrift_field_count; } +const ::std::string& structured_annotation_inline::get_name() const& { + return __fbthrift_field_name; +} + +::std::string structured_annotation_inline::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + void swap([[maybe_unused]] structured_annotation_inline& a, [[maybe_unused]] structured_annotation_inline& b) { using ::std::swap; swap(a.__fbthrift_field_count, b.__fbthrift_field_count); @@ -307,6 +315,14 @@ bool structured_annotation_with_default::operator<([[maybe_unused]] const struct } +const ::std::string& structured_annotation_with_default::get_name() const& { + return __fbthrift_field_name; +} + +::std::string structured_annotation_with_default::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + void swap([[maybe_unused]] structured_annotation_with_default& a, [[maybe_unused]] structured_annotation_with_default& b) { using ::std::swap; swap(a.__fbthrift_field_name, b.__fbthrift_field_name); @@ -430,6 +446,14 @@ bool structured_annotation_recursive::operator<([[maybe_unused]] const structure } +const ::std::string& structured_annotation_recursive::get_name() const& { + return __fbthrift_field_name; +} + +::std::string structured_annotation_recursive::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + const ::test::fixtures::basic-structured-annotations::structured_annotation_forward& structured_annotation_recursive::get_forward() const& { return __fbthrift_field_forward; } @@ -649,6 +673,14 @@ bool structured_annotation_nested::operator<([[maybe_unused]] const structured_a } +const ::std::string& structured_annotation_nested::get_name() const& { + return __fbthrift_field_name; +} + +::std::string structured_annotation_nested::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + const ::test::fixtures::basic-structured-annotations::structured_annotation_with_default& structured_annotation_nested::get_nest() const& { return __fbthrift_field_nest; } @@ -791,6 +823,22 @@ ::std::int64_t& MyStruct::set_annotated_field(::std::int64_t annotated_field_) { return __fbthrift_field_annotated_field; } +const ::test::fixtures::basic-structured-annotations::annotated_inline_string& MyStruct::get_annotated_type() const& { + return __fbthrift_field_annotated_type; +} + +::test::fixtures::basic-structured-annotations::annotated_inline_string MyStruct::get_annotated_type() && { + return static_cast<::test::fixtures::basic-structured-annotations::annotated_inline_string&&>(__fbthrift_field_annotated_type); +} + +const ::std::string& MyStruct::get_annotated_recursive() const& { + return __fbthrift_field_annotated_recursive; +} + +::std::string MyStruct::get_annotated_recursive() && { + return static_cast<::std::string&&>(__fbthrift_field_annotated_recursive); +} + ::std::int64_t MyStruct::get_annotated_nested() const { return __fbthrift_field_annotated_nested; } @@ -904,6 +952,14 @@ bool MyException::operator<([[maybe_unused]] const MyException& rhs) const { } +const ::std::string& MyException::get_context() const& { + return __fbthrift_field_context; +} + +::std::string MyException::get_context() && { + return static_cast<::std::string&&>(__fbthrift_field_context); +} + void swap([[maybe_unused]] MyException& a, [[maybe_unused]] MyException& b) { using ::std::swap; swap(a.__fbthrift_field_context, b.__fbthrift_field_context); diff --git a/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_types.h index f1cdcbe9f70..675b04fd220 100644 --- a/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_types.h @@ -490,15 +490,11 @@ class structured_annotation_inline 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 @@ -666,15 +662,11 @@ class structured_annotation_with_default 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 @@ -1107,15 +1099,11 @@ class structured_annotation_recursive 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 @@ -1351,15 +1339,11 @@ class structured_annotation_nested 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 @@ -1707,15 +1691,11 @@ class MyStruct final { /** Glean { "field": "annotated_type" } */ [[deprecated("Use `FOO.annotated_type().value();` instead of `FOO.get_annotated_type();`")]] - const ::test::fixtures::basic-structured-annotations::annotated_inline_string& get_annotated_type() const& { - return __fbthrift_field_annotated_type; - } + const ::test::fixtures::basic-structured-annotations::annotated_inline_string& get_annotated_type() const&; /** Glean { "field": "annotated_type" } */ [[deprecated("Use `FOO.annotated_type().value();` instead of `FOO.get_annotated_type();`")]] - ::test::fixtures::basic-structured-annotations::annotated_inline_string get_annotated_type() && { - return static_cast<::test::fixtures::basic-structured-annotations::annotated_inline_string&&>(__fbthrift_field_annotated_type); - } + ::test::fixtures::basic-structured-annotations::annotated_inline_string get_annotated_type() &&; /** Glean { "field": "annotated_type" } */ template @@ -1727,15 +1707,11 @@ class MyStruct final { /** Glean { "field": "annotated_recursive" } */ [[deprecated("Use `FOO.annotated_recursive().value();` instead of `FOO.get_annotated_recursive();`")]] - const ::std::string& get_annotated_recursive() const& { - return __fbthrift_field_annotated_recursive; - } + const ::std::string& get_annotated_recursive() const&; /** Glean { "field": "annotated_recursive" } */ [[deprecated("Use `FOO.annotated_recursive().value();` instead of `FOO.get_annotated_recursive();`")]] - ::std::string get_annotated_recursive() && { - return static_cast<::std::string&&>(__fbthrift_field_annotated_recursive); - } + ::std::string get_annotated_recursive() &&; /** Glean { "field": "annotated_recursive" } */ template @@ -1917,15 +1893,11 @@ class FOLLY_EXPORT MyException : public virtual apache::thrift::TException { /** Glean { "field": "context" } */ [[deprecated("Use `FOO.context().value();` instead of `FOO.get_context();`")]] - const ::std::string& get_context() const& { - return __fbthrift_field_context; - } + const ::std::string& get_context() const&; /** Glean { "field": "context" } */ [[deprecated("Use `FOO.context().value();` instead of `FOO.get_context();`")]] - ::std::string get_context() && { - return static_cast<::std::string&&>(__fbthrift_field_context); - } + ::std::string get_context() &&; /** Glean { "field": "context" } */ template diff --git a/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_types.cpp index 8ed7dc7b575..4e4c7587d5b 100644 --- a/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_types.cpp @@ -183,6 +183,14 @@ ::std::int64_t& MyStruct::set_MyIntField(::std::int64_t MyIntField_) { return __fbthrift_field_MyIntField; } +const ::std::string& MyStruct::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyStruct::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + const ::test::fixtures::basic::MyDataItemAlias& MyStruct::get_MyDataField() const& { return __fbthrift_field_MyDataField; } @@ -235,6 +243,14 @@ ::std::set MyStruct::get_floatSet() && { return static_cast<::std::set&&>(__fbthrift_field_floatSet); } +const ::std::string& MyStruct::get_no_hack_codegen_field() const& { + return __fbthrift_field_no_hack_codegen_field; +} + +::std::string MyStruct::get_no_hack_codegen_field() && { + return static_cast<::std::string&&>(__fbthrift_field_no_hack_codegen_field); +} + void swap([[maybe_unused]] MyStruct& a, [[maybe_unused]] MyStruct& b) { using ::std::swap; swap(a.__fbthrift_field_MyIntField, b.__fbthrift_field_MyIntField); @@ -755,6 +771,14 @@ ::std::int64_t& MyException::set_MyIntField(::std::int64_t MyIntField_) { return __fbthrift_field_MyIntField; } +const ::std::string& MyException::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyException::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + const ::test::fixtures::basic::MyStruct& MyException::get_myStruct() const& { return __fbthrift_field_myStruct; } @@ -916,6 +940,14 @@ ::std::int64_t& MyExceptionWithMessage::set_MyIntField(::std::int64_t MyIntField return __fbthrift_field_MyIntField; } +const ::std::string& MyExceptionWithMessage::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyExceptionWithMessage::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + const ::test::fixtures::basic::MyStruct& MyExceptionWithMessage::get_myStruct() const& { return __fbthrift_field_myStruct; } diff --git a/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_types.h index ab1c9ce471a..aceaa742b5b 100644 --- a/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_types.h @@ -938,15 +938,11 @@ class MyStruct final { /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template @@ -1022,15 +1018,11 @@ class MyStruct final { /** Glean { "field": "no_hack_codegen_field" } */ [[deprecated("Use `FOO.no_hack_codegen_field().value();` instead of `FOO.get_no_hack_codegen_field();`")]] - const ::std::string& get_no_hack_codegen_field() const& { - return __fbthrift_field_no_hack_codegen_field; - } + const ::std::string& get_no_hack_codegen_field() const&; /** Glean { "field": "no_hack_codegen_field" } */ [[deprecated("Use `FOO.no_hack_codegen_field().value();` instead of `FOO.get_no_hack_codegen_field();`")]] - ::std::string get_no_hack_codegen_field() && { - return static_cast<::std::string&&>(__fbthrift_field_no_hack_codegen_field); - } + ::std::string get_no_hack_codegen_field() &&; /** Glean { "field": "no_hack_codegen_field" } */ template @@ -2139,15 +2131,11 @@ class FOLLY_EXPORT MyException : public virtual apache::thrift::TException { /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template @@ -2522,15 +2510,11 @@ class FOLLY_EXPORT MyExceptionWithMessage : public virtual apache::thrift::TExce /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template diff --git a/thrift/compiler/test/fixtures/client-methods/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/client-methods/out/cpp2/gen-cpp2/module_types.cpp index 63375e53186..cc87b7accfe 100644 --- a/thrift/compiler/test/fixtures/client-methods/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/client-methods/out/cpp2/gen-cpp2/module_types.cpp @@ -92,6 +92,14 @@ bool EchoRequest::operator<([[maybe_unused]] const EchoRequest& rhs) const { } +const ::std::string& EchoRequest::get_text() const& { + return __fbthrift_field_text; +} + +::std::string EchoRequest::get_text() && { + return static_cast<::std::string&&>(__fbthrift_field_text); +} + void swap([[maybe_unused]] EchoRequest& a, [[maybe_unused]] EchoRequest& b) { using ::std::swap; swap(a.__fbthrift_field_text, b.__fbthrift_field_text); @@ -189,6 +197,14 @@ bool EchoResponse::operator<([[maybe_unused]] const EchoResponse& rhs) const { } +const ::std::string& EchoResponse::get_text() const& { + return __fbthrift_field_text; +} + +::std::string EchoResponse::get_text() && { + return static_cast<::std::string&&>(__fbthrift_field_text); +} + void swap([[maybe_unused]] EchoResponse& a, [[maybe_unused]] EchoResponse& b) { using ::std::swap; swap(a.__fbthrift_field_text, b.__fbthrift_field_text); diff --git a/thrift/compiler/test/fixtures/client-methods/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/client-methods/out/cpp2/gen-cpp2/module_types.h index 498809fca15..cf4f2cb039b 100644 --- a/thrift/compiler/test/fixtures/client-methods/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/client-methods/out/cpp2/gen-cpp2/module_types.h @@ -185,15 +185,11 @@ class EchoRequest final { /** Glean { "field": "text" } */ [[deprecated("Use `FOO.text().value();` instead of `FOO.get_text();`")]] - const ::std::string& get_text() const& { - return __fbthrift_field_text; - } + const ::std::string& get_text() const&; /** Glean { "field": "text" } */ [[deprecated("Use `FOO.text().value();` instead of `FOO.get_text();`")]] - ::std::string get_text() && { - return static_cast<::std::string&&>(__fbthrift_field_text); - } + ::std::string get_text() &&; /** Glean { "field": "text" } */ template @@ -360,15 +356,11 @@ class EchoResponse final { /** Glean { "field": "text" } */ [[deprecated("Use `FOO.text().value();` instead of `FOO.get_text();`")]] - const ::std::string& get_text() const& { - return __fbthrift_field_text; - } + const ::std::string& get_text() const&; /** Glean { "field": "text" } */ [[deprecated("Use `FOO.text().value();` instead of `FOO.get_text();`")]] - ::std::string get_text() && { - return static_cast<::std::string&&>(__fbthrift_field_text); - } + ::std::string get_text() &&; /** Glean { "field": "text" } */ template diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.cpp index 409c3e26f18..4acbe922367 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.cpp @@ -145,6 +145,14 @@ ::std::int8_t& MyStructFloatFieldThrowExp::set_MyByteField(::std::int8_t MyByteF return __fbthrift_field_MyByteField; } +const ::std::string& MyStructFloatFieldThrowExp::get_myStringField() const& { + return __fbthrift_field_myStringField; +} + +::std::string MyStructFloatFieldThrowExp::get_myStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_myStringField); +} + float MyStructFloatFieldThrowExp::get_myFloatField() const { return __fbthrift_field_myFloatField; } @@ -525,6 +533,14 @@ ::std::int64_t& MyStruct::set_MyIntField(::std::int64_t MyIntField_) { return __fbthrift_field_MyIntField; } +const ::std::string& MyStruct::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyStruct::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + const ::cpp2::MyDataItem& MyStruct::get_MyDataField() const& { return __fbthrift_field_MyDataField; } @@ -897,6 +913,14 @@ ::std::int64_t& SimpleStruct::set_age(::std::int64_t age_) { return __fbthrift_field_age; } +const ::std::string& SimpleStruct::get_name() const& { + return __fbthrift_field_name; +} + +::std::string SimpleStruct::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + void swap([[maybe_unused]] SimpleStruct& a, [[maybe_unused]] SimpleStruct& b) { using ::std::swap; swap(a.__fbthrift_field_age, b.__fbthrift_field_age); @@ -1175,6 +1199,22 @@ ::std::int32_t& defaultStruct::set_portNum(::std::int32_t portNum_) { return __fbthrift_field_portNum; } +const ::std::string& defaultStruct::get_myBinaryDFset() const& { + return __fbthrift_field_myBinaryDFset; +} + +::std::string defaultStruct::get_myBinaryDFset() && { + return static_cast<::std::string&&>(__fbthrift_field_myBinaryDFset); +} + +const ::std::string& defaultStruct::get_myBinary() const& { + return __fbthrift_field_myBinary; +} + +::std::string defaultStruct::get_myBinary() && { + return static_cast<::std::string&&>(__fbthrift_field_myBinary); +} + ::std::int8_t defaultStruct::get_myByteDFSet() const { return __fbthrift_field_myByteDFSet; } @@ -1516,6 +1556,22 @@ ::cpp2::longTypeDef& MyStructTypeDef::set_myLongTypeDef(::cpp2::longTypeDef myLo return __fbthrift_field_myLongTypeDef; } +const ::std::string& MyStructTypeDef::get_myStringField() const& { + return __fbthrift_field_myStringField; +} + +::std::string MyStructTypeDef::get_myStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_myStringField); +} + +const ::cpp2::stringTypedef& MyStructTypeDef::get_myStringTypedef() const& { + return __fbthrift_field_myStringTypedef; +} + +::cpp2::stringTypedef MyStructTypeDef::get_myStringTypedef() && { + return static_cast<::cpp2::stringTypedef&&>(__fbthrift_field_myStringTypedef); +} + const ::std::map<::std::int16_t, ::std::string>& MyStructTypeDef::get_myMapField() const& { return __fbthrift_field_myMapField; } @@ -2498,6 +2554,14 @@ ::cpp2::i32_1194& TypeRemapped::set_BigInteger(::cpp2::i32_1194 BigInteger_) { return __fbthrift_field_BigInteger; } +const ::cpp2::binary_4918& TypeRemapped::get_binaryTestBuffer() const& { + return __fbthrift_field_binaryTestBuffer; +} + +::cpp2::binary_4918 TypeRemapped::get_binaryTestBuffer() && { + return static_cast<::cpp2::binary_4918&&>(__fbthrift_field_binaryTestBuffer); +} + void swap([[maybe_unused]] TypeRemapped& a, [[maybe_unused]] TypeRemapped& b) { using ::std::swap; swap(a.__fbthrift_field_lsMap, b.__fbthrift_field_lsMap); @@ -2683,6 +2747,14 @@ bool reqXcep::operator<([[maybe_unused]] const reqXcep& rhs) const { } +const ::std::string& reqXcep::get_message() const& { + return __fbthrift_field_message; +} + +::std::string reqXcep::get_message() && { + return static_cast<::std::string&&>(__fbthrift_field_message); +} + ::std::int32_t reqXcep::get_errorCode() const { return __fbthrift_field_errorCode; } @@ -2941,6 +3013,14 @@ bool complexException::operator<([[maybe_unused]] const complexException& rhs) c } +const ::std::string& complexException::get_message() const& { + return __fbthrift_field_message; +} + +::std::string complexException::get_message() && { + return static_cast<::std::string&&>(__fbthrift_field_message); +} + const ::std::vector<::std::string>& complexException::get_listStrings() const& { return __fbthrift_field_listStrings; } diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.h index ea2a23e7ab6..b789c73b995 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.h @@ -983,15 +983,11 @@ class MyStructFloatFieldThrowExp final { /** Glean { "field": "myStringField" } */ [[deprecated("Use `FOO.myStringField().value();` instead of `FOO.get_myStringField();`")]] - const ::std::string& get_myStringField() const& { - return __fbthrift_field_myStringField; - } + const ::std::string& get_myStringField() const&; /** Glean { "field": "myStringField" } */ [[deprecated("Use `FOO.myStringField().value();` instead of `FOO.get_myStringField();`")]] - ::std::string get_myStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_myStringField); - } + ::std::string get_myStringField() &&; /** Glean { "field": "myStringField" } */ template @@ -2908,15 +2904,11 @@ class MyStruct final { /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template @@ -3511,15 +3503,11 @@ class SimpleStruct 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 @@ -6733,15 +6721,11 @@ class defaultStruct final { /** Glean { "field": "myBinaryDFset" } */ [[deprecated("Use `FOO.myBinaryDFset().value();` instead of `FOO.get_myBinaryDFset();`")]] - const ::std::string& get_myBinaryDFset() const& { - return __fbthrift_field_myBinaryDFset; - } + const ::std::string& get_myBinaryDFset() const&; /** Glean { "field": "myBinaryDFset" } */ [[deprecated("Use `FOO.myBinaryDFset().value();` instead of `FOO.get_myBinaryDFset();`")]] - ::std::string get_myBinaryDFset() && { - return static_cast<::std::string&&>(__fbthrift_field_myBinaryDFset); - } + ::std::string get_myBinaryDFset() &&; /** Glean { "field": "myBinaryDFset" } */ template @@ -6753,15 +6737,11 @@ class defaultStruct final { /** Glean { "field": "myBinary" } */ [[deprecated("Use `FOO.myBinary().value();` instead of `FOO.get_myBinary();`")]] - const ::std::string& get_myBinary() const& { - return __fbthrift_field_myBinary; - } + const ::std::string& get_myBinary() const&; /** Glean { "field": "myBinary" } */ [[deprecated("Use `FOO.myBinary().value();` instead of `FOO.get_myBinary();`")]] - ::std::string get_myBinary() && { - return static_cast<::std::string&&>(__fbthrift_field_myBinary); - } + ::std::string get_myBinary() &&; /** Glean { "field": "myBinary" } */ template @@ -7576,15 +7556,11 @@ class MyStructTypeDef final { /** Glean { "field": "myStringField" } */ [[deprecated("Use `FOO.myStringField().value();` instead of `FOO.get_myStringField();`")]] - const ::std::string& get_myStringField() const& { - return __fbthrift_field_myStringField; - } + const ::std::string& get_myStringField() const&; /** Glean { "field": "myStringField" } */ [[deprecated("Use `FOO.myStringField().value();` instead of `FOO.get_myStringField();`")]] - ::std::string get_myStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_myStringField); - } + ::std::string get_myStringField() &&; /** Glean { "field": "myStringField" } */ template @@ -7596,15 +7572,11 @@ class MyStructTypeDef final { /** Glean { "field": "myStringTypedef" } */ [[deprecated("Use `FOO.myStringTypedef().value();` instead of `FOO.get_myStringTypedef();`")]] - const ::cpp2::stringTypedef& get_myStringTypedef() const& { - return __fbthrift_field_myStringTypedef; - } + const ::cpp2::stringTypedef& get_myStringTypedef() const&; /** Glean { "field": "myStringTypedef" } */ [[deprecated("Use `FOO.myStringTypedef().value();` instead of `FOO.get_myStringTypedef();`")]] - ::cpp2::stringTypedef get_myStringTypedef() && { - return static_cast<::cpp2::stringTypedef&&>(__fbthrift_field_myStringTypedef); - } + ::cpp2::stringTypedef get_myStringTypedef() &&; /** Glean { "field": "myStringTypedef" } */ template @@ -8509,15 +8481,11 @@ class TypeRemapped final { /** Glean { "field": "binaryTestBuffer" } */ [[deprecated("Use `FOO.binaryTestBuffer().value();` instead of `FOO.get_binaryTestBuffer();`")]] - const ::cpp2::binary_4918& get_binaryTestBuffer() const& { - return __fbthrift_field_binaryTestBuffer; - } + const ::cpp2::binary_4918& get_binaryTestBuffer() const&; /** Glean { "field": "binaryTestBuffer" } */ [[deprecated("Use `FOO.binaryTestBuffer().value();` instead of `FOO.get_binaryTestBuffer();`")]] - ::cpp2::binary_4918 get_binaryTestBuffer() && { - return static_cast<::cpp2::binary_4918&&>(__fbthrift_field_binaryTestBuffer); - } + ::cpp2::binary_4918 get_binaryTestBuffer() &&; /** Glean { "field": "binaryTestBuffer" } */ template @@ -8851,15 +8819,11 @@ class FOLLY_EXPORT reqXcep : public virtual apache::thrift::TException { /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - const ::std::string& get_message() const& { - return __fbthrift_field_message; - } + const ::std::string& get_message() const&; /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - ::std::string get_message() && { - return static_cast<::std::string&&>(__fbthrift_field_message); - } + ::std::string get_message() &&; /** Glean { "field": "message" } */ template @@ -9553,15 +9517,11 @@ class FOLLY_EXPORT complexException : public virtual apache::thrift::TException /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - const ::std::string& get_message() const& { - return __fbthrift_field_message; - } + const ::std::string& get_message() const&; /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - ::std::string get_message() && { - return static_cast<::std::string&&>(__fbthrift_field_message); - } + ::std::string get_message() &&; /** Glean { "field": "message" } */ template diff --git a/thrift/compiler/test/fixtures/complex-union/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/complex-union/out/cpp2/gen-cpp2/module_types.cpp index ee57d810596..26a984bd728 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/complex-union/out/cpp2/gen-cpp2/module_types.cpp @@ -543,6 +543,14 @@ bool Val::operator<([[maybe_unused]] const Val& rhs) const { } +const ::std::string& Val::get_strVal() const& { + return __fbthrift_field_strVal; +} + +::std::string Val::get_strVal() && { + return static_cast<::std::string&&>(__fbthrift_field_strVal); +} + ::std::int32_t Val::get_intVal() const { return __fbthrift_field_intVal; } diff --git a/thrift/compiler/test/fixtures/complex-union/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/complex-union/out/cpp2/gen-cpp2/module_types.h index 30dfbf0195f..f110225fbf7 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/complex-union/out/cpp2/gen-cpp2/module_types.h @@ -1645,15 +1645,11 @@ class Val final { /** Glean { "field": "strVal" } */ [[deprecated("Use `FOO.strVal().value();` instead of `FOO.get_strVal();`")]] - const ::std::string& get_strVal() const& { - return __fbthrift_field_strVal; - } + const ::std::string& get_strVal() const&; /** Glean { "field": "strVal" } */ [[deprecated("Use `FOO.strVal().value();` instead of `FOO.get_strVal();`")]] - ::std::string get_strVal() && { - return static_cast<::std::string&&>(__fbthrift_field_strVal); - } + ::std::string get_strVal() &&; /** Glean { "field": "strVal" } */ template diff --git a/thrift/compiler/test/fixtures/constants/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/constants/out/cpp2/gen-cpp2/module_types.cpp index ed366bcd830..b4b0088b563 100644 --- a/thrift/compiler/test/fixtures/constants/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/constants/out/cpp2/gen-cpp2/module_types.cpp @@ -174,6 +174,14 @@ ::std::int32_t& Internship::set_weeks(::std::int32_t weeks_) { return __fbthrift_field_weeks; } +const ::std::string& Internship::get_title() const& { + return __fbthrift_field_title; +} + +::std::string Internship::get_title() && { + return static_cast<::std::string&&>(__fbthrift_field_title); +} + const ::cpp2::Company* Internship::get_employer() const& { return employer_ref().has_value() ? std::addressof(__fbthrift_field_employer) : nullptr; } @@ -421,6 +429,14 @@ ::std::int32_t& struct1::set_a(::std::int32_t a_) { return __fbthrift_field_a; } +const ::std::string& struct1::get_b() const& { + return __fbthrift_field_b; +} + +::std::string struct1::get_b() && { + return static_cast<::std::string&&>(__fbthrift_field_b); +} + void swap([[maybe_unused]] struct1& a, [[maybe_unused]] struct1& b) { using ::std::swap; swap(a.__fbthrift_field_a, b.__fbthrift_field_a); @@ -544,6 +560,14 @@ ::std::int32_t& struct2::set_a(::std::int32_t a_) { return __fbthrift_field_a; } +const ::std::string& struct2::get_b() const& { + return __fbthrift_field_b; +} + +::std::string struct2::get_b() && { + return static_cast<::std::string&&>(__fbthrift_field_b); +} + const ::cpp2::struct1& struct2::get_c() const& { return __fbthrift_field_c; } @@ -677,6 +701,14 @@ bool struct3::operator<([[maybe_unused]] const struct3& rhs) const { } +const ::std::string& struct3::get_a() const& { + return __fbthrift_field_a; +} + +::std::string struct3::get_a() && { + return static_cast<::std::string&&>(__fbthrift_field_a); +} + ::std::int32_t struct3::get_b() const { return __fbthrift_field_b; } diff --git a/thrift/compiler/test/fixtures/constants/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/constants/out/cpp2/gen-cpp2/module_types.h index 9204bd1de35..7fa6f9c33a2 100644 --- a/thrift/compiler/test/fixtures/constants/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/constants/out/cpp2/gen-cpp2/module_types.h @@ -672,15 +672,11 @@ class Internship final { /** Glean { "field": "title" } */ [[deprecated("Use `FOO.title().value();` instead of `FOO.get_title();`")]] - const ::std::string& get_title() const& { - return __fbthrift_field_title; - } + const ::std::string& get_title() const&; /** Glean { "field": "title" } */ [[deprecated("Use `FOO.title().value();` instead of `FOO.get_title();`")]] - ::std::string get_title() && { - return static_cast<::std::string&&>(__fbthrift_field_title); - } + ::std::string get_title() &&; /** Glean { "field": "title" } */ template @@ -1174,15 +1170,11 @@ class struct1 final { /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - const ::std::string& get_b() const& { - return __fbthrift_field_b; - } + const ::std::string& get_b() const&; /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - ::std::string get_b() && { - return static_cast<::std::string&&>(__fbthrift_field_b); - } + ::std::string get_b() &&; /** Glean { "field": "b" } */ template @@ -1513,15 +1505,11 @@ class struct2 final { /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - const ::std::string& get_b() const& { - return __fbthrift_field_b; - } + const ::std::string& get_b() const&; /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - ::std::string get_b() && { - return static_cast<::std::string&&>(__fbthrift_field_b); - } + ::std::string get_b() &&; /** Glean { "field": "b" } */ template @@ -1824,15 +1812,11 @@ class struct3 final { /** Glean { "field": "a" } */ [[deprecated("Use `FOO.a().value();` instead of `FOO.get_a();`")]] - const ::std::string& get_a() const& { - return __fbthrift_field_a; - } + const ::std::string& get_a() const&; /** Glean { "field": "a" } */ [[deprecated("Use `FOO.a().value();` instead of `FOO.get_a();`")]] - ::std::string get_a() && { - return static_cast<::std::string&&>(__fbthrift_field_a); - } + ::std::string get_a() &&; /** Glean { "field": "a" } */ template diff --git a/thrift/compiler/test/fixtures/deprecated-clear/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/deprecated-clear/out/cpp2/gen-cpp2/module_types.cpp index e3fb9af3a4d..1508eb0ad6f 100644 --- a/thrift/compiler/test/fixtures/deprecated-clear/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/deprecated-clear/out/cpp2/gen-cpp2/module_types.cpp @@ -245,6 +245,22 @@ double& StructWithDefaultStruct::set_double_field(double double_field_) { return __fbthrift_field_double_field; } +const ::std::string& StructWithDefaultStruct::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::std::string StructWithDefaultStruct::get_string_field() && { + return static_cast<::std::string&&>(__fbthrift_field_string_field); +} + +const ::std::string& StructWithDefaultStruct::get_binary_field() const& { + return __fbthrift_field_binary_field; +} + +::std::string StructWithDefaultStruct::get_binary_field() && { + return static_cast<::std::string&&>(__fbthrift_field_binary_field); +} + ::apache::thrift::test::MyEnum StructWithDefaultStruct::get_enum_field() const { return __fbthrift_field_enum_field; } diff --git a/thrift/compiler/test/fixtures/deprecated-clear/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/deprecated-clear/out/cpp2/gen-cpp2/module_types.h index e4c29a305c8..e97048397d9 100644 --- a/thrift/compiler/test/fixtures/deprecated-clear/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/deprecated-clear/out/cpp2/gen-cpp2/module_types.h @@ -974,15 +974,11 @@ class StructWithDefaultStruct final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::std::string& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::std::string& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::std::string get_string_field() && { - return static_cast<::std::string&&>(__fbthrift_field_string_field); - } + ::std::string get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -994,15 +990,11 @@ class StructWithDefaultStruct final { /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - const ::std::string& get_binary_field() const& { - return __fbthrift_field_binary_field; - } + const ::std::string& get_binary_field() const&; /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - ::std::string get_binary_field() && { - return static_cast<::std::string&&>(__fbthrift_field_binary_field); - } + ::std::string get_binary_field() &&; /** Glean { "field": "binary_field" } */ template diff --git a/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_types.cpp index 92564c7b60e..229e7826053 100644 --- a/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_types.cpp @@ -330,6 +330,14 @@ bool Bang::operator<([[maybe_unused]] const Bang& rhs) const { } +const ::std::string& Bang::get_message() const& { + return __fbthrift_field_message; +} + +::std::string Bang::get_message() && { + return static_cast<::std::string&&>(__fbthrift_field_message); +} + void swap([[maybe_unused]] Bang& a, [[maybe_unused]] Bang& b) { using ::std::swap; swap(a.__fbthrift_field_message, b.__fbthrift_field_message); diff --git a/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_types.h index 60790b2e643..605beeb0795 100644 --- a/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_types.h @@ -715,15 +715,11 @@ class FOLLY_EXPORT Bang : public virtual apache::thrift::TException { /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - const ::std::string& get_message() const& { - return __fbthrift_field_message; - } + const ::std::string& get_message() const&; /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - ::std::string get_message() && { - return static_cast<::std::string&&>(__fbthrift_field_message); - } + ::std::string get_message() &&; /** Glean { "field": "message" } */ template diff --git a/thrift/compiler/test/fixtures/emptiable/out/cpp2_deprecated_terse_writes/gen-cpp2/simple_deprecated_terse_writes_types.cpp b/thrift/compiler/test/fixtures/emptiable/out/cpp2_deprecated_terse_writes/gen-cpp2/simple_deprecated_terse_writes_types.cpp index 50670705f85..b69a4c5e28d 100644 --- a/thrift/compiler/test/fixtures/emptiable/out/cpp2_deprecated_terse_writes/gen-cpp2/simple_deprecated_terse_writes_types.cpp +++ b/thrift/compiler/test/fixtures/emptiable/out/cpp2_deprecated_terse_writes/gen-cpp2/simple_deprecated_terse_writes_types.cpp @@ -328,6 +328,22 @@ double& EmptiableStruct::set_double_field(double double_field_) { return __fbthrift_field_double_field; } +const ::std::string& EmptiableStruct::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::std::string EmptiableStruct::get_string_field() && { + return static_cast<::std::string&&>(__fbthrift_field_string_field); +} + +const ::std::string& EmptiableStruct::get_binary_field() const& { + return __fbthrift_field_binary_field; +} + +::std::string EmptiableStruct::get_binary_field() && { + return static_cast<::std::string&&>(__fbthrift_field_binary_field); +} + ::apache::thrift::test::MyEnum EmptiableStruct::get_enum_field() const { return __fbthrift_field_enum_field; } @@ -620,6 +636,22 @@ double& NotEmptiableStruct::set_double_field(double double_field_) { return __fbthrift_field_double_field; } +const ::std::string& NotEmptiableStruct::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::std::string NotEmptiableStruct::get_string_field() && { + return static_cast<::std::string&&>(__fbthrift_field_string_field); +} + +const ::std::string& NotEmptiableStruct::get_binary_field() const& { + return __fbthrift_field_binary_field; +} + +::std::string NotEmptiableStruct::get_binary_field() && { + return static_cast<::std::string&&>(__fbthrift_field_binary_field); +} + ::apache::thrift::test::MyEnum NotEmptiableStruct::get_enum_field() const { return __fbthrift_field_enum_field; } diff --git a/thrift/compiler/test/fixtures/emptiable/out/cpp2_deprecated_terse_writes/gen-cpp2/simple_deprecated_terse_writes_types.h b/thrift/compiler/test/fixtures/emptiable/out/cpp2_deprecated_terse_writes/gen-cpp2/simple_deprecated_terse_writes_types.h index 7e796335547..4cde71b5b17 100644 --- a/thrift/compiler/test/fixtures/emptiable/out/cpp2_deprecated_terse_writes/gen-cpp2/simple_deprecated_terse_writes_types.h +++ b/thrift/compiler/test/fixtures/emptiable/out/cpp2_deprecated_terse_writes/gen-cpp2/simple_deprecated_terse_writes_types.h @@ -1202,15 +1202,11 @@ class EmptiableStruct final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::std::string& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::std::string& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::std::string get_string_field() && { - return static_cast<::std::string&&>(__fbthrift_field_string_field); - } + ::std::string get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -1222,15 +1218,11 @@ class EmptiableStruct final { /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - const ::std::string& get_binary_field() const& { - return __fbthrift_field_binary_field; - } + const ::std::string& get_binary_field() const&; /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - ::std::string get_binary_field() && { - return static_cast<::std::string&&>(__fbthrift_field_binary_field); - } + ::std::string get_binary_field() &&; /** Glean { "field": "binary_field" } */ template @@ -2203,15 +2195,11 @@ class NotEmptiableStruct final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::std::string& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::std::string& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::std::string get_string_field() && { - return static_cast<::std::string&&>(__fbthrift_field_string_field); - } + ::std::string get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -2223,15 +2211,11 @@ class NotEmptiableStruct final { /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - const ::std::string& get_binary_field() const& { - return __fbthrift_field_binary_field; - } + const ::std::string& get_binary_field() const&; /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - ::std::string get_binary_field() && { - return static_cast<::std::string&&>(__fbthrift_field_binary_field); - } + ::std::string get_binary_field() &&; /** Glean { "field": "binary_field" } */ template diff --git a/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_types.cpp index 5831459c02f..e99803f4d4d 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_types.cpp @@ -92,6 +92,14 @@ bool Fiery::operator<([[maybe_unused]] const Fiery& rhs) const { } +const ::std::string& Fiery::get_message() const& { + return __fbthrift_field_message; +} + +::std::string Fiery::get_message() && { + return static_cast<::std::string&&>(__fbthrift_field_message); +} + void swap([[maybe_unused]] Fiery& a, [[maybe_unused]] Fiery& b) { using ::std::swap; swap(a.__fbthrift_field_message, b.__fbthrift_field_message); @@ -306,6 +314,22 @@ bool ComplexFieldNames::operator<([[maybe_unused]] const ComplexFieldNames& rhs) } +const ::std::string& ComplexFieldNames::get_error_message() const& { + return __fbthrift_field_error_message; +} + +::std::string ComplexFieldNames::get_error_message() && { + return static_cast<::std::string&&>(__fbthrift_field_error_message); +} + +const ::std::string& ComplexFieldNames::get_internal_error_message() const& { + return __fbthrift_field_internal_error_message; +} + +::std::string ComplexFieldNames::get_internal_error_message() && { + return static_cast<::std::string&&>(__fbthrift_field_internal_error_message); +} + void swap([[maybe_unused]] ComplexFieldNames& a, [[maybe_unused]] ComplexFieldNames& b) { using ::std::swap; swap(a.__fbthrift_field_error_message, b.__fbthrift_field_error_message); @@ -413,6 +437,22 @@ bool CustomFieldNames::operator<([[maybe_unused]] const CustomFieldNames& rhs) c } +const ::std::string& CustomFieldNames::get_error_message() const& { + return __fbthrift_field_error_message; +} + +::std::string CustomFieldNames::get_error_message() && { + return static_cast<::std::string&&>(__fbthrift_field_error_message); +} + +const ::std::string& CustomFieldNames::get_internal_error_message() const& { + return __fbthrift_field_internal_error_message; +} + +::std::string CustomFieldNames::get_internal_error_message() && { + return static_cast<::std::string&&>(__fbthrift_field_internal_error_message); +} + void swap([[maybe_unused]] CustomFieldNames& a, [[maybe_unused]] CustomFieldNames& b) { using ::std::swap; swap(a.__fbthrift_field_error_message, b.__fbthrift_field_error_message); @@ -521,6 +561,14 @@ bool ExceptionWithPrimitiveField::operator<([[maybe_unused]] const ExceptionWith } +const ::std::string& ExceptionWithPrimitiveField::get_message() const& { + return __fbthrift_field_message; +} + +::std::string ExceptionWithPrimitiveField::get_message() && { + return static_cast<::std::string&&>(__fbthrift_field_message); +} + ::std::int32_t ExceptionWithPrimitiveField::get_error_code() const { return __fbthrift_field_error_code; } @@ -638,6 +686,14 @@ bool ExceptionWithStructuredAnnotation::operator<([[maybe_unused]] const Excepti } +const ::std::string& ExceptionWithStructuredAnnotation::get_message_field() const& { + return __fbthrift_field_message_field; +} + +::std::string ExceptionWithStructuredAnnotation::get_message_field() && { + return static_cast<::std::string&&>(__fbthrift_field_message_field); +} + ::std::int32_t ExceptionWithStructuredAnnotation::get_error_code() const { return __fbthrift_field_error_code; } diff --git a/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_types.h index 57c701d4946..c27cc483d4f 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_types.h @@ -235,15 +235,11 @@ class FOLLY_EXPORT Fiery : public virtual apache::thrift::TException { /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - const ::std::string& get_message() const& { - return __fbthrift_field_message; - } + const ::std::string& get_message() const&; /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - ::std::string get_message() && { - return static_cast<::std::string&&>(__fbthrift_field_message); - } + ::std::string get_message() &&; /** Glean { "field": "message" } */ template @@ -657,15 +653,11 @@ class FOLLY_EXPORT ComplexFieldNames : public virtual apache::thrift::TException /** Glean { "field": "error_message" } */ [[deprecated("Use `FOO.error_message().value();` instead of `FOO.get_error_message();`")]] - const ::std::string& get_error_message() const& { - return __fbthrift_field_error_message; - } + const ::std::string& get_error_message() const&; /** Glean { "field": "error_message" } */ [[deprecated("Use `FOO.error_message().value();` instead of `FOO.get_error_message();`")]] - ::std::string get_error_message() && { - return static_cast<::std::string&&>(__fbthrift_field_error_message); - } + ::std::string get_error_message() &&; /** Glean { "field": "error_message" } */ template @@ -677,15 +669,11 @@ class FOLLY_EXPORT ComplexFieldNames : public virtual apache::thrift::TException /** Glean { "field": "internal_error_message" } */ [[deprecated("Use `FOO.internal_error_message().value();` instead of `FOO.get_internal_error_message();`")]] - const ::std::string& get_internal_error_message() const& { - return __fbthrift_field_internal_error_message; - } + const ::std::string& get_internal_error_message() const&; /** Glean { "field": "internal_error_message" } */ [[deprecated("Use `FOO.internal_error_message().value();` instead of `FOO.get_internal_error_message();`")]] - ::std::string get_internal_error_message() && { - return static_cast<::std::string&&>(__fbthrift_field_internal_error_message); - } + ::std::string get_internal_error_message() &&; /** Glean { "field": "internal_error_message" } */ template @@ -915,15 +903,11 @@ class FOLLY_EXPORT CustomFieldNames : public virtual apache::thrift::TException /** Glean { "field": "error_message" } */ [[deprecated("Use `FOO.error_message().value();` instead of `FOO.get_error_message();`")]] - const ::std::string& get_error_message() const& { - return __fbthrift_field_error_message; - } + const ::std::string& get_error_message() const&; /** Glean { "field": "error_message" } */ [[deprecated("Use `FOO.error_message().value();` instead of `FOO.get_error_message();`")]] - ::std::string get_error_message() && { - return static_cast<::std::string&&>(__fbthrift_field_error_message); - } + ::std::string get_error_message() &&; /** Glean { "field": "error_message" } */ template @@ -935,15 +919,11 @@ class FOLLY_EXPORT CustomFieldNames : public virtual apache::thrift::TException /** Glean { "field": "internal_error_message" } */ [[deprecated("Use `FOO.internal_error_message().value();` instead of `FOO.get_internal_error_message();`")]] - const ::std::string& get_internal_error_message() const& { - return __fbthrift_field_internal_error_message; - } + const ::std::string& get_internal_error_message() const&; /** Glean { "field": "internal_error_message" } */ [[deprecated("Use `FOO.internal_error_message().value();` instead of `FOO.get_internal_error_message();`")]] - ::std::string get_internal_error_message() && { - return static_cast<::std::string&&>(__fbthrift_field_internal_error_message); - } + ::std::string get_internal_error_message() &&; /** Glean { "field": "internal_error_message" } */ template @@ -1173,15 +1153,11 @@ class FOLLY_EXPORT ExceptionWithPrimitiveField : public virtual apache::thrift:: /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - const ::std::string& get_message() const& { - return __fbthrift_field_message; - } + const ::std::string& get_message() const&; /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - ::std::string get_message() && { - return static_cast<::std::string&&>(__fbthrift_field_message); - } + ::std::string get_message() &&; /** Glean { "field": "message" } */ template @@ -1419,15 +1395,11 @@ class FOLLY_EXPORT ExceptionWithStructuredAnnotation : public virtual apache::th /** Glean { "field": "message_field" } */ [[deprecated("Use `FOO.message_field().value();` instead of `FOO.get_message_field();`")]] - const ::std::string& get_message_field() const& { - return __fbthrift_field_message_field; - } + const ::std::string& get_message_field() const&; /** Glean { "field": "message_field" } */ [[deprecated("Use `FOO.message_field().value();` instead of `FOO.get_message_field();`")]] - ::std::string get_message_field() && { - return static_cast<::std::string&&>(__fbthrift_field_message_field); - } + ::std::string get_message_field() &&; /** Glean { "field": "message_field" } */ template diff --git a/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_types.cpp index 4755cf347d1..2a25183294c 100644 --- a/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_types.cpp @@ -631,6 +631,14 @@ ::std::int32_t& structA::set_a(::std::int32_t a_) { return __fbthrift_field_a; } +const ::std::string& structA::get_b() const& { + return __fbthrift_field_b; +} + +::std::string structA::get_b() && { + return static_cast<::std::string&&>(__fbthrift_field_b); +} + void swap([[maybe_unused]] structA& a, [[maybe_unused]] structA& b) { using ::std::swap; swap(a.__fbthrift_field_a, b.__fbthrift_field_a); @@ -1155,6 +1163,14 @@ ::std::int32_t& structC::set_a(::std::int32_t a_) { return __fbthrift_field_a; } +const ::std::string& structC::get_b() const& { + return __fbthrift_field_b; +} + +::std::string structC::get_b() && { + return static_cast<::std::string&&>(__fbthrift_field_b); +} + double structC::get_c() const { return __fbthrift_field_c; } @@ -1808,6 +1824,14 @@ ::std::int32_t& struct2::set_fieldA(::std::int32_t fieldA_) { return __fbthrift_field_fieldA; } +const ::std::string& struct2::get_fieldB() const& { + return __fbthrift_field_fieldB; +} + +::std::string struct2::get_fieldB() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldB); +} + ::test_cpp2::cpp_reflection::enum1 struct2::get_fieldC() const { return __fbthrift_field_fieldC; } @@ -2059,6 +2083,14 @@ bool struct3::operator<([[maybe_unused]] const struct3& rhs) const { } +const ::std::string& struct3::get_fieldB() const& { + return __fbthrift_field_fieldB; +} + +::std::string struct3::get_fieldB() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldB); +} + ::test_cpp2::cpp_reflection::enum1 struct3::get_fieldC() const { return __fbthrift_field_fieldC; } @@ -2689,6 +2721,14 @@ bool struct_binary::operator<([[maybe_unused]] const struct_binary& rhs) const { } +const ::std::string& struct_binary::get_bi() const& { + return __fbthrift_field_bi; +} + +::std::string struct_binary::get_bi() && { + return static_cast<::std::string&&>(__fbthrift_field_bi); +} + void swap([[maybe_unused]] struct_binary& a, [[maybe_unused]] struct_binary& b) { using ::std::swap; swap(a.__fbthrift_field_bi, b.__fbthrift_field_bi); @@ -3986,6 +4026,14 @@ ::test_cpp2::cpp_reflection::HasAResult& struct_with_indirections::set_result(:: return __fbthrift_field_result; } +const ::test_cpp2::cpp_reflection::HasAPhrase& struct_with_indirections::get_phrase() const& { + return __fbthrift_field_phrase; +} + +::test_cpp2::cpp_reflection::HasAPhrase struct_with_indirections::get_phrase() && { + return static_cast<::test_cpp2::cpp_reflection::HasAPhrase&&>(__fbthrift_field_phrase); +} + void swap([[maybe_unused]] struct_with_indirections& a, [[maybe_unused]] struct_with_indirections& b) { using ::std::swap; swap(a.__fbthrift_field_real, b.__fbthrift_field_real); diff --git a/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_types.h index 50f9e7fbf05..8499a1bb9bd 100644 --- a/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_types.h @@ -2572,15 +2572,11 @@ class structA final { /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - const ::std::string& get_b() const& { - return __fbthrift_field_b; - } + const ::std::string& get_b() const&; /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - ::std::string get_b() && { - return static_cast<::std::string&&>(__fbthrift_field_b); - } + ::std::string get_b() &&; /** Glean { "field": "b" } */ template @@ -4998,15 +4994,11 @@ class structC final { /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - const ::std::string& get_b() const& { - return __fbthrift_field_b; - } + const ::std::string& get_b() const&; /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - ::std::string get_b() && { - return static_cast<::std::string&&>(__fbthrift_field_b); - } + ::std::string get_b() &&; /** Glean { "field": "b" } */ template @@ -6400,15 +6392,11 @@ class struct2 final { /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - const ::std::string& get_fieldB() const& { - return __fbthrift_field_fieldB; - } + const ::std::string& get_fieldB() const&; /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - ::std::string get_fieldB() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldB); - } + ::std::string get_fieldB() &&; /** Glean { "field": "fieldB" } */ template @@ -7523,15 +7511,11 @@ class struct3 final { /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - const ::std::string& get_fieldB() const& { - return __fbthrift_field_fieldB; - } + const ::std::string& get_fieldB() const&; /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - ::std::string get_fieldB() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldB); - } + ::std::string get_fieldB() &&; /** Glean { "field": "fieldB" } */ template @@ -8710,15 +8694,11 @@ class struct_binary final { /** Glean { "field": "bi" } */ [[deprecated("Use `FOO.bi().value();` instead of `FOO.get_bi();`")]] - const ::std::string& get_bi() const& { - return __fbthrift_field_bi; - } + const ::std::string& get_bi() const&; /** Glean { "field": "bi" } */ [[deprecated("Use `FOO.bi().value();` instead of `FOO.get_bi();`")]] - ::std::string get_bi() && { - return static_cast<::std::string&&>(__fbthrift_field_bi); - } + ::std::string get_bi() &&; /** Glean { "field": "bi" } */ template @@ -13706,15 +13686,11 @@ class struct_with_indirections final { /** Glean { "field": "phrase" } */ [[deprecated("Use `FOO.phrase().value();` instead of `FOO.get_phrase();`")]] - const ::test_cpp2::cpp_reflection::HasAPhrase& get_phrase() const& { - return __fbthrift_field_phrase; - } + const ::test_cpp2::cpp_reflection::HasAPhrase& get_phrase() const&; /** Glean { "field": "phrase" } */ [[deprecated("Use `FOO.phrase().value();` instead of `FOO.get_phrase();`")]] - ::test_cpp2::cpp_reflection::HasAPhrase get_phrase() && { - return static_cast<::test_cpp2::cpp_reflection::HasAPhrase&&>(__fbthrift_field_phrase); - } + ::test_cpp2::cpp_reflection::HasAPhrase get_phrase() &&; /** Glean { "field": "phrase" } */ template diff --git a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2/gen-cpp2/module_types.cpp index f6c48a7b7be..70a19beba3c 100644 --- a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2/gen-cpp2/module_types.cpp @@ -144,6 +144,14 @@ ::std::int32_t& ModuleA::set_i32Field(::std::int32_t i32Field_) { return __fbthrift_field_i32Field; } +const ::std::string& ModuleA::get_strField() const& { + return __fbthrift_field_strField; +} + +::std::string ModuleA::get_strField() && { + return static_cast<::std::string&&>(__fbthrift_field_strField); +} + const ::std::vector<::std::int16_t>& ModuleA::get_listField() const& { return __fbthrift_field_listField; } diff --git a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2/gen-cpp2/module_types.h index 333f1860e26..d2c056210ae 100644 --- a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2/gen-cpp2/module_types.h @@ -579,15 +579,11 @@ class ModuleA final { /** Glean { "field": "strField" } */ [[deprecated("Use `FOO.strField().value();` instead of `FOO.get_strField();`")]] - const ::std::string& get_strField() const& { - return __fbthrift_field_strField; - } + const ::std::string& get_strField() const&; /** Glean { "field": "strField" } */ [[deprecated("Use `FOO.strField().value();` instead of `FOO.get_strField();`")]] - ::std::string get_strField() && { - return static_cast<::std::string&&>(__fbthrift_field_strField); - } + ::std::string get_strField() &&; /** Glean { "field": "strField" } */ template diff --git a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include1/gen-cpp2/include1_types.cpp b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include1/gen-cpp2/include1_types.cpp index 57dc67f62b3..b787ffdf12f 100644 --- a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include1/gen-cpp2/include1_types.cpp +++ b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include1/gen-cpp2/include1_types.cpp @@ -107,6 +107,14 @@ ::std::int32_t& IncludedA::set_i32Field(::std::int32_t i32Field_) { return __fbthrift_field_i32Field; } +const ::std::string& IncludedA::get_strField() const& { + return __fbthrift_field_strField; +} + +::std::string IncludedA::get_strField() && { + return static_cast<::std::string&&>(__fbthrift_field_strField); +} + void swap([[maybe_unused]] IncludedA& a, [[maybe_unused]] IncludedA& b) { using ::std::swap; swap(a.__fbthrift_field_i32Field, b.__fbthrift_field_i32Field); diff --git a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include1/gen-cpp2/include1_types.h b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include1/gen-cpp2/include1_types.h index 3bf7a1eb79e..b642fb9bc7b 100644 --- a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include1/gen-cpp2/include1_types.h +++ b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include1/gen-cpp2/include1_types.h @@ -244,15 +244,11 @@ class IncludedA final { /** Glean { "field": "strField" } */ [[deprecated("Use `FOO.strField().value();` instead of `FOO.get_strField();`")]] - const ::std::string& get_strField() const& { - return __fbthrift_field_strField; - } + const ::std::string& get_strField() const&; /** Glean { "field": "strField" } */ [[deprecated("Use `FOO.strField().value();` instead of `FOO.get_strField();`")]] - ::std::string get_strField() && { - return static_cast<::std::string&&>(__fbthrift_field_strField); - } + ::std::string get_strField() &&; /** Glean { "field": "strField" } */ template diff --git a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include2/gen-cpp2/include2_types.cpp b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include2/gen-cpp2/include2_types.cpp index 302f489ae0b..3d64fe9c6b8 100644 --- a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include2/gen-cpp2/include2_types.cpp +++ b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include2/gen-cpp2/include2_types.cpp @@ -107,6 +107,14 @@ ::std::int32_t& IncludedB::set_i32Field(::std::int32_t i32Field_) { return __fbthrift_field_i32Field; } +const ::std::string& IncludedB::get_strField() const& { + return __fbthrift_field_strField; +} + +::std::string IncludedB::get_strField() && { + return static_cast<::std::string&&>(__fbthrift_field_strField); +} + void swap([[maybe_unused]] IncludedB& a, [[maybe_unused]] IncludedB& b) { using ::std::swap; swap(a.__fbthrift_field_i32Field, b.__fbthrift_field_i32Field); diff --git a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include2/gen-cpp2/include2_types.h b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include2/gen-cpp2/include2_types.h index d3f05578177..008aede5860 100644 --- a/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include2/gen-cpp2/include2_types.h +++ b/thrift/compiler/test/fixtures/frozen-struct/out/cpp2_include2/gen-cpp2/include2_types.h @@ -244,15 +244,11 @@ class IncludedB final { /** Glean { "field": "strField" } */ [[deprecated("Use `FOO.strField().value();` instead of `FOO.get_strField();`")]] - const ::std::string& get_strField() const& { - return __fbthrift_field_strField; - } + const ::std::string& get_strField() const&; /** Glean { "field": "strField" } */ [[deprecated("Use `FOO.strField().value();` instead of `FOO.get_strField();`")]] - ::std::string get_strField() && { - return static_cast<::std::string&&>(__fbthrift_field_strField); - } + ::std::string get_strField() &&; /** Glean { "field": "strField" } */ template diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/inject_metadata_fields/out/cpp2/gen-cpp2/module_types.cpp index 65669fe8c8a..271796d698d 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/cpp2/gen-cpp2/module_types.cpp @@ -92,6 +92,14 @@ bool Fields::operator<([[maybe_unused]] const Fields& rhs) const { } +const ::std::string& Fields::get_injected_field() const& { + return __fbthrift_field_injected_field; +} + +::std::string Fields::get_injected_field() && { + return static_cast<::std::string&&>(__fbthrift_field_injected_field); +} + void swap([[maybe_unused]] Fields& a, [[maybe_unused]] Fields& b) { using ::std::swap; swap(a.__fbthrift_field_injected_field, b.__fbthrift_field_injected_field); @@ -189,6 +197,14 @@ bool FieldsInjectedToEmptyStruct::operator<([[maybe_unused]] const FieldsInjecte } +const ::std::string& FieldsInjectedToEmptyStruct::get_injected_field() const& { + return __fbthrift_field_injected_field; +} + +::std::string FieldsInjectedToEmptyStruct::get_injected_field() && { + return static_cast<::std::string&&>(__fbthrift_field_injected_field); +} + void swap([[maybe_unused]] FieldsInjectedToEmptyStruct& a, [[maybe_unused]] FieldsInjectedToEmptyStruct& b) { using ::std::swap; swap(a.__fbthrift_field_injected_field, b.__fbthrift_field_injected_field); @@ -291,6 +307,22 @@ bool FieldsInjectedToStruct::operator<([[maybe_unused]] const FieldsInjectedToSt } +const ::std::string& FieldsInjectedToStruct::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::std::string FieldsInjectedToStruct::get_string_field() && { + return static_cast<::std::string&&>(__fbthrift_field_string_field); +} + +const ::std::string& FieldsInjectedToStruct::get_injected_field() const& { + return __fbthrift_field_injected_field; +} + +::std::string FieldsInjectedToStruct::get_injected_field() && { + return static_cast<::std::string&&>(__fbthrift_field_injected_field); +} + void swap([[maybe_unused]] FieldsInjectedToStruct& a, [[maybe_unused]] FieldsInjectedToStruct& b) { using ::std::swap; swap(a.__fbthrift_field_string_field, b.__fbthrift_field_string_field); @@ -402,6 +434,22 @@ bool FieldsInjectedWithIncludedStruct::operator<([[maybe_unused]] const FieldsIn } +const ::std::string& FieldsInjectedWithIncludedStruct::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::std::string FieldsInjectedWithIncludedStruct::get_string_field() && { + return static_cast<::std::string&&>(__fbthrift_field_string_field); +} + +const ::std::string& FieldsInjectedWithIncludedStruct::get_injected_field() const& { + return __fbthrift_field_injected_field; +} + +::std::string FieldsInjectedWithIncludedStruct::get_injected_field() && { + return static_cast<::std::string&&>(__fbthrift_field_injected_field); +} + void swap([[maybe_unused]] FieldsInjectedWithIncludedStruct& a, [[maybe_unused]] FieldsInjectedWithIncludedStruct& b) { using ::std::swap; swap(a.__fbthrift_field_string_field, b.__fbthrift_field_string_field); diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/inject_metadata_fields/out/cpp2/gen-cpp2/module_types.h index e0a2a95d669..812177138f1 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/cpp2/gen-cpp2/module_types.h @@ -222,15 +222,11 @@ class Fields final { /** Glean { "field": "injected_field" } */ [[deprecated("Use `FOO.injected_field().value();` instead of `FOO.get_injected_field();`")]] - const ::std::string& get_injected_field() const& { - return __fbthrift_field_injected_field; - } + const ::std::string& get_injected_field() const&; /** Glean { "field": "injected_field" } */ [[deprecated("Use `FOO.injected_field().value();` instead of `FOO.get_injected_field();`")]] - ::std::string get_injected_field() && { - return static_cast<::std::string&&>(__fbthrift_field_injected_field); - } + ::std::string get_injected_field() &&; /** Glean { "field": "injected_field" } */ template @@ -397,15 +393,11 @@ class FieldsInjectedToEmptyStruct final { /** Glean { "field": "injected_field" } */ [[deprecated("Use `FOO.injected_field().value();` instead of `FOO.get_injected_field();`")]] - const ::std::string& get_injected_field() const& { - return __fbthrift_field_injected_field; - } + const ::std::string& get_injected_field() const&; /** Glean { "field": "injected_field" } */ [[deprecated("Use `FOO.injected_field().value();` instead of `FOO.get_injected_field();`")]] - ::std::string get_injected_field() && { - return static_cast<::std::string&&>(__fbthrift_field_injected_field); - } + ::std::string get_injected_field() &&; /** Glean { "field": "injected_field" } */ template @@ -624,15 +616,11 @@ class FieldsInjectedToStruct final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::std::string& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::std::string& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::std::string get_string_field() && { - return static_cast<::std::string&&>(__fbthrift_field_string_field); - } + ::std::string get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -644,15 +632,11 @@ class FieldsInjectedToStruct final { /** Glean { "field": "injected_field" } */ [[deprecated("Use `FOO.injected_field().value();` instead of `FOO.get_injected_field();`")]] - const ::std::string& get_injected_field() const& { - return __fbthrift_field_injected_field; - } + const ::std::string& get_injected_field() const&; /** Glean { "field": "injected_field" } */ [[deprecated("Use `FOO.injected_field().value();` instead of `FOO.get_injected_field();`")]] - ::std::string get_injected_field() && { - return static_cast<::std::string&&>(__fbthrift_field_injected_field); - } + ::std::string get_injected_field() &&; /** Glean { "field": "injected_field" } */ template @@ -975,15 +959,11 @@ class FieldsInjectedWithIncludedStruct final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::std::string& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::std::string& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::std::string get_string_field() && { - return static_cast<::std::string&&>(__fbthrift_field_string_field); - } + ::std::string get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -995,15 +975,11 @@ class FieldsInjectedWithIncludedStruct final { /** Glean { "field": "injected_field" } */ [[deprecated("Use `FOO.injected_field().value();` instead of `FOO.get_injected_field();`")]] - const ::std::string& get_injected_field() const& { - return __fbthrift_field_injected_field; - } + const ::std::string& get_injected_field() const&; /** Glean { "field": "injected_field" } */ [[deprecated("Use `FOO.injected_field().value();` instead of `FOO.get_injected_field();`")]] - ::std::string get_injected_field() && { - return static_cast<::std::string&&>(__fbthrift_field_injected_field); - } + ::std::string get_injected_field() &&; /** Glean { "field": "injected_field" } */ template diff --git a/thrift/compiler/test/fixtures/interactions/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/interactions/out/cpp2/gen-cpp2/module_types.cpp index 3f5b4d8967a..a0b11dae3a6 100644 --- a/thrift/compiler/test/fixtures/interactions/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/interactions/out/cpp2/gen-cpp2/module_types.cpp @@ -92,6 +92,14 @@ bool CustomException::operator<([[maybe_unused]] const CustomException& rhs) con } +const ::std::string& CustomException::get_message() const& { + return __fbthrift_field_message; +} + +::std::string CustomException::get_message() && { + return static_cast<::std::string&&>(__fbthrift_field_message); +} + void swap([[maybe_unused]] CustomException& a, [[maybe_unused]] CustomException& b) { using ::std::swap; swap(a.__fbthrift_field_message, b.__fbthrift_field_message); @@ -189,6 +197,14 @@ bool ShouldBeBoxed::operator<([[maybe_unused]] const ShouldBeBoxed& rhs) const { } +const ::std::string& ShouldBeBoxed::get_sessionId() const& { + return __fbthrift_field_sessionId; +} + +::std::string ShouldBeBoxed::get_sessionId() && { + return static_cast<::std::string&&>(__fbthrift_field_sessionId); +} + void swap([[maybe_unused]] ShouldBeBoxed& a, [[maybe_unused]] ShouldBeBoxed& b) { using ::std::swap; swap(a.__fbthrift_field_sessionId, b.__fbthrift_field_sessionId); diff --git a/thrift/compiler/test/fixtures/interactions/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/interactions/out/cpp2/gen-cpp2/module_types.h index 7faa64b824b..7b077bdcabc 100644 --- a/thrift/compiler/test/fixtures/interactions/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/interactions/out/cpp2/gen-cpp2/module_types.h @@ -192,15 +192,11 @@ class FOLLY_EXPORT CustomException : public virtual apache::thrift::TException { /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - const ::std::string& get_message() const& { - return __fbthrift_field_message; - } + const ::std::string& get_message() const&; /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - ::std::string get_message() && { - return static_cast<::std::string&&>(__fbthrift_field_message); - } + ::std::string get_message() &&; /** Glean { "field": "message" } */ template @@ -371,15 +367,11 @@ class ShouldBeBoxed final { /** Glean { "field": "sessionId" } */ [[deprecated("Use `FOO.sessionId().value();` instead of `FOO.get_sessionId();`")]] - const ::std::string& get_sessionId() const& { - return __fbthrift_field_sessionId; - } + const ::std::string& get_sessionId() const&; /** Glean { "field": "sessionId" } */ [[deprecated("Use `FOO.sessionId().value();` instead of `FOO.get_sessionId();`")]] - ::std::string get_sessionId() && { - return static_cast<::std::string&&>(__fbthrift_field_sessionId); - } + ::std::string get_sessionId() &&; /** Glean { "field": "sessionId" } */ template diff --git a/thrift/compiler/test/fixtures/interactions/out/cpp2_shared/gen-cpp2/shared_types.cpp b/thrift/compiler/test/fixtures/interactions/out/cpp2_shared/gen-cpp2/shared_types.cpp index 1928fb0a61c..2e16aa26aa4 100644 --- a/thrift/compiler/test/fixtures/interactions/out/cpp2_shared/gen-cpp2/shared_types.cpp +++ b/thrift/compiler/test/fixtures/interactions/out/cpp2_shared/gen-cpp2/shared_types.cpp @@ -98,6 +98,14 @@ bool DoSomethingResult::operator<([[maybe_unused]] const DoSomethingResult& rhs) } +const ::std::string& DoSomethingResult::get_s_res() const& { + return __fbthrift_field_s_res; +} + +::std::string DoSomethingResult::get_s_res() && { + return static_cast<::std::string&&>(__fbthrift_field_s_res); +} + ::std::int32_t DoSomethingResult::get_i_res() const { return __fbthrift_field_i_res; } diff --git a/thrift/compiler/test/fixtures/interactions/out/cpp2_shared/gen-cpp2/shared_types.h b/thrift/compiler/test/fixtures/interactions/out/cpp2_shared/gen-cpp2/shared_types.h index 6e50b9bdb3e..f72c68c7540 100644 --- a/thrift/compiler/test/fixtures/interactions/out/cpp2_shared/gen-cpp2/shared_types.h +++ b/thrift/compiler/test/fixtures/interactions/out/cpp2_shared/gen-cpp2/shared_types.h @@ -236,15 +236,11 @@ class DoSomethingResult final { /** Glean { "field": "s_res" } */ [[deprecated("Use `FOO.s_res().value();` instead of `FOO.get_s_res();`")]] - const ::std::string& get_s_res() const& { - return __fbthrift_field_s_res; - } + const ::std::string& get_s_res() const&; /** Glean { "field": "s_res" } */ [[deprecated("Use `FOO.s_res().value();` instead of `FOO.get_s_res();`")]] - ::std::string get_s_res() && { - return static_cast<::std::string&&>(__fbthrift_field_s_res); - } + ::std::string get_s_res() &&; /** Glean { "field": "s_res" } */ template diff --git a/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2/gen-cpp2/module_types.cpp index cf488fce5ab..226c56f118e 100644 --- a/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2/gen-cpp2/module_types.cpp @@ -514,6 +514,30 @@ ::std::int64_t& MyStruct::set_MyIntField(::std::int64_t MyIntField_) { return __fbthrift_field_MyIntField; } +const ::std::string& MyStruct::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyStruct::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + +const ::std::string& MyStruct::get_MyStringField2() const& { + return __fbthrift_field_MyStringField2; +} + +::std::string MyStruct::get_MyStringField2() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField2); +} + +const ::std::string& MyStruct::get_MyBinaryField() const& { + return __fbthrift_field_MyBinaryField; +} + +::std::string MyStruct::get_MyBinaryField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyBinaryField); +} + const ::std::string* MyStruct::get_MyBinaryField2() const& { return MyBinaryField2_ref().has_value() ? std::addressof(__fbthrift_field_MyBinaryField2) : nullptr; } @@ -522,6 +546,14 @@ ::std::string* MyStruct::get_MyBinaryField2() & { return MyBinaryField2_ref().has_value() ? std::addressof(__fbthrift_field_MyBinaryField2) : nullptr; } +const ::std::string& MyStruct::get_MyBinaryField3() const& { + return __fbthrift_field_MyBinaryField3; +} + +::std::string MyStruct::get_MyBinaryField3() && { + return static_cast<::std::string&&>(__fbthrift_field_MyBinaryField3); +} + const ::std::vector<::std::string>& MyStruct::get_MyBinaryListField4() const& { return __fbthrift_field_MyBinaryListField4; } @@ -1378,6 +1410,22 @@ ::std::int32_t& AnException::set_req_code(::std::int32_t req_code_) { return __fbthrift_field_req_code; } +const ::std::string& AnException::get_message2() const& { + return __fbthrift_field_message2; +} + +::std::string AnException::get_message2() && { + return static_cast<::std::string&&>(__fbthrift_field_message2); +} + +const ::std::string& AnException::get_req_message() const& { + return __fbthrift_field_req_message; +} + +::std::string AnException::get_req_message() && { + return static_cast<::std::string&&>(__fbthrift_field_req_message); +} + const ::std::vector<::std::int32_t>& AnException::get_exception_list() const& { return __fbthrift_field_exception_list; } @@ -1637,6 +1685,14 @@ ::std::int32_t& AnotherException::set_req_code(::std::int32_t req_code_) { return __fbthrift_field_req_code; } +const ::std::string& AnotherException::get_message() const& { + return __fbthrift_field_message; +} + +::std::string AnotherException::get_message() && { + return static_cast<::std::string&&>(__fbthrift_field_message); +} + void swap([[maybe_unused]] AnotherException& a, [[maybe_unused]] AnotherException& b) { using ::std::swap; swap(a.__fbthrift_field_code, b.__fbthrift_field_code); @@ -1982,6 +2038,30 @@ ::std::set<::std::int32_t>* containerStruct::get_opt_fieldC() & { return opt_fieldC_ref().has_value() ? std::addressof(opt_fieldC) : nullptr; } +const ::std::string& containerStruct::get_fieldD() const& { + return fieldD; +} + +::std::string containerStruct::get_fieldD() && { + return static_cast<::std::string&&>(fieldD); +} + +const ::std::string& containerStruct::get_fieldE() const& { + return fieldE; +} + +::std::string containerStruct::get_fieldE() && { + return static_cast<::std::string&&>(fieldE); +} + +const ::std::string& containerStruct::get_req_fieldE() const& { + return req_fieldE; +} + +::std::string containerStruct::get_req_fieldE() && { + return static_cast<::std::string&&>(req_fieldE); +} + const ::std::string* containerStruct::get_opt_fieldE() const& { return opt_fieldE_ref().has_value() ? std::addressof(opt_fieldE) : nullptr; } @@ -2259,6 +2339,14 @@ ::std::map<::std::string, ::std::int32_t> containerStruct::get_fieldAE() && { return static_cast<::std::map<::std::string, ::std::int32_t>&&>(fieldAE); } +const ::some::valid::ns::IndirectionD& containerStruct::get_fieldSD() const& { + return fieldSD; +} + +::some::valid::ns::IndirectionD containerStruct::get_fieldSD() && { + return static_cast<::some::valid::ns::IndirectionD&&>(fieldSD); +} + void swap([[maybe_unused]] containerStruct& a, [[maybe_unused]] containerStruct& b) { using ::std::swap; swap(a.fieldA, b.fieldA); @@ -2789,6 +2877,22 @@ ::some::valid::ns::UnorderedMapStruct AnnotatedStruct::get_map_struct_type() && return static_cast<::some::valid::ns::UnorderedMapStruct&&>(map_struct_type); } +const ::some::valid::ns::IOBuf& AnnotatedStruct::get_iobuf_type() const& { + return iobuf_type; +} + +::some::valid::ns::IOBuf AnnotatedStruct::get_iobuf_type() && { + return static_cast<::some::valid::ns::IOBuf&&>(iobuf_type); +} + +const ::some::valid::ns::IOBufPtr& AnnotatedStruct::get_iobuf_ptr() const& { + return iobuf_ptr; +} + +::some::valid::ns::IOBufPtr AnnotatedStruct::get_iobuf_ptr() && { + return static_cast<::some::valid::ns::IOBufPtr&&>(iobuf_ptr); +} + const std::list<::std::int32_t>& AnnotatedStruct::get_list_i32_template() const& { return list_i32_template; } @@ -2878,6 +2982,22 @@ ::std::set<::some::valid::ns::IndirectionC> AnnotatedStruct::get_indirection_c() return static_cast<::std::set<::some::valid::ns::IndirectionC>&&>(indirection_c); } +const ::some::valid::ns::IOBuf& AnnotatedStruct::get_iobuf_type_val() const& { + return iobuf_type_val; +} + +::some::valid::ns::IOBuf AnnotatedStruct::get_iobuf_type_val() && { + return static_cast<::some::valid::ns::IOBuf&&>(iobuf_type_val); +} + +const ::some::valid::ns::IOBufPtr& AnnotatedStruct::get_iobuf_ptr_val() const& { + return iobuf_ptr_val; +} + +::some::valid::ns::IOBufPtr AnnotatedStruct::get_iobuf_ptr_val() && { + return static_cast<::some::valid::ns::IOBufPtr&&>(iobuf_ptr_val); +} + const ::some::valid::ns::containerStruct& AnnotatedStruct::get_struct_struct() const& { return struct_struct; } diff --git a/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2/gen-cpp2/module_types.h index 28d23c3f665..5c80fa34ef3 100644 --- a/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2/gen-cpp2/module_types.h @@ -2274,15 +2274,11 @@ class MyStruct final { /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template @@ -2294,15 +2290,11 @@ class MyStruct final { /** Glean { "field": "MyStringField2" } */ [[deprecated("Use `FOO.MyStringField2().value();` instead of `FOO.get_MyStringField2();`")]] - const ::std::string& get_MyStringField2() const& { - return __fbthrift_field_MyStringField2; - } + const ::std::string& get_MyStringField2() const&; /** Glean { "field": "MyStringField2" } */ [[deprecated("Use `FOO.MyStringField2().value();` instead of `FOO.get_MyStringField2();`")]] - ::std::string get_MyStringField2() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField2); - } + ::std::string get_MyStringField2() &&; /** Glean { "field": "MyStringField2" } */ template @@ -2314,15 +2306,11 @@ class MyStruct final { /** Glean { "field": "MyBinaryField" } */ [[deprecated("Use `FOO.MyBinaryField().value();` instead of `FOO.get_MyBinaryField();`")]] - const ::std::string& get_MyBinaryField() const& { - return __fbthrift_field_MyBinaryField; - } + const ::std::string& get_MyBinaryField() const&; /** Glean { "field": "MyBinaryField" } */ [[deprecated("Use `FOO.MyBinaryField().value();` instead of `FOO.get_MyBinaryField();`")]] - ::std::string get_MyBinaryField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyBinaryField); - } + ::std::string get_MyBinaryField() &&; /** Glean { "field": "MyBinaryField" } */ template @@ -2352,15 +2340,11 @@ class MyStruct final { /** Glean { "field": "MyBinaryField3" } */ [[deprecated("Use `FOO.MyBinaryField3().value();` instead of `FOO.get_MyBinaryField3();`")]] - const ::std::string& get_MyBinaryField3() const& { - return __fbthrift_field_MyBinaryField3; - } + const ::std::string& get_MyBinaryField3() const&; /** Glean { "field": "MyBinaryField3" } */ [[deprecated("Use `FOO.MyBinaryField3().value();` instead of `FOO.get_MyBinaryField3();`")]] - ::std::string get_MyBinaryField3() && { - return static_cast<::std::string&&>(__fbthrift_field_MyBinaryField3); - } + ::std::string get_MyBinaryField3() &&; /** Glean { "field": "MyBinaryField3" } */ template @@ -3706,15 +3690,11 @@ class FOLLY_EXPORT AnException : public virtual apache::thrift::TException { /** Glean { "field": "message2" } */ [[deprecated("Use `FOO.message2().value();` instead of `FOO.get_message2();`")]] - const ::std::string& get_message2() const& { - return __fbthrift_field_message2; - } + const ::std::string& get_message2() const&; /** Glean { "field": "message2" } */ [[deprecated("Use `FOO.message2().value();` instead of `FOO.get_message2();`")]] - ::std::string get_message2() && { - return static_cast<::std::string&&>(__fbthrift_field_message2); - } + ::std::string get_message2() &&; /** Glean { "field": "message2" } */ template @@ -3726,15 +3706,11 @@ class FOLLY_EXPORT AnException : public virtual apache::thrift::TException { /** Glean { "field": "req_message" } */ [[deprecated("Use `FOO.req_message().value();` instead of `FOO.get_req_message();`")]] - const ::std::string& get_req_message() const& { - return __fbthrift_field_req_message; - } + const ::std::string& get_req_message() const&; /** Glean { "field": "req_message" } */ [[deprecated("Use `FOO.req_message().value();` instead of `FOO.get_req_message();`")]] - ::std::string get_req_message() && { - return static_cast<::std::string&&>(__fbthrift_field_req_message); - } + ::std::string get_req_message() &&; /** Glean { "field": "req_message" } */ template @@ -6564,15 +6540,11 @@ class FOLLY_EXPORT AnotherException : public virtual apache::thrift::TException /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - const ::std::string& get_message() const& { - return __fbthrift_field_message; - } + const ::std::string& get_message() const&; /** Glean { "field": "message" } */ [[deprecated("Use `FOO.message().value();` instead of `FOO.get_message();`")]] - ::std::string get_message() && { - return static_cast<::std::string&&>(__fbthrift_field_message); - } + ::std::string get_message() &&; /** Glean { "field": "message" } */ template @@ -8106,15 +8078,11 @@ class containerStruct final { /** Glean { "field": "fieldD" } */ [[deprecated("Use `FOO.fieldD().value();` instead of `FOO.get_fieldD();`")]] - const ::std::string& get_fieldD() const& { - return fieldD; - } + const ::std::string& get_fieldD() const&; /** Glean { "field": "fieldD" } */ [[deprecated("Use `FOO.fieldD().value();` instead of `FOO.get_fieldD();`")]] - ::std::string get_fieldD() && { - return static_cast<::std::string&&>(fieldD); - } + ::std::string get_fieldD() &&; /** Glean { "field": "fieldD" } */ template @@ -8126,15 +8094,11 @@ class containerStruct final { /** Glean { "field": "fieldE" } */ [[deprecated("Use `FOO.fieldE().value();` instead of `FOO.get_fieldE();`")]] - const ::std::string& get_fieldE() const& { - return fieldE; - } + const ::std::string& get_fieldE() const&; /** Glean { "field": "fieldE" } */ [[deprecated("Use `FOO.fieldE().value();` instead of `FOO.get_fieldE();`")]] - ::std::string get_fieldE() && { - return static_cast<::std::string&&>(fieldE); - } + ::std::string get_fieldE() &&; /** Glean { "field": "fieldE" } */ template @@ -8146,15 +8110,11 @@ class containerStruct final { /** Glean { "field": "req_fieldE" } */ [[deprecated("Use `FOO.req_fieldE().value();` instead of `FOO.get_req_fieldE();`")]] - const ::std::string& get_req_fieldE() const& { - return req_fieldE; - } + const ::std::string& get_req_fieldE() const&; /** Glean { "field": "req_fieldE" } */ [[deprecated("Use `FOO.req_fieldE().value();` instead of `FOO.get_req_fieldE();`")]] - ::std::string get_req_fieldE() && { - return static_cast<::std::string&&>(req_fieldE); - } + ::std::string get_req_fieldE() &&; /** Glean { "field": "req_fieldE" } */ template @@ -8634,15 +8594,11 @@ class containerStruct final { /** Glean { "field": "fieldSD" } */ [[deprecated("Use `FOO.fieldSD().value();` instead of `FOO.get_fieldSD();`")]] - const ::some::valid::ns::IndirectionD& get_fieldSD() const& { - return fieldSD; - } + const ::some::valid::ns::IndirectionD& get_fieldSD() const&; /** Glean { "field": "fieldSD" } */ [[deprecated("Use `FOO.fieldSD().value();` instead of `FOO.get_fieldSD();`")]] - ::some::valid::ns::IndirectionD get_fieldSD() && { - return static_cast<::some::valid::ns::IndirectionD&&>(fieldSD); - } + ::some::valid::ns::IndirectionD get_fieldSD() &&; /** Glean { "field": "fieldSD" } */ template @@ -10295,15 +10251,11 @@ class AnnotatedStruct { /** Glean { "field": "iobuf_type" } */ [[deprecated("Use `FOO.iobuf_type().value();` instead of `FOO.get_iobuf_type();`")]] - const ::some::valid::ns::IOBuf& get_iobuf_type() const& { - return iobuf_type; - } + const ::some::valid::ns::IOBuf& get_iobuf_type() const&; /** Glean { "field": "iobuf_type" } */ [[deprecated("Use `FOO.iobuf_type().value();` instead of `FOO.get_iobuf_type();`")]] - ::some::valid::ns::IOBuf get_iobuf_type() && { - return static_cast<::some::valid::ns::IOBuf&&>(iobuf_type); - } + ::some::valid::ns::IOBuf get_iobuf_type() &&; /** Glean { "field": "iobuf_type" } */ template @@ -10315,15 +10267,11 @@ class AnnotatedStruct { /** Glean { "field": "iobuf_ptr" } */ [[deprecated("Use `FOO.iobuf_ptr().value();` instead of `FOO.get_iobuf_ptr();`")]] - const ::some::valid::ns::IOBufPtr& get_iobuf_ptr() const& { - return iobuf_ptr; - } + const ::some::valid::ns::IOBufPtr& get_iobuf_ptr() const&; /** Glean { "field": "iobuf_ptr" } */ [[deprecated("Use `FOO.iobuf_ptr().value();` instead of `FOO.get_iobuf_ptr();`")]] - ::some::valid::ns::IOBufPtr get_iobuf_ptr() && { - return static_cast<::some::valid::ns::IOBufPtr&&>(iobuf_ptr); - } + ::some::valid::ns::IOBufPtr get_iobuf_ptr() &&; /** Glean { "field": "iobuf_ptr" } */ template @@ -10503,15 +10451,11 @@ class AnnotatedStruct { /** Glean { "field": "iobuf_type_val" } */ [[deprecated("Use `FOO.iobuf_type_val().value();` instead of `FOO.get_iobuf_type_val();`")]] - const ::some::valid::ns::IOBuf& get_iobuf_type_val() const& { - return iobuf_type_val; - } + const ::some::valid::ns::IOBuf& get_iobuf_type_val() const&; /** Glean { "field": "iobuf_type_val" } */ [[deprecated("Use `FOO.iobuf_type_val().value();` instead of `FOO.get_iobuf_type_val();`")]] - ::some::valid::ns::IOBuf get_iobuf_type_val() && { - return static_cast<::some::valid::ns::IOBuf&&>(iobuf_type_val); - } + ::some::valid::ns::IOBuf get_iobuf_type_val() &&; /** Glean { "field": "iobuf_type_val" } */ template @@ -10523,15 +10467,11 @@ class AnnotatedStruct { /** Glean { "field": "iobuf_ptr_val" } */ [[deprecated("Use `FOO.iobuf_ptr_val().value();` instead of `FOO.get_iobuf_ptr_val();`")]] - const ::some::valid::ns::IOBufPtr& get_iobuf_ptr_val() const& { - return iobuf_ptr_val; - } + const ::some::valid::ns::IOBufPtr& get_iobuf_ptr_val() const&; /** Glean { "field": "iobuf_ptr_val" } */ [[deprecated("Use `FOO.iobuf_ptr_val().value();` instead of `FOO.get_iobuf_ptr_val();`")]] - ::some::valid::ns::IOBufPtr get_iobuf_ptr_val() && { - return static_cast<::some::valid::ns::IOBufPtr&&>(iobuf_ptr_val); - } + ::some::valid::ns::IOBufPtr get_iobuf_ptr_val() &&; /** Glean { "field": "iobuf_ptr_val" } */ template diff --git a/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_types.cpp b/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_types.cpp index 64205a4f508..f316078f8ee 100644 --- a/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_types.cpp +++ b/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_types.cpp @@ -245,6 +245,30 @@ ::std::set<::std::int32_t>* containerStruct2::get_opt_fieldC() & { return opt_fieldC_ref().has_value() ? std::addressof(__fbthrift_field_opt_fieldC) : nullptr; } +const ::std::string& containerStruct2::get_fieldD() const& { + return __fbthrift_field_fieldD; +} + +::std::string containerStruct2::get_fieldD() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldD); +} + +const ::std::string& containerStruct2::get_fieldE() const& { + return __fbthrift_field_fieldE; +} + +::std::string containerStruct2::get_fieldE() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldE); +} + +const ::std::string& containerStruct2::get_req_fieldE() const& { + return __fbthrift_field_req_fieldE; +} + +::std::string containerStruct2::get_req_fieldE() && { + return static_cast<::std::string&&>(__fbthrift_field_req_fieldE); +} + const ::std::string* containerStruct2::get_opt_fieldE() const& { return opt_fieldE_ref().has_value() ? std::addressof(__fbthrift_field_opt_fieldE) : nullptr; } diff --git a/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_types.h b/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_types.h index e6b55fc04c9..d529d2d2b03 100644 --- a/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_types.h +++ b/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_types.h @@ -994,15 +994,11 @@ class containerStruct2 final { /** Glean { "field": "fieldD" } */ [[deprecated("Use `FOO.fieldD().value();` instead of `FOO.get_fieldD();`")]] - const ::std::string& get_fieldD() const& { - return __fbthrift_field_fieldD; - } + const ::std::string& get_fieldD() const&; /** Glean { "field": "fieldD" } */ [[deprecated("Use `FOO.fieldD().value();` instead of `FOO.get_fieldD();`")]] - ::std::string get_fieldD() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldD); - } + ::std::string get_fieldD() &&; /** Glean { "field": "fieldD" } */ template @@ -1014,15 +1010,11 @@ class containerStruct2 final { /** Glean { "field": "fieldE" } */ [[deprecated("Use `FOO.fieldE().value();` instead of `FOO.get_fieldE();`")]] - const ::std::string& get_fieldE() const& { - return __fbthrift_field_fieldE; - } + const ::std::string& get_fieldE() const&; /** Glean { "field": "fieldE" } */ [[deprecated("Use `FOO.fieldE().value();` instead of `FOO.get_fieldE();`")]] - ::std::string get_fieldE() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldE); - } + ::std::string get_fieldE() &&; /** Glean { "field": "fieldE" } */ template @@ -1034,15 +1026,11 @@ class containerStruct2 final { /** Glean { "field": "req_fieldE" } */ [[deprecated("Use `FOO.req_fieldE().value();` instead of `FOO.get_req_fieldE();`")]] - const ::std::string& get_req_fieldE() const& { - return __fbthrift_field_req_fieldE; - } + const ::std::string& get_req_fieldE() const&; /** Glean { "field": "req_fieldE" } */ [[deprecated("Use `FOO.req_fieldE().value();` instead of `FOO.get_req_fieldE();`")]] - ::std::string get_req_fieldE() && { - return static_cast<::std::string&&>(__fbthrift_field_req_fieldE); - } + ::std::string get_req_fieldE() &&; /** Glean { "field": "req_fieldE" } */ template diff --git a/thrift/compiler/test/fixtures/mixin/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/mixin/out/cpp2/gen-cpp2/module_types.cpp index dcfcd3b66ff..7efb96c2afe 100644 --- a/thrift/compiler/test/fixtures/mixin/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/mixin/out/cpp2/gen-cpp2/module_types.cpp @@ -92,6 +92,14 @@ bool Mixin1::operator<([[maybe_unused]] const Mixin1& rhs) const { } +const ::std::string& Mixin1::get_field1() const& { + return __fbthrift_field_field1; +} + +::std::string Mixin1::get_field1() && { + return static_cast<::std::string&&>(__fbthrift_field_field1); +} + void swap([[maybe_unused]] Mixin1& a, [[maybe_unused]] Mixin1& b) { using ::std::swap; swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1); @@ -314,6 +322,14 @@ bool Mixin3Base::operator<([[maybe_unused]] const Mixin3Base& rhs) const { } +const ::std::string& Mixin3Base::get_field3() const& { + return __fbthrift_field_field3; +} + +::std::string Mixin3Base::get_field3() && { + return static_cast<::std::string&&>(__fbthrift_field_field3); +} + void swap([[maybe_unused]] Mixin3Base& a, [[maybe_unused]] Mixin3Base& b) { using ::std::swap; swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3); @@ -421,6 +437,14 @@ bool Foo::operator<([[maybe_unused]] const Foo& rhs) const { } +const ::std::string& Foo::get_field4() const& { + return __fbthrift_field_field4; +} + +::std::string Foo::get_field4() && { + return static_cast<::std::string&&>(__fbthrift_field_field4); +} + const ::cpp2::Mixin2& Foo::get_m2() const& { return __fbthrift_field_m2; } diff --git a/thrift/compiler/test/fixtures/mixin/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/mixin/out/cpp2/gen-cpp2/module_types.h index eacb8a15a68..cd84a326913 100644 --- a/thrift/compiler/test/fixtures/mixin/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/mixin/out/cpp2/gen-cpp2/module_types.h @@ -214,15 +214,11 @@ class Mixin1 final { /** Glean { "field": "field1" } */ [[deprecated("Use `FOO.field1().value();` instead of `FOO.get_field1();`")]] - const ::std::string& get_field1() const& { - return __fbthrift_field_field1; - } + const ::std::string& get_field1() const&; /** Glean { "field": "field1" } */ [[deprecated("Use `FOO.field1().value();` instead of `FOO.get_field1();`")]] - ::std::string get_field1() && { - return static_cast<::std::string&&>(__fbthrift_field_field1); - } + ::std::string get_field1() &&; /** Glean { "field": "field1" } */ template @@ -638,15 +634,11 @@ class Mixin3Base final { /** Glean { "field": "field3" } */ [[deprecated("Use `FOO.field3().value();` instead of `FOO.get_field3();`")]] - const ::std::string& get_field3() const& { - return __fbthrift_field_field3; - } + const ::std::string& get_field3() const&; /** Glean { "field": "field3" } */ [[deprecated("Use `FOO.field3().value();` instead of `FOO.get_field3();`")]] - ::std::string get_field3() && { - return static_cast<::std::string&&>(__fbthrift_field_field3); - } + ::std::string get_field3() &&; /** Glean { "field": "field3" } */ template @@ -949,15 +941,11 @@ class Foo final { /** Glean { "field": "field4" } */ [[deprecated("Use `FOO.field4().value();` instead of `FOO.get_field4();`")]] - const ::std::string& get_field4() const& { - return __fbthrift_field_field4; - } + const ::std::string& get_field4() const&; /** Glean { "field": "field4" } */ [[deprecated("Use `FOO.field4().value();` instead of `FOO.get_field4();`")]] - ::std::string get_field4() && { - return static_cast<::std::string&&>(__fbthrift_field_field4); - } + ::std::string get_field4() &&; /** Glean { "field": "field4" } */ template diff --git a/thrift/compiler/test/fixtures/no_metadata/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/no_metadata/out/cpp2/gen-cpp2/module_types.cpp index b12348023a2..65f0f225220 100644 --- a/thrift/compiler/test/fixtures/no_metadata/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/no_metadata/out/cpp2/gen-cpp2/module_types.cpp @@ -134,6 +134,14 @@ ::std::int64_t& MyStruct::set_MyIntField(::std::int64_t MyIntField_) { return __fbthrift_field_MyIntField; } +const ::std::string& MyStruct::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyStruct::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + const ::cpp2::MyDataItem& MyStruct::get_MyDataField() const& { return __fbthrift_field_MyDataField; } diff --git a/thrift/compiler/test/fixtures/no_metadata/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/no_metadata/out/cpp2/gen-cpp2/module_types.h index cfc6d0ab4e5..9d511bc43fa 100644 --- a/thrift/compiler/test/fixtures/no_metadata/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/no_metadata/out/cpp2/gen-cpp2/module_types.h @@ -529,15 +529,11 @@ class MyStruct final { /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template diff --git a/thrift/compiler/test/fixtures/optionals/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/optionals/out/cpp2/gen-cpp2/module_types.cpp index f51b844116b..8d51e0f10c5 100644 --- a/thrift/compiler/test/fixtures/optionals/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/optionals/out/cpp2/gen-cpp2/module_types.cpp @@ -466,6 +466,14 @@ ::cpp2::PersonID& Person::set_id(::cpp2::PersonID id_) { return __fbthrift_field_id; } +const ::std::string& Person::get_name() const& { + return __fbthrift_field_name; +} + +::std::string Person::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + const ::std::int16_t* Person::get_age() const& { return age_ref().has_value() ? std::addressof(__fbthrift_field_age) : nullptr; } diff --git a/thrift/compiler/test/fixtures/optionals/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/optionals/out/cpp2/gen-cpp2/module_types.h index 6edd39788cd..f378d1f46a1 100644 --- a/thrift/compiler/test/fixtures/optionals/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/optionals/out/cpp2/gen-cpp2/module_types.h @@ -1597,15 +1597,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 diff --git a/thrift/compiler/test/fixtures/py3/out/cpp2/gen-py3cpp/module_types.cpp b/thrift/compiler/test/fixtures/py3/out/cpp2/gen-py3cpp/module_types.cpp index 36a33cf9d57..334e4ed4397 100644 --- a/thrift/compiler/test/fixtures/py3/out/cpp2/gen-py3cpp/module_types.cpp +++ b/thrift/compiler/test/fixtures/py3/out/cpp2/gen-py3cpp/module_types.cpp @@ -1032,6 +1032,14 @@ ::std::int32_t& ComplexStruct::set_an_integer(::std::int32_t an_integer_) { return __fbthrift_field_an_integer; } +const ::std::string& ComplexStruct::get_name() const& { + return __fbthrift_field_name; +} + +::std::string ComplexStruct::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + ::py3::simple::AnEnum ComplexStruct::get_an_enum() const { return __fbthrift_field_an_enum; } @@ -1041,6 +1049,38 @@ ::py3::simple::AnEnum& ComplexStruct::set_an_enum(::py3::simple::AnEnum an_enum_ return __fbthrift_field_an_enum; } +const ::std::string& ComplexStruct::get_some_bytes() const& { + return __fbthrift_field_some_bytes; +} + +::std::string ComplexStruct::get_some_bytes() && { + return static_cast<::std::string&&>(__fbthrift_field_some_bytes); +} + +const ::std::string& ComplexStruct::get_from() const& { + return __fbthrift_field_from; +} + +::std::string ComplexStruct::get_from() && { + return static_cast<::std::string&&>(__fbthrift_field_from); +} + +const ::std::string& ComplexStruct::get_cdef() const& { + return __fbthrift_field_cdef; +} + +::std::string ComplexStruct::get_cdef() && { + return static_cast<::std::string&&>(__fbthrift_field_cdef); +} + +const ::py3::simple::foo_bar& ComplexStruct::get_bytes_with_cpp_type() const& { + return __fbthrift_field_bytes_with_cpp_type; +} + +::py3::simple::foo_bar ComplexStruct::get_bytes_with_cpp_type() && { + return static_cast<::py3::simple::foo_bar&&>(__fbthrift_field_bytes_with_cpp_type); +} + void swap([[maybe_unused]] ComplexStruct& a, [[maybe_unused]] ComplexStruct& b) { using ::std::swap; swap(a.__fbthrift_field_structOne, b.__fbthrift_field_structOne); @@ -1441,6 +1481,22 @@ ::MyType& CustomFields::set_double_field(::MyType double_field_) { return __fbthrift_field_double_field; } +const ::MyType& CustomFields::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::MyType CustomFields::get_string_field() && { + return static_cast<::MyType&&>(__fbthrift_field_string_field); +} + +const ::MyType& CustomFields::get_binary_field() const& { + return __fbthrift_field_binary_field; +} + +::MyType CustomFields::get_binary_field() && { + return static_cast<::MyType&&>(__fbthrift_field_binary_field); +} + const ::MyType& CustomFields::get_list_field() const& { return __fbthrift_field_list_field; } @@ -1650,6 +1706,22 @@ ::py3::simple::CustomDouble& CustomTypedefFields::set_double_field(::py3::simple return __fbthrift_field_double_field; } +const ::py3::simple::CustomString& CustomTypedefFields::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::py3::simple::CustomString CustomTypedefFields::get_string_field() && { + return static_cast<::py3::simple::CustomString&&>(__fbthrift_field_string_field); +} + +const ::py3::simple::CustomBinary& CustomTypedefFields::get_binary_field() const& { + return __fbthrift_field_binary_field; +} + +::py3::simple::CustomBinary CustomTypedefFields::get_binary_field() && { + return static_cast<::py3::simple::CustomBinary&&>(__fbthrift_field_binary_field); +} + const ::py3::simple::CustomList& CustomTypedefFields::get_list_field() const& { return __fbthrift_field_list_field; } diff --git a/thrift/compiler/test/fixtures/py3/out/cpp2/gen-py3cpp/module_types.h b/thrift/compiler/test/fixtures/py3/out/cpp2/gen-py3cpp/module_types.h index 83b16e34979..2f0cf9967fb 100644 --- a/thrift/compiler/test/fixtures/py3/out/cpp2/gen-py3cpp/module_types.h +++ b/thrift/compiler/test/fixtures/py3/out/cpp2/gen-py3cpp/module_types.h @@ -2775,15 +2775,11 @@ class ComplexStruct 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 @@ -2803,15 +2799,11 @@ class ComplexStruct final { /** Glean { "field": "some_bytes" } */ [[deprecated("Use `FOO.some_bytes().value();` instead of `FOO.get_some_bytes();`")]] - const ::std::string& get_some_bytes() const& { - return __fbthrift_field_some_bytes; - } + const ::std::string& get_some_bytes() const&; /** Glean { "field": "some_bytes" } */ [[deprecated("Use `FOO.some_bytes().value();` instead of `FOO.get_some_bytes();`")]] - ::std::string get_some_bytes() && { - return static_cast<::std::string&&>(__fbthrift_field_some_bytes); - } + ::std::string get_some_bytes() &&; /** Glean { "field": "some_bytes" } */ template @@ -2823,15 +2815,11 @@ class ComplexStruct final { /** Glean { "field": "from" } */ [[deprecated("Use `FOO.from().value();` instead of `FOO.get_from();`")]] - const ::std::string& get_from() const& { - return __fbthrift_field_from; - } + const ::std::string& get_from() const&; /** Glean { "field": "from" } */ [[deprecated("Use `FOO.from().value();` instead of `FOO.get_from();`")]] - ::std::string get_from() && { - return static_cast<::std::string&&>(__fbthrift_field_from); - } + ::std::string get_from() &&; /** Glean { "field": "from" } */ template @@ -2843,15 +2831,11 @@ class ComplexStruct final { /** Glean { "field": "cdef" } */ [[deprecated("Use `FOO.cdef().value();` instead of `FOO.get_cdef();`")]] - const ::std::string& get_cdef() const& { - return __fbthrift_field_cdef; - } + const ::std::string& get_cdef() const&; /** Glean { "field": "cdef" } */ [[deprecated("Use `FOO.cdef().value();` instead of `FOO.get_cdef();`")]] - ::std::string get_cdef() && { - return static_cast<::std::string&&>(__fbthrift_field_cdef); - } + ::std::string get_cdef() &&; /** Glean { "field": "cdef" } */ template @@ -2863,15 +2847,11 @@ class ComplexStruct final { /** Glean { "field": "bytes_with_cpp_type" } */ [[deprecated("Use `FOO.bytes_with_cpp_type().value();` instead of `FOO.get_bytes_with_cpp_type();`")]] - const ::py3::simple::foo_bar& get_bytes_with_cpp_type() const& { - return __fbthrift_field_bytes_with_cpp_type; - } + const ::py3::simple::foo_bar& get_bytes_with_cpp_type() const&; /** Glean { "field": "bytes_with_cpp_type" } */ [[deprecated("Use `FOO.bytes_with_cpp_type().value();` instead of `FOO.get_bytes_with_cpp_type();`")]] - ::py3::simple::foo_bar get_bytes_with_cpp_type() && { - return static_cast<::py3::simple::foo_bar&&>(__fbthrift_field_bytes_with_cpp_type); - } + ::py3::simple::foo_bar get_bytes_with_cpp_type() &&; /** Glean { "field": "bytes_with_cpp_type" } */ template @@ -3866,15 +3846,11 @@ class CustomFields final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::MyType& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::MyType& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::MyType get_string_field() && { - return static_cast<::MyType&&>(__fbthrift_field_string_field); - } + ::MyType get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -3886,15 +3862,11 @@ class CustomFields final { /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - const ::MyType& get_binary_field() const& { - return __fbthrift_field_binary_field; - } + const ::MyType& get_binary_field() const&; /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - ::MyType get_binary_field() && { - return static_cast<::MyType&&>(__fbthrift_field_binary_field); - } + ::MyType get_binary_field() &&; /** Glean { "field": "binary_field" } */ template @@ -4565,15 +4537,11 @@ class CustomTypedefFields final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::py3::simple::CustomString& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::py3::simple::CustomString& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::py3::simple::CustomString get_string_field() && { - return static_cast<::py3::simple::CustomString&&>(__fbthrift_field_string_field); - } + ::py3::simple::CustomString get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -4585,15 +4553,11 @@ class CustomTypedefFields final { /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - const ::py3::simple::CustomBinary& get_binary_field() const& { - return __fbthrift_field_binary_field; - } + const ::py3::simple::CustomBinary& get_binary_field() const&; /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - ::py3::simple::CustomBinary get_binary_field() && { - return static_cast<::py3::simple::CustomBinary&&>(__fbthrift_field_binary_field); - } + ::py3::simple::CustomBinary get_binary_field() &&; /** Glean { "field": "binary_field" } */ template diff --git a/thrift/compiler/test/fixtures/python_capi/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/python_capi/out/cpp2/gen-cpp2/module_types.cpp index 4cf198bf2dd..b45b129752a 100644 --- a/thrift/compiler/test/fixtures/python_capi/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/python_capi/out/cpp2/gen-cpp2/module_types.cpp @@ -177,6 +177,14 @@ ::std::int64_t& MyStruct::set_inty(::std::int64_t inty_) { return __fbthrift_field_inty; } +const ::std::string& MyStruct::get_stringy() const& { + return __fbthrift_field_stringy; +} + +::std::string MyStruct::get_stringy() && { + return static_cast<::std::string&&>(__fbthrift_field_stringy); +} + const ::test::fixtures::python_capi::MyDataItem& MyStruct::get_myItemy() const& { return __fbthrift_field_myItemy; } @@ -341,6 +349,14 @@ bool MyDataItem::operator<([[maybe_unused]] const MyDataItem& rhs) const { } +const ::std::string& MyDataItem::get_s() const& { + return __fbthrift_field_s; +} + +::std::string MyDataItem::get_s() && { + return static_cast<::std::string&&>(__fbthrift_field_s); +} + void swap([[maybe_unused]] MyDataItem& a, [[maybe_unused]] MyDataItem& b) { using ::std::swap; swap(a.__fbthrift_field_s, b.__fbthrift_field_s); @@ -524,6 +540,14 @@ bool DoubledPair::operator<([[maybe_unused]] const DoubledPair& rhs) const { } +const ::std::string& DoubledPair::get_s() const& { + return __fbthrift_field_s; +} + +::std::string DoubledPair::get_s() && { + return static_cast<::std::string&&>(__fbthrift_field_s); +} + ::std::int32_t DoubledPair::get_x() const { return __fbthrift_field_x; } @@ -656,6 +680,14 @@ bool StringPair::operator<([[maybe_unused]] const StringPair& rhs) const { } +const ::std::string& StringPair::get_normal() const& { + return __fbthrift_field_normal; +} + +::std::string StringPair::get_normal() && { + return static_cast<::std::string&&>(__fbthrift_field_normal); +} + void swap([[maybe_unused]] StringPair& a, [[maybe_unused]] StringPair& b) { using ::std::swap; swap(a.__fbthrift_field_normal, b.__fbthrift_field_normal); @@ -995,6 +1027,22 @@ float& PrimitiveStruct::set_floaty(float floaty_) { return __fbthrift_field_floaty; } +const ::test::fixtures::python_capi::IOBuf& PrimitiveStruct::get_buffy() const& { + return __fbthrift_field_buffy; +} + +::test::fixtures::python_capi::IOBuf PrimitiveStruct::get_buffy() && { + return static_cast<::test::fixtures::python_capi::IOBuf&&>(__fbthrift_field_buffy); +} + +const ::test::fixtures::python_capi::IOBufPtr& PrimitiveStruct::get_pointbuffy() const& { + return __fbthrift_field_pointbuffy; +} + +::test::fixtures::python_capi::IOBufPtr PrimitiveStruct::get_pointbuffy() && { + return static_cast<::test::fixtures::python_capi::IOBufPtr&&>(__fbthrift_field_pointbuffy); +} + const ::test::fixtures::python_capi::MyStruct& PrimitiveStruct::get_patched_struct() const& { return __fbthrift_field_patched_struct; } @@ -1011,6 +1059,22 @@ ::test::fixtures::python_capi::VapidStruct PrimitiveStruct::get_empty_struct() & return static_cast<::test::fixtures::python_capi::VapidStruct&&>(__fbthrift_field_empty_struct); } +const folly::fbstring& PrimitiveStruct::get_fbstring() const& { + return __fbthrift_field_fbstring; +} + +folly::fbstring PrimitiveStruct::get_fbstring() && { + return static_cast(__fbthrift_field_fbstring); +} + +const ::apache::thrift::ManagedStringViewWithConversions& PrimitiveStruct::get_managed_string_view() const& { + return __fbthrift_field_managed_string_view; +} + +::apache::thrift::ManagedStringViewWithConversions PrimitiveStruct::get_managed_string_view() && { + return static_cast<::apache::thrift::ManagedStringViewWithConversions&&>(__fbthrift_field_managed_string_view); +} + const ::test::fixtures::python_capi::SomeError& PrimitiveStruct::get_some_error() const& { return __fbthrift_field_some_error; } diff --git a/thrift/compiler/test/fixtures/python_capi/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/python_capi/out/cpp2/gen-cpp2/module_types.h index 78ebf73c67b..e8a8cae20c8 100644 --- a/thrift/compiler/test/fixtures/python_capi/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/python_capi/out/cpp2/gen-cpp2/module_types.h @@ -704,15 +704,11 @@ class MyDataItem final { /** Glean { "field": "s" } */ [[deprecated("Use `FOO.s().value();` instead of `FOO.get_s();`")]] - const ::std::string& get_s() const& { - return __fbthrift_field_s; - } + const ::std::string& get_s() const&; /** Glean { "field": "s" } */ [[deprecated("Use `FOO.s().value();` instead of `FOO.get_s();`")]] - ::std::string get_s() && { - return static_cast<::std::string&&>(__fbthrift_field_s); - } + ::std::string get_s() &&; /** Glean { "field": "s" } */ template @@ -1252,15 +1248,11 @@ class MyStruct final { /** Glean { "field": "stringy" } */ [[deprecated("Use `FOO.stringy().value();` instead of `FOO.get_stringy();`")]] - const ::std::string& get_stringy() const& { - return __fbthrift_field_stringy; - } + const ::std::string& get_stringy() const&; /** Glean { "field": "stringy" } */ [[deprecated("Use `FOO.stringy().value();` instead of `FOO.get_stringy();`")]] - ::std::string get_stringy() && { - return static_cast<::std::string&&>(__fbthrift_field_stringy); - } + ::std::string get_stringy() &&; /** Glean { "field": "stringy" } */ template @@ -1661,15 +1653,11 @@ class DoubledPair final { /** Glean { "field": "s" } */ [[deprecated("Use `FOO.s().value();` instead of `FOO.get_s();`")]] - const ::std::string& get_s() const& { - return __fbthrift_field_s; - } + const ::std::string& get_s() const&; /** Glean { "field": "s" } */ [[deprecated("Use `FOO.s().value();` instead of `FOO.get_s();`")]] - ::std::string get_s() && { - return static_cast<::std::string&&>(__fbthrift_field_s); - } + ::std::string get_s() &&; /** Glean { "field": "s" } */ template @@ -1899,15 +1887,11 @@ class StringPair final { /** Glean { "field": "normal" } */ [[deprecated("Use `FOO.normal().value();` instead of `FOO.get_normal();`")]] - const ::std::string& get_normal() const& { - return __fbthrift_field_normal; - } + const ::std::string& get_normal() const&; /** Glean { "field": "normal" } */ [[deprecated("Use `FOO.normal().value();` instead of `FOO.get_normal();`")]] - ::std::string get_normal() && { - return static_cast<::std::string&&>(__fbthrift_field_normal); - } + ::std::string get_normal() &&; /** Glean { "field": "normal" } */ template @@ -3006,15 +2990,11 @@ class PrimitiveStruct final { /** Glean { "field": "buffy" } */ [[deprecated("Use `FOO.buffy().value();` instead of `FOO.get_buffy();`")]] - const ::test::fixtures::python_capi::IOBuf& get_buffy() const& { - return __fbthrift_field_buffy; - } + const ::test::fixtures::python_capi::IOBuf& get_buffy() const&; /** Glean { "field": "buffy" } */ [[deprecated("Use `FOO.buffy().value();` instead of `FOO.get_buffy();`")]] - ::test::fixtures::python_capi::IOBuf get_buffy() && { - return static_cast<::test::fixtures::python_capi::IOBuf&&>(__fbthrift_field_buffy); - } + ::test::fixtures::python_capi::IOBuf get_buffy() &&; /** Glean { "field": "buffy" } */ template @@ -3026,15 +3006,11 @@ class PrimitiveStruct final { /** Glean { "field": "pointbuffy" } */ [[deprecated("Use `FOO.pointbuffy().value();` instead of `FOO.get_pointbuffy();`")]] - const ::test::fixtures::python_capi::IOBufPtr& get_pointbuffy() const& { - return __fbthrift_field_pointbuffy; - } + const ::test::fixtures::python_capi::IOBufPtr& get_pointbuffy() const&; /** Glean { "field": "pointbuffy" } */ [[deprecated("Use `FOO.pointbuffy().value();` instead of `FOO.get_pointbuffy();`")]] - ::test::fixtures::python_capi::IOBufPtr get_pointbuffy() && { - return static_cast<::test::fixtures::python_capi::IOBufPtr&&>(__fbthrift_field_pointbuffy); - } + ::test::fixtures::python_capi::IOBufPtr get_pointbuffy() &&; /** Glean { "field": "pointbuffy" } */ template @@ -3078,15 +3054,11 @@ class PrimitiveStruct final { /** Glean { "field": "fbstring" } */ [[deprecated("Use `FOO.fbstring().value();` instead of `FOO.get_fbstring();`")]] - const folly::fbstring& get_fbstring() const& { - return __fbthrift_field_fbstring; - } + const folly::fbstring& get_fbstring() const&; /** Glean { "field": "fbstring" } */ [[deprecated("Use `FOO.fbstring().value();` instead of `FOO.get_fbstring();`")]] - folly::fbstring get_fbstring() && { - return static_cast(__fbthrift_field_fbstring); - } + folly::fbstring get_fbstring() &&; /** Glean { "field": "fbstring" } */ template @@ -3098,15 +3070,11 @@ class PrimitiveStruct final { /** Glean { "field": "managed_string_view" } */ [[deprecated("Use `FOO.managed_string_view().value();` instead of `FOO.get_managed_string_view();`")]] - const ::apache::thrift::ManagedStringViewWithConversions& get_managed_string_view() const& { - return __fbthrift_field_managed_string_view; - } + const ::apache::thrift::ManagedStringViewWithConversions& get_managed_string_view() const&; /** Glean { "field": "managed_string_view" } */ [[deprecated("Use `FOO.managed_string_view().value();` instead of `FOO.get_managed_string_view();`")]] - ::apache::thrift::ManagedStringViewWithConversions get_managed_string_view() && { - return static_cast<::apache::thrift::ManagedStringViewWithConversions&&>(__fbthrift_field_managed_string_view); - } + ::apache::thrift::ManagedStringViewWithConversions get_managed_string_view() &&; /** Glean { "field": "managed_string_view" } */ template diff --git a/thrift/compiler/test/fixtures/python_capi/out/cpp2_containers/gen-cpp2/containers_types.cpp b/thrift/compiler/test/fixtures/python_capi/out/cpp2_containers/gen-cpp2/containers_types.cpp index 6cba08a21b6..6effc5ee73b 100644 --- a/thrift/compiler/test/fixtures/python_capi/out/cpp2_containers/gen-cpp2/containers_types.cpp +++ b/thrift/compiler/test/fixtures/python_capi/out/cpp2_containers/gen-cpp2/containers_types.cpp @@ -646,6 +646,22 @@ bool TWrapped::operator<([[maybe_unused]] const TWrapped& rhs) const { } +const ::std::string& TWrapped::get_fieldA() const& { + return __fbthrift_field_fieldA; +} + +::std::string TWrapped::get_fieldA() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldA); +} + +const ::std::string& TWrapped::get_fieldB() const& { + return __fbthrift_field_fieldB; +} + +::std::string TWrapped::get_fieldB() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldB); +} + void swap([[maybe_unused]] TWrapped& a, [[maybe_unused]] TWrapped& b) { using ::std::swap; swap(a.__fbthrift_field_fieldA, b.__fbthrift_field_fieldA); diff --git a/thrift/compiler/test/fixtures/python_capi/out/cpp2_containers/gen-cpp2/containers_types.h b/thrift/compiler/test/fixtures/python_capi/out/cpp2_containers/gen-cpp2/containers_types.h index 850f09a212d..d70a7800a37 100644 --- a/thrift/compiler/test/fixtures/python_capi/out/cpp2_containers/gen-cpp2/containers_types.h +++ b/thrift/compiler/test/fixtures/python_capi/out/cpp2_containers/gen-cpp2/containers_types.h @@ -1980,15 +1980,11 @@ class TWrapped final { /** Glean { "field": "fieldA" } */ [[deprecated("Use `FOO.fieldA().value();` instead of `FOO.get_fieldA();`")]] - const ::std::string& get_fieldA() const& { - return __fbthrift_field_fieldA; - } + const ::std::string& get_fieldA() const&; /** Glean { "field": "fieldA" } */ [[deprecated("Use `FOO.fieldA().value();` instead of `FOO.get_fieldA();`")]] - ::std::string get_fieldA() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldA); - } + ::std::string get_fieldA() &&; /** Glean { "field": "fieldA" } */ template @@ -2000,15 +1996,11 @@ class TWrapped final { /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - const ::std::string& get_fieldB() const& { - return __fbthrift_field_fieldB; - } + const ::std::string& get_fieldB() const&; /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - ::std::string get_fieldB() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldB); - } + ::std::string get_fieldB() &&; /** Glean { "field": "fieldB" } */ template diff --git a/thrift/compiler/test/fixtures/python_capi/out/cpp2_serialized_dep/gen-cpp2/serialized_dep_types.cpp b/thrift/compiler/test/fixtures/python_capi/out/cpp2_serialized_dep/gen-cpp2/serialized_dep_types.cpp index f148d9503f5..0f63267c06a 100644 --- a/thrift/compiler/test/fixtures/python_capi/out/cpp2_serialized_dep/gen-cpp2/serialized_dep_types.cpp +++ b/thrift/compiler/test/fixtures/python_capi/out/cpp2_serialized_dep/gen-cpp2/serialized_dep_types.cpp @@ -111,6 +111,14 @@ bool SerializedStruct::operator<([[maybe_unused]] const SerializedStruct& rhs) c } +const ::std::string& SerializedStruct::get_s() const& { + return __fbthrift_field_s; +} + +::std::string SerializedStruct::get_s() && { + return static_cast<::std::string&&>(__fbthrift_field_s); +} + ::std::int32_t SerializedStruct::get_i() const { return __fbthrift_field_i; } @@ -128,6 +136,14 @@ ::std::string* SerializedStruct::get_os() & { return os_ref().has_value() ? std::addressof(__fbthrift_field_os) : nullptr; } +const ::std::string& SerializedStruct::get_rs() const& { + return __fbthrift_field_rs; +} + +::std::string SerializedStruct::get_rs() && { + return static_cast<::std::string&&>(__fbthrift_field_rs); +} + void swap([[maybe_unused]] SerializedStruct& a, [[maybe_unused]] SerializedStruct& b) { using ::std::swap; swap(a.__fbthrift_field_s, b.__fbthrift_field_s); @@ -379,6 +395,14 @@ bool SerializedError::operator<([[maybe_unused]] const SerializedError& rhs) con } +const ::std::string& SerializedError::get_msg() const& { + return __fbthrift_field_msg; +} + +::std::string SerializedError::get_msg() && { + return static_cast<::std::string&&>(__fbthrift_field_msg); +} + const ::std::string* SerializedError::get_os() const& { return os_ref().has_value() ? std::addressof(__fbthrift_field_os) : nullptr; } @@ -387,6 +411,14 @@ ::std::string* SerializedError::get_os() & { return os_ref().has_value() ? std::addressof(__fbthrift_field_os) : nullptr; } +const ::std::string& SerializedError::get_rs() const& { + return __fbthrift_field_rs; +} + +::std::string SerializedError::get_rs() && { + return static_cast<::std::string&&>(__fbthrift_field_rs); +} + void swap([[maybe_unused]] SerializedError& a, [[maybe_unused]] SerializedError& b) { using ::std::swap; swap(a.__fbthrift_field_msg, b.__fbthrift_field_msg); @@ -505,6 +537,14 @@ bool MarshalStruct::operator<([[maybe_unused]] const MarshalStruct& rhs) const { } +const ::std::string& MarshalStruct::get_s() const& { + return __fbthrift_field_s; +} + +::std::string MarshalStruct::get_s() && { + return static_cast<::std::string&&>(__fbthrift_field_s); +} + ::std::int32_t MarshalStruct::get_i() const { return __fbthrift_field_i; } @@ -522,6 +562,14 @@ ::std::string* MarshalStruct::get_os() & { return os_ref().has_value() ? std::addressof(__fbthrift_field_os) : nullptr; } +const ::std::string& MarshalStruct::get_rs() const& { + return __fbthrift_field_rs; +} + +::std::string MarshalStruct::get_rs() && { + return static_cast<::std::string&&>(__fbthrift_field_rs); +} + void swap([[maybe_unused]] MarshalStruct& a, [[maybe_unused]] MarshalStruct& b) { using ::std::swap; swap(a.__fbthrift_field_s, b.__fbthrift_field_s); @@ -773,6 +821,14 @@ bool MarshalError::operator<([[maybe_unused]] const MarshalError& rhs) const { } +const ::std::string& MarshalError::get_msg() const& { + return __fbthrift_field_msg; +} + +::std::string MarshalError::get_msg() && { + return static_cast<::std::string&&>(__fbthrift_field_msg); +} + const ::std::string* MarshalError::get_os() const& { return os_ref().has_value() ? std::addressof(__fbthrift_field_os) : nullptr; } @@ -781,6 +837,14 @@ ::std::string* MarshalError::get_os() & { return os_ref().has_value() ? std::addressof(__fbthrift_field_os) : nullptr; } +const ::std::string& MarshalError::get_rs() const& { + return __fbthrift_field_rs; +} + +::std::string MarshalError::get_rs() && { + return static_cast<::std::string&&>(__fbthrift_field_rs); +} + void swap([[maybe_unused]] MarshalError& a, [[maybe_unused]] MarshalError& b) { using ::std::swap; swap(a.__fbthrift_field_msg, b.__fbthrift_field_msg); diff --git a/thrift/compiler/test/fixtures/python_capi/out/cpp2_serialized_dep/gen-cpp2/serialized_dep_types.h b/thrift/compiler/test/fixtures/python_capi/out/cpp2_serialized_dep/gen-cpp2/serialized_dep_types.h index e85ec4dc0be..37cbd9b3107 100644 --- a/thrift/compiler/test/fixtures/python_capi/out/cpp2_serialized_dep/gen-cpp2/serialized_dep_types.h +++ b/thrift/compiler/test/fixtures/python_capi/out/cpp2_serialized_dep/gen-cpp2/serialized_dep_types.h @@ -426,15 +426,11 @@ class SerializedStruct final { /** Glean { "field": "s" } */ [[deprecated("Use `FOO.s().value();` instead of `FOO.get_s();`")]] - const ::std::string& get_s() const& { - return __fbthrift_field_s; - } + const ::std::string& get_s() const&; /** Glean { "field": "s" } */ [[deprecated("Use `FOO.s().value();` instead of `FOO.get_s();`")]] - ::std::string get_s() && { - return static_cast<::std::string&&>(__fbthrift_field_s); - } + ::std::string get_s() &&; /** Glean { "field": "s" } */ template @@ -472,15 +468,11 @@ class SerializedStruct final { /** Glean { "field": "rs" } */ [[deprecated("Use `FOO.rs().value();` instead of `FOO.get_rs();`")]] - const ::std::string& get_rs() const& { - return __fbthrift_field_rs; - } + const ::std::string& get_rs() const&; /** Glean { "field": "rs" } */ [[deprecated("Use `FOO.rs().value();` instead of `FOO.get_rs();`")]] - ::std::string get_rs() && { - return static_cast<::std::string&&>(__fbthrift_field_rs); - } + ::std::string get_rs() &&; /** Glean { "field": "rs" } */ template @@ -1052,15 +1044,11 @@ class FOLLY_EXPORT SerializedError : public virtual apache::thrift::TException { /** Glean { "field": "msg" } */ [[deprecated("Use `FOO.msg().value();` instead of `FOO.get_msg();`")]] - const ::std::string& get_msg() const& { - return __fbthrift_field_msg; - } + const ::std::string& get_msg() const&; /** Glean { "field": "msg" } */ [[deprecated("Use `FOO.msg().value();` instead of `FOO.get_msg();`")]] - ::std::string get_msg() && { - return static_cast<::std::string&&>(__fbthrift_field_msg); - } + ::std::string get_msg() &&; /** Glean { "field": "msg" } */ template @@ -1090,15 +1078,11 @@ class FOLLY_EXPORT SerializedError : public virtual apache::thrift::TException { /** Glean { "field": "rs" } */ [[deprecated("Use `FOO.rs().value();` instead of `FOO.get_rs();`")]] - const ::std::string& get_rs() const& { - return __fbthrift_field_rs; - } + const ::std::string& get_rs() const&; /** Glean { "field": "rs" } */ [[deprecated("Use `FOO.rs().value();` instead of `FOO.get_rs();`")]] - ::std::string get_rs() && { - return static_cast<::std::string&&>(__fbthrift_field_rs); - } + ::std::string get_rs() &&; /** Glean { "field": "rs" } */ template @@ -1426,15 +1410,11 @@ class MarshalStruct final { /** Glean { "field": "s" } */ [[deprecated("Use `FOO.s().value();` instead of `FOO.get_s();`")]] - const ::std::string& get_s() const& { - return __fbthrift_field_s; - } + const ::std::string& get_s() const&; /** Glean { "field": "s" } */ [[deprecated("Use `FOO.s().value();` instead of `FOO.get_s();`")]] - ::std::string get_s() && { - return static_cast<::std::string&&>(__fbthrift_field_s); - } + ::std::string get_s() &&; /** Glean { "field": "s" } */ template @@ -1472,15 +1452,11 @@ class MarshalStruct final { /** Glean { "field": "rs" } */ [[deprecated("Use `FOO.rs().value();` instead of `FOO.get_rs();`")]] - const ::std::string& get_rs() const& { - return __fbthrift_field_rs; - } + const ::std::string& get_rs() const&; /** Glean { "field": "rs" } */ [[deprecated("Use `FOO.rs().value();` instead of `FOO.get_rs();`")]] - ::std::string get_rs() && { - return static_cast<::std::string&&>(__fbthrift_field_rs); - } + ::std::string get_rs() &&; /** Glean { "field": "rs" } */ template @@ -2052,15 +2028,11 @@ class FOLLY_EXPORT MarshalError : public virtual apache::thrift::TException { /** Glean { "field": "msg" } */ [[deprecated("Use `FOO.msg().value();` instead of `FOO.get_msg();`")]] - const ::std::string& get_msg() const& { - return __fbthrift_field_msg; - } + const ::std::string& get_msg() const&; /** Glean { "field": "msg" } */ [[deprecated("Use `FOO.msg().value();` instead of `FOO.get_msg();`")]] - ::std::string get_msg() && { - return static_cast<::std::string&&>(__fbthrift_field_msg); - } + ::std::string get_msg() &&; /** Glean { "field": "msg" } */ template @@ -2090,15 +2062,11 @@ class FOLLY_EXPORT MarshalError : public virtual apache::thrift::TException { /** Glean { "field": "rs" } */ [[deprecated("Use `FOO.rs().value();` instead of `FOO.get_rs();`")]] - const ::std::string& get_rs() const& { - return __fbthrift_field_rs; - } + const ::std::string& get_rs() const&; /** Glean { "field": "rs" } */ [[deprecated("Use `FOO.rs().value();` instead of `FOO.get_rs();`")]] - ::std::string get_rs() && { - return static_cast<::std::string&&>(__fbthrift_field_rs); - } + ::std::string get_rs() &&; /** Glean { "field": "rs" } */ template diff --git a/thrift/compiler/test/fixtures/service-schema/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/service-schema/out/cpp2/gen-cpp2/module_types.cpp index 1683477a599..43ae4f43202 100644 --- a/thrift/compiler/test/fixtures/service-schema/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/service-schema/out/cpp2/gen-cpp2/module_types.cpp @@ -115,6 +115,14 @@ bool CustomException::operator<([[maybe_unused]] const CustomException& rhs) con } +const ::std::string& CustomException::get_name() const& { + return __fbthrift_field_name; +} + +::std::string CustomException::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + ::cpp2::Result CustomException::get_result() const { return __fbthrift_field_result; } diff --git a/thrift/compiler/test/fixtures/service-schema/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/service-schema/out/cpp2/gen-cpp2/module_types.h index 27355eb5a95..14873784d44 100644 --- a/thrift/compiler/test/fixtures/service-schema/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/service-schema/out/cpp2/gen-cpp2/module_types.h @@ -299,15 +299,11 @@ class FOLLY_EXPORT CustomException : public virtual apache::thrift::TException { /** 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 diff --git a/thrift/compiler/test/fixtures/service-schema/out/cpp2_sinit/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/service-schema/out/cpp2_sinit/gen-cpp2/module_types.cpp index f3844294974..55b6e77424a 100644 --- a/thrift/compiler/test/fixtures/service-schema/out/cpp2_sinit/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/service-schema/out/cpp2_sinit/gen-cpp2/module_types.cpp @@ -122,6 +122,14 @@ bool CustomException::operator<([[maybe_unused]] const CustomException& rhs) con } +const ::std::string& CustomException::get_name() const& { + return __fbthrift_field_name; +} + +::std::string CustomException::get_name() && { + return static_cast<::std::string&&>(__fbthrift_field_name); +} + ::cpp2::Result CustomException::get_result() const { return __fbthrift_field_result; } diff --git a/thrift/compiler/test/fixtures/service-schema/out/cpp2_sinit/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/service-schema/out/cpp2_sinit/gen-cpp2/module_types.h index 27355eb5a95..14873784d44 100644 --- a/thrift/compiler/test/fixtures/service-schema/out/cpp2_sinit/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/service-schema/out/cpp2_sinit/gen-cpp2/module_types.h @@ -299,15 +299,11 @@ class FOLLY_EXPORT CustomException : public virtual apache::thrift::TException { /** 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 diff --git a/thrift/compiler/test/fixtures/sink/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/sink/out/cpp2/gen-cpp2/module_types.cpp index 55135c0f417..294f42948d8 100644 --- a/thrift/compiler/test/fixtures/sink/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/sink/out/cpp2/gen-cpp2/module_types.cpp @@ -92,6 +92,14 @@ bool InitialResponse::operator<([[maybe_unused]] const InitialResponse& rhs) con } +const ::std::string& InitialResponse::get_content() const& { + return __fbthrift_field_content; +} + +::std::string InitialResponse::get_content() && { + return static_cast<::std::string&&>(__fbthrift_field_content); +} + void swap([[maybe_unused]] InitialResponse& a, [[maybe_unused]] InitialResponse& b) { using ::std::swap; swap(a.__fbthrift_field_content, b.__fbthrift_field_content); @@ -189,6 +197,14 @@ bool FinalResponse::operator<([[maybe_unused]] const FinalResponse& rhs) const { } +const ::std::string& FinalResponse::get_content() const& { + return __fbthrift_field_content; +} + +::std::string FinalResponse::get_content() && { + return static_cast<::std::string&&>(__fbthrift_field_content); +} + void swap([[maybe_unused]] FinalResponse& a, [[maybe_unused]] FinalResponse& b) { using ::std::swap; swap(a.__fbthrift_field_content, b.__fbthrift_field_content); @@ -286,6 +302,14 @@ bool SinkPayload::operator<([[maybe_unused]] const SinkPayload& rhs) const { } +const ::std::string& SinkPayload::get_content() const& { + return __fbthrift_field_content; +} + +::std::string SinkPayload::get_content() && { + return static_cast<::std::string&&>(__fbthrift_field_content); +} + void swap([[maybe_unused]] SinkPayload& a, [[maybe_unused]] SinkPayload& b) { using ::std::swap; swap(a.__fbthrift_field_content, b.__fbthrift_field_content); @@ -383,6 +407,14 @@ bool CompatibleWithKeywordSink::operator<([[maybe_unused]] const CompatibleWithK } +const ::std::string& CompatibleWithKeywordSink::get_sink() const& { + return __fbthrift_field_sink; +} + +::std::string CompatibleWithKeywordSink::get_sink() && { + return static_cast<::std::string&&>(__fbthrift_field_sink); +} + void swap([[maybe_unused]] CompatibleWithKeywordSink& a, [[maybe_unused]] CompatibleWithKeywordSink& b) { using ::std::swap; swap(a.__fbthrift_field_sink, b.__fbthrift_field_sink); @@ -480,6 +512,14 @@ bool InitialException::operator<([[maybe_unused]] const InitialException& rhs) c } +const ::std::string& InitialException::get_reason() const& { + return __fbthrift_field_reason; +} + +::std::string InitialException::get_reason() && { + return static_cast<::std::string&&>(__fbthrift_field_reason); +} + void swap([[maybe_unused]] InitialException& a, [[maybe_unused]] InitialException& b) { using ::std::swap; swap(a.__fbthrift_field_reason, b.__fbthrift_field_reason); @@ -577,6 +617,14 @@ bool SinkException1::operator<([[maybe_unused]] const SinkException1& rhs) const } +const ::std::string& SinkException1::get_reason() const& { + return __fbthrift_field_reason; +} + +::std::string SinkException1::get_reason() && { + return static_cast<::std::string&&>(__fbthrift_field_reason); +} + void swap([[maybe_unused]] SinkException1& a, [[maybe_unused]] SinkException1& b) { using ::std::swap; swap(a.__fbthrift_field_reason, b.__fbthrift_field_reason); diff --git a/thrift/compiler/test/fixtures/sink/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/sink/out/cpp2/gen-cpp2/module_types.h index a4a7152f587..94c6402b90c 100644 --- a/thrift/compiler/test/fixtures/sink/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/sink/out/cpp2/gen-cpp2/module_types.h @@ -215,15 +215,11 @@ class InitialResponse final { /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - const ::std::string& get_content() const& { - return __fbthrift_field_content; - } + const ::std::string& get_content() const&; /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - ::std::string get_content() && { - return static_cast<::std::string&&>(__fbthrift_field_content); - } + ::std::string get_content() &&; /** Glean { "field": "content" } */ template @@ -390,15 +386,11 @@ class FinalResponse final { /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - const ::std::string& get_content() const& { - return __fbthrift_field_content; - } + const ::std::string& get_content() const&; /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - ::std::string get_content() && { - return static_cast<::std::string&&>(__fbthrift_field_content); - } + ::std::string get_content() &&; /** Glean { "field": "content" } */ template @@ -565,15 +557,11 @@ class SinkPayload final { /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - const ::std::string& get_content() const& { - return __fbthrift_field_content; - } + const ::std::string& get_content() const&; /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - ::std::string get_content() && { - return static_cast<::std::string&&>(__fbthrift_field_content); - } + ::std::string get_content() &&; /** Glean { "field": "content" } */ template @@ -740,15 +728,11 @@ class CompatibleWithKeywordSink final { /** Glean { "field": "sink" } */ [[deprecated("Use `FOO.sink().value();` instead of `FOO.get_sink();`")]] - const ::std::string& get_sink() const& { - return __fbthrift_field_sink; - } + const ::std::string& get_sink() const&; /** Glean { "field": "sink" } */ [[deprecated("Use `FOO.sink().value();` instead of `FOO.get_sink();`")]] - ::std::string get_sink() && { - return static_cast<::std::string&&>(__fbthrift_field_sink); - } + ::std::string get_sink() &&; /** Glean { "field": "sink" } */ template @@ -921,15 +905,11 @@ class FOLLY_EXPORT InitialException : public virtual apache::thrift::TException /** Glean { "field": "reason" } */ [[deprecated("Use `FOO.reason().value();` instead of `FOO.get_reason();`")]] - const ::std::string& get_reason() const& { - return __fbthrift_field_reason; - } + const ::std::string& get_reason() const&; /** Glean { "field": "reason" } */ [[deprecated("Use `FOO.reason().value();` instead of `FOO.get_reason();`")]] - ::std::string get_reason() && { - return static_cast<::std::string&&>(__fbthrift_field_reason); - } + ::std::string get_reason() &&; /** Glean { "field": "reason" } */ template @@ -1106,15 +1086,11 @@ class FOLLY_EXPORT SinkException1 : public virtual apache::thrift::TException { /** Glean { "field": "reason" } */ [[deprecated("Use `FOO.reason().value();` instead of `FOO.get_reason();`")]] - const ::std::string& get_reason() const& { - return __fbthrift_field_reason; - } + const ::std::string& get_reason() const&; /** Glean { "field": "reason" } */ [[deprecated("Use `FOO.reason().value();` instead of `FOO.get_reason();`")]] - ::std::string get_reason() && { - return static_cast<::std::string&&>(__fbthrift_field_reason); - } + ::std::string get_reason() &&; /** Glean { "field": "reason" } */ template diff --git a/thrift/compiler/test/fixtures/split/out/cpp2/gen-cpp2/module_types.2.split.cpp b/thrift/compiler/test/fixtures/split/out/cpp2/gen-cpp2/module_types.2.split.cpp index 5024fa5db5a..28d76437b01 100644 --- a/thrift/compiler/test/fixtures/split/out/cpp2/gen-cpp2/module_types.2.split.cpp +++ b/thrift/compiler/test/fixtures/split/out/cpp2/gen-cpp2/module_types.2.split.cpp @@ -135,6 +135,14 @@ ::std::int64_t& MyStruct::set_MyIntField(::std::int64_t MyIntField_) { return __fbthrift_field_MyIntField; } +const ::std::string& MyStruct::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyStruct::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + const ::cpp2::MyDataItem& MyStruct::get_MyDataField() const& { return __fbthrift_field_MyDataField; } diff --git a/thrift/compiler/test/fixtures/split/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/split/out/cpp2/gen-cpp2/module_types.h index fc5b8412386..e0c6df1a8fb 100644 --- a/thrift/compiler/test/fixtures/split/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/split/out/cpp2/gen-cpp2/module_types.h @@ -700,15 +700,11 @@ class MyStruct final { /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template diff --git a/thrift/compiler/test/fixtures/sync-methods-return-try/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/sync-methods-return-try/out/cpp2/gen-cpp2/module_types.cpp index cda0899ee0a..69a2ff67d2d 100644 --- a/thrift/compiler/test/fixtures/sync-methods-return-try/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/sync-methods-return-try/out/cpp2/gen-cpp2/module_types.cpp @@ -344,6 +344,14 @@ bool InitialResponse::operator<([[maybe_unused]] const InitialResponse& rhs) con } +const ::std::string& InitialResponse::get_content() const& { + return __fbthrift_field_content; +} + +::std::string InitialResponse::get_content() && { + return static_cast<::std::string&&>(__fbthrift_field_content); +} + void swap([[maybe_unused]] InitialResponse& a, [[maybe_unused]] InitialResponse& b) { using ::std::swap; swap(a.__fbthrift_field_content, b.__fbthrift_field_content); @@ -441,6 +449,14 @@ bool FinalResponse::operator<([[maybe_unused]] const FinalResponse& rhs) const { } +const ::std::string& FinalResponse::get_content() const& { + return __fbthrift_field_content; +} + +::std::string FinalResponse::get_content() && { + return static_cast<::std::string&&>(__fbthrift_field_content); +} + void swap([[maybe_unused]] FinalResponse& a, [[maybe_unused]] FinalResponse& b) { using ::std::swap; swap(a.__fbthrift_field_content, b.__fbthrift_field_content); @@ -538,6 +554,14 @@ bool SinkPayload::operator<([[maybe_unused]] const SinkPayload& rhs) const { } +const ::std::string& SinkPayload::get_content() const& { + return __fbthrift_field_content; +} + +::std::string SinkPayload::get_content() && { + return static_cast<::std::string&&>(__fbthrift_field_content); +} + void swap([[maybe_unused]] SinkPayload& a, [[maybe_unused]] SinkPayload& b) { using ::std::swap; swap(a.__fbthrift_field_content, b.__fbthrift_field_content); @@ -635,6 +659,14 @@ bool CompatibleWithKeywordSink::operator<([[maybe_unused]] const CompatibleWithK } +const ::std::string& CompatibleWithKeywordSink::get_sink() const& { + return __fbthrift_field_sink; +} + +::std::string CompatibleWithKeywordSink::get_sink() && { + return static_cast<::std::string&&>(__fbthrift_field_sink); +} + void swap([[maybe_unused]] CompatibleWithKeywordSink& a, [[maybe_unused]] CompatibleWithKeywordSink& b) { using ::std::swap; swap(a.__fbthrift_field_sink, b.__fbthrift_field_sink); @@ -732,6 +764,14 @@ bool InitialException::operator<([[maybe_unused]] const InitialException& rhs) c } +const ::std::string& InitialException::get_reason() const& { + return __fbthrift_field_reason; +} + +::std::string InitialException::get_reason() && { + return static_cast<::std::string&&>(__fbthrift_field_reason); +} + void swap([[maybe_unused]] InitialException& a, [[maybe_unused]] InitialException& b) { using ::std::swap; swap(a.__fbthrift_field_reason, b.__fbthrift_field_reason); @@ -829,6 +869,14 @@ bool SinkException1::operator<([[maybe_unused]] const SinkException1& rhs) const } +const ::std::string& SinkException1::get_reason() const& { + return __fbthrift_field_reason; +} + +::std::string SinkException1::get_reason() && { + return static_cast<::std::string&&>(__fbthrift_field_reason); +} + void swap([[maybe_unused]] SinkException1& a, [[maybe_unused]] SinkException1& b) { using ::std::swap; swap(a.__fbthrift_field_reason, b.__fbthrift_field_reason); @@ -1033,6 +1081,14 @@ bool StreamItem::operator<([[maybe_unused]] const StreamItem& rhs) const { } +const ::std::string& StreamItem::get_content() const& { + return __fbthrift_field_content; +} + +::std::string StreamItem::get_content() && { + return static_cast<::std::string&&>(__fbthrift_field_content); +} + void swap([[maybe_unused]] StreamItem& a, [[maybe_unused]] StreamItem& b) { using ::std::swap; swap(a.__fbthrift_field_content, b.__fbthrift_field_content); diff --git a/thrift/compiler/test/fixtures/sync-methods-return-try/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/sync-methods-return-try/out/cpp2/gen-cpp2/module_types.h index c1d5c3bb8fb..405952f3fdc 100644 --- a/thrift/compiler/test/fixtures/sync-methods-return-try/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/sync-methods-return-try/out/cpp2/gen-cpp2/module_types.h @@ -557,15 +557,11 @@ class InitialResponse final { /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - const ::std::string& get_content() const& { - return __fbthrift_field_content; - } + const ::std::string& get_content() const&; /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - ::std::string get_content() && { - return static_cast<::std::string&&>(__fbthrift_field_content); - } + ::std::string get_content() &&; /** Glean { "field": "content" } */ template @@ -732,15 +728,11 @@ class FinalResponse final { /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - const ::std::string& get_content() const& { - return __fbthrift_field_content; - } + const ::std::string& get_content() const&; /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - ::std::string get_content() && { - return static_cast<::std::string&&>(__fbthrift_field_content); - } + ::std::string get_content() &&; /** Glean { "field": "content" } */ template @@ -907,15 +899,11 @@ class SinkPayload final { /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - const ::std::string& get_content() const& { - return __fbthrift_field_content; - } + const ::std::string& get_content() const&; /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - ::std::string get_content() && { - return static_cast<::std::string&&>(__fbthrift_field_content); - } + ::std::string get_content() &&; /** Glean { "field": "content" } */ template @@ -1082,15 +1070,11 @@ class CompatibleWithKeywordSink final { /** Glean { "field": "sink" } */ [[deprecated("Use `FOO.sink().value();` instead of `FOO.get_sink();`")]] - const ::std::string& get_sink() const& { - return __fbthrift_field_sink; - } + const ::std::string& get_sink() const&; /** Glean { "field": "sink" } */ [[deprecated("Use `FOO.sink().value();` instead of `FOO.get_sink();`")]] - ::std::string get_sink() && { - return static_cast<::std::string&&>(__fbthrift_field_sink); - } + ::std::string get_sink() &&; /** Glean { "field": "sink" } */ template @@ -1263,15 +1247,11 @@ class FOLLY_EXPORT InitialException : public virtual apache::thrift::TException /** Glean { "field": "reason" } */ [[deprecated("Use `FOO.reason().value();` instead of `FOO.get_reason();`")]] - const ::std::string& get_reason() const& { - return __fbthrift_field_reason; - } + const ::std::string& get_reason() const&; /** Glean { "field": "reason" } */ [[deprecated("Use `FOO.reason().value();` instead of `FOO.get_reason();`")]] - ::std::string get_reason() && { - return static_cast<::std::string&&>(__fbthrift_field_reason); - } + ::std::string get_reason() &&; /** Glean { "field": "reason" } */ template @@ -1448,15 +1428,11 @@ class FOLLY_EXPORT SinkException1 : public virtual apache::thrift::TException { /** Glean { "field": "reason" } */ [[deprecated("Use `FOO.reason().value();` instead of `FOO.get_reason();`")]] - const ::std::string& get_reason() const& { - return __fbthrift_field_reason; - } + const ::std::string& get_reason() const&; /** Glean { "field": "reason" } */ [[deprecated("Use `FOO.reason().value();` instead of `FOO.get_reason();`")]] - ::std::string get_reason() && { - return static_cast<::std::string&&>(__fbthrift_field_reason); - } + ::std::string get_reason() &&; /** Glean { "field": "reason" } */ template @@ -1800,15 +1776,11 @@ class StreamItem final { /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - const ::std::string& get_content() const& { - return __fbthrift_field_content; - } + const ::std::string& get_content() const&; /** Glean { "field": "content" } */ [[deprecated("Use `FOO.content().value();` instead of `FOO.get_content();`")]] - ::std::string get_content() && { - return static_cast<::std::string&&>(__fbthrift_field_content); - } + ::std::string get_content() &&; /** Glean { "field": "content" } */ template diff --git a/thrift/compiler/test/fixtures/templated-deserialize/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/templated-deserialize/out/cpp2/gen-cpp2/module_types.cpp index a9baad1a6cc..e77e4097bb7 100644 --- a/thrift/compiler/test/fixtures/templated-deserialize/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/templated-deserialize/out/cpp2/gen-cpp2/module_types.cpp @@ -389,6 +389,22 @@ ::std::set<::std::int32_t> containerStruct::get_fieldC() && { return static_cast<::std::set<::std::int32_t>&&>(__fbthrift_field_fieldC); } +const ::std::string& containerStruct::get_fieldD() const& { + return __fbthrift_field_fieldD; +} + +::std::string containerStruct::get_fieldD() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldD); +} + +const ::std::string& containerStruct::get_fieldE() const& { + return __fbthrift_field_fieldE; +} + +::std::string containerStruct::get_fieldE() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldE); +} + const ::std::vector<::std::vector<::std::vector<::std::int32_t>>>& containerStruct::get_fieldF() const& { return __fbthrift_field_fieldF; } diff --git a/thrift/compiler/test/fixtures/templated-deserialize/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/templated-deserialize/out/cpp2/gen-cpp2/module_types.h index 0948ccaf802..013ce1b1f0e 100644 --- a/thrift/compiler/test/fixtures/templated-deserialize/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/templated-deserialize/out/cpp2/gen-cpp2/module_types.h @@ -1706,15 +1706,11 @@ class containerStruct final { /** Glean { "field": "fieldD" } */ [[deprecated("Use `FOO.fieldD().value();` instead of `FOO.get_fieldD();`")]] - const ::std::string& get_fieldD() const& { - return __fbthrift_field_fieldD; - } + const ::std::string& get_fieldD() const&; /** Glean { "field": "fieldD" } */ [[deprecated("Use `FOO.fieldD().value();` instead of `FOO.get_fieldD();`")]] - ::std::string get_fieldD() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldD); - } + ::std::string get_fieldD() &&; /** Glean { "field": "fieldD" } */ template @@ -1726,15 +1722,11 @@ class containerStruct final { /** Glean { "field": "fieldE" } */ [[deprecated("Use `FOO.fieldE().value();` instead of `FOO.get_fieldE();`")]] - const ::std::string& get_fieldE() const& { - return __fbthrift_field_fieldE; - } + const ::std::string& get_fieldE() const&; /** Glean { "field": "fieldE" } */ [[deprecated("Use `FOO.fieldE().value();` instead of `FOO.get_fieldE();`")]] - ::std::string get_fieldE() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldE); - } + ::std::string get_fieldE() &&; /** Glean { "field": "fieldE" } */ template diff --git a/thrift/compiler/test/fixtures/terse_write/out/cpp2/gen-cpp2/terse_write_types.cpp b/thrift/compiler/test/fixtures/terse_write/out/cpp2/gen-cpp2/terse_write_types.cpp index 4276e13db14..ff0846c692d 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/cpp2/gen-cpp2/terse_write_types.cpp +++ b/thrift/compiler/test/fixtures/terse_write/out/cpp2/gen-cpp2/terse_write_types.cpp @@ -965,6 +965,22 @@ double& FieldLevelTerseStruct::set_double_field(double double_field_) { return __fbthrift_field_double_field; } +const ::std::string& FieldLevelTerseStruct::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::std::string FieldLevelTerseStruct::get_string_field() && { + return static_cast<::std::string&&>(__fbthrift_field_string_field); +} + +const ::std::string& FieldLevelTerseStruct::get_binary_field() const& { + return __fbthrift_field_binary_field; +} + +::std::string FieldLevelTerseStruct::get_binary_field() && { + return static_cast<::std::string&&>(__fbthrift_field_binary_field); +} + ::facebook::thrift::test::terse_write::MyEnum FieldLevelTerseStruct::get_enum_field() const { return __fbthrift_field_enum_field; } diff --git a/thrift/compiler/test/fixtures/terse_write/out/cpp2/gen-cpp2/terse_write_types.h b/thrift/compiler/test/fixtures/terse_write/out/cpp2/gen-cpp2/terse_write_types.h index 95e940fc80e..691a986bf2e 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/cpp2/gen-cpp2/terse_write_types.h +++ b/thrift/compiler/test/fixtures/terse_write/out/cpp2/gen-cpp2/terse_write_types.h @@ -4533,15 +4533,11 @@ class FieldLevelTerseStruct final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::std::string& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::std::string& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::std::string get_string_field() && { - return static_cast<::std::string&&>(__fbthrift_field_string_field); - } + ::std::string get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -4553,15 +4549,11 @@ class FieldLevelTerseStruct final { /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - const ::std::string& get_binary_field() const& { - return __fbthrift_field_binary_field; - } + const ::std::string& get_binary_field() const&; /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - ::std::string get_binary_field() && { - return static_cast<::std::string&&>(__fbthrift_field_binary_field); - } + ::std::string get_binary_field() &&; /** Glean { "field": "binary_field" } */ template diff --git a/thrift/compiler/test/fixtures/terse_write/out/cpp2_deprecated_terse_writ/gen-cpp2/deprecated_terse_write_types.cpp b/thrift/compiler/test/fixtures/terse_write/out/cpp2_deprecated_terse_writ/gen-cpp2/deprecated_terse_write_types.cpp index cf8dc08ec9e..21104bb4a49 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/cpp2_deprecated_terse_writ/gen-cpp2/deprecated_terse_write_types.cpp +++ b/thrift/compiler/test/fixtures/terse_write/out/cpp2_deprecated_terse_writ/gen-cpp2/deprecated_terse_write_types.cpp @@ -599,6 +599,22 @@ double& FieldLevelTerseStruct::set_double_field(double double_field_) { return __fbthrift_field_double_field; } +const ::std::string& FieldLevelTerseStruct::get_string_field() const& { + return __fbthrift_field_string_field; +} + +::std::string FieldLevelTerseStruct::get_string_field() && { + return static_cast<::std::string&&>(__fbthrift_field_string_field); +} + +const ::std::string& FieldLevelTerseStruct::get_binary_field() const& { + return __fbthrift_field_binary_field; +} + +::std::string FieldLevelTerseStruct::get_binary_field() && { + return static_cast<::std::string&&>(__fbthrift_field_binary_field); +} + ::facebook::thrift::test::terse_write::deprecated::MyEnum FieldLevelTerseStruct::get_enum_field() const { return __fbthrift_field_enum_field; } diff --git a/thrift/compiler/test/fixtures/terse_write/out/cpp2_deprecated_terse_writ/gen-cpp2/deprecated_terse_write_types.h b/thrift/compiler/test/fixtures/terse_write/out/cpp2_deprecated_terse_writ/gen-cpp2/deprecated_terse_write_types.h index 214863434c3..c65308ff1fe 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/cpp2_deprecated_terse_writ/gen-cpp2/deprecated_terse_write_types.h +++ b/thrift/compiler/test/fixtures/terse_write/out/cpp2_deprecated_terse_writ/gen-cpp2/deprecated_terse_write_types.h @@ -2832,15 +2832,11 @@ class FieldLevelTerseStruct final { /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - const ::std::string& get_string_field() const& { - return __fbthrift_field_string_field; - } + const ::std::string& get_string_field() const&; /** Glean { "field": "string_field" } */ [[deprecated("Use `FOO.string_field().value();` instead of `FOO.get_string_field();`")]] - ::std::string get_string_field() && { - return static_cast<::std::string&&>(__fbthrift_field_string_field); - } + ::std::string get_string_field() &&; /** Glean { "field": "string_field" } */ template @@ -2852,15 +2848,11 @@ class FieldLevelTerseStruct final { /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - const ::std::string& get_binary_field() const& { - return __fbthrift_field_binary_field; - } + const ::std::string& get_binary_field() const&; /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - ::std::string get_binary_field() && { - return static_cast<::std::string&&>(__fbthrift_field_binary_field); - } + ::std::string get_binary_field() &&; /** Glean { "field": "binary_field" } */ template diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.cpp index 41f42b14529..e926bbd5aac 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.cpp @@ -222,6 +222,14 @@ bool decorated_struct::operator<([[maybe_unused]] const decorated_struct& rhs) c } +const ::std::string& decorated_struct::get_field() const& { + return __fbthrift_field_field; +} + +::std::string decorated_struct::get_field() && { + return static_cast<::std::string&&>(__fbthrift_field_field); +} + void swap([[maybe_unused]] decorated_struct& a, [[maybe_unused]] decorated_struct& b) { using ::std::swap; swap(a.__fbthrift_field_field, b.__fbthrift_field_field); @@ -1065,6 +1073,14 @@ bool ComplexString::operator<([[maybe_unused]] const ComplexString& rhs) const { } +const ::std::string& ComplexString::get_a() const& { + return __fbthrift_field_a; +} + +::std::string ComplexString::get_a() && { + return static_cast<::std::string&&>(__fbthrift_field_a); +} + const ::std::map<::std::string, ::std::int32_t>& ComplexString::get_b() const& { return __fbthrift_field_b; } @@ -1182,6 +1198,14 @@ bool ComplexNestedWithDefault::operator<([[maybe_unused]] const ComplexNestedWit } +const ::std::string& ComplexNestedWithDefault::get_z() const& { + return __fbthrift_field_z; +} + +::std::string ComplexNestedWithDefault::get_z() && { + return static_cast<::std::string&&>(__fbthrift_field_z); +} + const ::apache::thrift::fixtures::types::ComplexString& ComplexNestedWithDefault::get_n() const& { return __fbthrift_field_n; } @@ -1607,6 +1631,14 @@ ::std::int64_t& MyStruct::set_MyIntField(::std::int64_t MyIntField_) { return __fbthrift_field_MyIntField; } +const ::std::string& MyStruct::get_MyStringField() const& { + return __fbthrift_field_MyStringField; +} + +::std::string MyStruct::get_MyStringField() && { + return static_cast<::std::string&&>(__fbthrift_field_MyStringField); +} + ::std::int64_t MyStruct::get_majorVer() const { return __fbthrift_field_majorVer; } @@ -1899,6 +1931,14 @@ bool AnnotatedTypes::operator<([[maybe_unused]] const AnnotatedTypes& rhs) const } +const ::apache::thrift::fixtures::types::TBinary_8623& AnnotatedTypes::get_binary_field() const& { + return __fbthrift_field_binary_field; +} + +::apache::thrift::fixtures::types::TBinary_8623 AnnotatedTypes::get_binary_field() && { + return static_cast<::apache::thrift::fixtures::types::TBinary_8623&&>(__fbthrift_field_binary_field); +} + const ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468& AnnotatedTypes::get_list_field() const& { return __fbthrift_field_list_field; } @@ -3652,6 +3692,14 @@ ::apache::thrift::fixtures::types::map_i32_i32_9565 AllocatorAware::get_aa_map() return static_cast<::apache::thrift::fixtures::types::map_i32_i32_9565&&>(__fbthrift_field_aa_map); } +const ::apache::thrift::fixtures::types::string_5252& AllocatorAware::get_aa_string() const& { + return __fbthrift_field_aa_string; +} + +::apache::thrift::fixtures::types::string_5252 AllocatorAware::get_aa_string() && { + return static_cast<::apache::thrift::fixtures::types::string_5252&&>(__fbthrift_field_aa_string); +} + ::std::int32_t AllocatorAware::get_not_a_container() const { return __fbthrift_field_not_a_container; } diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.h index 9e4991c661b..0e5d9a25240 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.h @@ -849,15 +849,11 @@ class decorated_struct final { /** Glean { "field": "field" } */ [[deprecated("Use `FOO.field().value();` instead of `FOO.get_field();`")]] - const ::std::string& get_field() const& { - return __fbthrift_field_field; - } + const ::std::string& get_field() const&; /** Glean { "field": "field" } */ [[deprecated("Use `FOO.field().value();` instead of `FOO.get_field();`")]] - ::std::string get_field() && { - return static_cast<::std::string&&>(__fbthrift_field_field); - } + ::std::string get_field() &&; /** Glean { "field": "field" } */ template @@ -2742,15 +2738,11 @@ class ComplexString final { /** Glean { "field": "a" } */ [[deprecated("Use `FOO.a().value();` instead of `FOO.get_a();`")]] - const ::std::string& get_a() const& { - return __fbthrift_field_a; - } + const ::std::string& get_a() const&; /** Glean { "field": "a" } */ [[deprecated("Use `FOO.a().value();` instead of `FOO.get_a();`")]] - ::std::string get_a() && { - return static_cast<::std::string&&>(__fbthrift_field_a); - } + ::std::string get_a() &&; /** Glean { "field": "a" } */ template @@ -2986,15 +2978,11 @@ class ComplexNestedWithDefault final { /** Glean { "field": "z" } */ [[deprecated("Use `FOO.z().value();` instead of `FOO.get_z();`")]] - const ::std::string& get_z() const& { - return __fbthrift_field_z; - } + const ::std::string& get_z() const&; /** Glean { "field": "z" } */ [[deprecated("Use `FOO.z().value();` instead of `FOO.get_z();`")]] - ::std::string get_z() && { - return static_cast<::std::string&&>(__fbthrift_field_z); - } + ::std::string get_z() &&; /** Glean { "field": "z" } */ template @@ -4204,15 +4192,11 @@ class MyStruct final { /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - const ::std::string& get_MyStringField() const& { - return __fbthrift_field_MyStringField; - } + const ::std::string& get_MyStringField() const&; /** Glean { "field": "MyStringField" } */ [[deprecated("Use `FOO.MyStringField().value();` instead of `FOO.get_MyStringField();`")]] - ::std::string get_MyStringField() && { - return static_cast<::std::string&&>(__fbthrift_field_MyStringField); - } + ::std::string get_MyStringField() &&; /** Glean { "field": "MyStringField" } */ template @@ -4619,15 +4603,11 @@ class AnnotatedTypes final { /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - const ::apache::thrift::fixtures::types::TBinary_8623& get_binary_field() const& { - return __fbthrift_field_binary_field; - } + const ::apache::thrift::fixtures::types::TBinary_8623& get_binary_field() const&; /** Glean { "field": "binary_field" } */ [[deprecated("Use `FOO.binary_field().value();` instead of `FOO.get_binary_field();`")]] - ::apache::thrift::fixtures::types::TBinary_8623 get_binary_field() && { - return static_cast<::apache::thrift::fixtures::types::TBinary_8623&&>(__fbthrift_field_binary_field); - } + ::apache::thrift::fixtures::types::TBinary_8623 get_binary_field() &&; /** Glean { "field": "binary_field" } */ template @@ -7507,15 +7487,11 @@ class AllocatorAware final { /** Glean { "field": "aa_string" } */ [[deprecated("Use `FOO.aa_string().value();` instead of `FOO.get_aa_string();`")]] - const ::apache::thrift::fixtures::types::string_5252& get_aa_string() const& { - return __fbthrift_field_aa_string; - } + const ::apache::thrift::fixtures::types::string_5252& get_aa_string() const&; /** Glean { "field": "aa_string" } */ [[deprecated("Use `FOO.aa_string().value();` instead of `FOO.get_aa_string();`")]] - ::apache::thrift::fixtures::types::string_5252 get_aa_string() && { - return static_cast<::apache::thrift::fixtures::types::string_5252&&>(__fbthrift_field_aa_string); - } + ::apache::thrift::fixtures::types::string_5252 get_aa_string() &&; /** Glean { "field": "aa_string" } */ template diff --git a/thrift/compiler/test/fixtures/visitation/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/visitation/out/cpp2/gen-cpp2/module_types.cpp index 72b9c162527..e50735534d1 100644 --- a/thrift/compiler/test/fixtures/visitation/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/visitation/out/cpp2/gen-cpp2/module_types.cpp @@ -631,6 +631,14 @@ ::std::int32_t& structA::set_a(::std::int32_t a_) { return __fbthrift_field_a; } +const ::std::string& structA::get_b() const& { + return __fbthrift_field_b; +} + +::std::string structA::get_b() && { + return static_cast<::std::string&&>(__fbthrift_field_b); +} + void swap([[maybe_unused]] structA& a, [[maybe_unused]] structA& b) { using ::std::swap; swap(a.__fbthrift_field_a, b.__fbthrift_field_a); @@ -1155,6 +1163,14 @@ ::std::int32_t& structC::set_a(::std::int32_t a_) { return __fbthrift_field_a; } +const ::std::string& structC::get_b() const& { + return __fbthrift_field_b; +} + +::std::string structC::get_b() && { + return static_cast<::std::string&&>(__fbthrift_field_b); +} + double structC::get_c() const { return __fbthrift_field_c; } @@ -1808,6 +1824,14 @@ ::std::int32_t& struct2::set_fieldA(::std::int32_t fieldA_) { return __fbthrift_field_fieldA; } +const ::std::string& struct2::get_fieldB() const& { + return __fbthrift_field_fieldB; +} + +::std::string struct2::get_fieldB() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldB); +} + ::test_cpp2::cpp_reflection::enum1 struct2::get_fieldC() const { return __fbthrift_field_fieldC; } @@ -2068,6 +2092,14 @@ ::std::int32_t& struct3::set_fieldA(::std::int32_t fieldA_) { return __fbthrift_field_fieldA; } +const ::std::string& struct3::get_fieldB() const& { + return __fbthrift_field_fieldB; +} + +::std::string struct3::get_fieldB() && { + return static_cast<::std::string&&>(__fbthrift_field_fieldB); +} + ::test_cpp2::cpp_reflection::enum1 struct3::get_fieldC() const { return __fbthrift_field_fieldC; } @@ -2698,6 +2730,14 @@ bool struct_binary::operator<([[maybe_unused]] const struct_binary& rhs) const { } +const ::std::string& struct_binary::get_bi() const& { + return __fbthrift_field_bi; +} + +::std::string struct_binary::get_bi() && { + return static_cast<::std::string&&>(__fbthrift_field_bi); +} + void swap([[maybe_unused]] struct_binary& a, [[maybe_unused]] struct_binary& b) { using ::std::swap; swap(a.__fbthrift_field_bi, b.__fbthrift_field_bi); @@ -3991,6 +4031,14 @@ ::test_cpp2::cpp_reflection::HasAResult& struct_with_indirections::set_result(:: return __fbthrift_field_result; } +const ::test_cpp2::cpp_reflection::HasAPhrase& struct_with_indirections::get_phrase() const& { + return __fbthrift_field_phrase; +} + +::test_cpp2::cpp_reflection::HasAPhrase struct_with_indirections::get_phrase() && { + return static_cast<::test_cpp2::cpp_reflection::HasAPhrase&&>(__fbthrift_field_phrase); +} + void swap([[maybe_unused]] struct_with_indirections& a, [[maybe_unused]] struct_with_indirections& b) { using ::std::swap; swap(a.__fbthrift_field_real, b.__fbthrift_field_real); diff --git a/thrift/compiler/test/fixtures/visitation/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/visitation/out/cpp2/gen-cpp2/module_types.h index 025936938ed..2ba06668870 100644 --- a/thrift/compiler/test/fixtures/visitation/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/visitation/out/cpp2/gen-cpp2/module_types.h @@ -2558,15 +2558,11 @@ class structA final { /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - const ::std::string& get_b() const& { - return __fbthrift_field_b; - } + const ::std::string& get_b() const&; /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - ::std::string get_b() && { - return static_cast<::std::string&&>(__fbthrift_field_b); - } + ::std::string get_b() &&; /** Glean { "field": "b" } */ template @@ -4984,15 +4980,11 @@ class structC final { /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - const ::std::string& get_b() const& { - return __fbthrift_field_b; - } + const ::std::string& get_b() const&; /** Glean { "field": "b" } */ [[deprecated("Use `FOO.b().value();` instead of `FOO.get_b();`")]] - ::std::string get_b() && { - return static_cast<::std::string&&>(__fbthrift_field_b); - } + ::std::string get_b() &&; /** Glean { "field": "b" } */ template @@ -6386,15 +6378,11 @@ class struct2 final { /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - const ::std::string& get_fieldB() const& { - return __fbthrift_field_fieldB; - } + const ::std::string& get_fieldB() const&; /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - ::std::string get_fieldB() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldB); - } + ::std::string get_fieldB() &&; /** Glean { "field": "fieldB" } */ template @@ -7517,15 +7505,11 @@ class struct3 final { /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - const ::std::string& get_fieldB() const& { - return __fbthrift_field_fieldB; - } + const ::std::string& get_fieldB() const&; /** Glean { "field": "fieldB" } */ [[deprecated("Use `FOO.fieldB().value();` instead of `FOO.get_fieldB();`")]] - ::std::string get_fieldB() && { - return static_cast<::std::string&&>(__fbthrift_field_fieldB); - } + ::std::string get_fieldB() &&; /** Glean { "field": "fieldB" } */ template @@ -8704,15 +8688,11 @@ class struct_binary final { /** Glean { "field": "bi" } */ [[deprecated("Use `FOO.bi().value();` instead of `FOO.get_bi();`")]] - const ::std::string& get_bi() const& { - return __fbthrift_field_bi; - } + const ::std::string& get_bi() const&; /** Glean { "field": "bi" } */ [[deprecated("Use `FOO.bi().value();` instead of `FOO.get_bi();`")]] - ::std::string get_bi() && { - return static_cast<::std::string&&>(__fbthrift_field_bi); - } + ::std::string get_bi() &&; /** Glean { "field": "bi" } */ template @@ -13699,15 +13679,11 @@ class struct_with_indirections final { /** Glean { "field": "phrase" } */ [[deprecated("Use `FOO.phrase().value();` instead of `FOO.get_phrase();`")]] - const ::test_cpp2::cpp_reflection::HasAPhrase& get_phrase() const& { - return __fbthrift_field_phrase; - } + const ::test_cpp2::cpp_reflection::HasAPhrase& get_phrase() const&; /** Glean { "field": "phrase" } */ [[deprecated("Use `FOO.phrase().value();` instead of `FOO.get_phrase();`")]] - ::test_cpp2::cpp_reflection::HasAPhrase get_phrase() && { - return static_cast<::test_cpp2::cpp_reflection::HasAPhrase&&>(__fbthrift_field_phrase); - } + ::test_cpp2::cpp_reflection::HasAPhrase get_phrase() &&; /** Glean { "field": "phrase" } */ template