From adbfa28f63f8c7b4902f9c9e9e278241112add3b Mon Sep 17 00:00:00 2001 From: Pranjal Raihan Date: Fri, 27 Dec 2024 11:28:04 -0800 Subject: [PATCH] Remove common/namespace_cpp2 Summary: This diff removes the reliance on the undefined variables, `program:namespaces` and `service:namespaces` in templates. This lets us delete `common/namespace_cpp2.mustache`. Reviewed By: ahilger, iahs Differential Revision: D67637425 fbshipit-source-id: 937557738f0815f0a556baf7c6d4936e350a5c65 --- thrift/compiler/generate/t_mstch_cpp2_generator.cc | 2 -- .../generate/templates/cpp2/module_data.h.mustache | 4 ++-- .../templates/cpp2/module_fatal.h.mustache | 6 +++--- .../templates/cpp2/module_metadata.cpp.mustache | 4 ++-- .../templates/cpp2/module_metadata.h.mustache | 4 ++-- .../templates/cpp2/module_types.cpp.mustache | 8 ++++---- .../templates/cpp2/module_types.h.mustache | 2 +- .../cpp2/module_types_cpp/declare_enums.mustache | 14 +++++++------- .../cpp2/module_types_h/declare_enums.mustache | 10 +++++----- .../module_types_tcc/deserialize_struct.mustache | 2 +- .../module_types_tcc/deserialize_union.mustache | 2 +- .../module_types_tcc/serialize_struct.mustache | 2 +- .../cpp2/module_types_tcc/serialize_union.mustache | 2 +- .../function_implementation.mustache | 2 +- .../received_wrapped.mustache | 2 +- .../templates/cpp2/service_cpp/processmap.mustache | 2 +- .../templates/cpp2/service_h/async_client.mustache | 4 ++-- .../cpp2/service_h/async_processor.mustache | 6 +++--- .../cpp2/service_h/service_interface.mustache | 2 +- .../templates/cpp2/service_h/service_null.mustache | 2 +- .../cpp2/service_tcc/process_and_return.mustache | 4 ++-- 21 files changed, 42 insertions(+), 44 deletions(-) diff --git a/thrift/compiler/generate/t_mstch_cpp2_generator.cc b/thrift/compiler/generate/t_mstch_cpp2_generator.cc index ae70bb2d86c..f65cbaae59e 100644 --- a/thrift/compiler/generate/t_mstch_cpp2_generator.cc +++ b/thrift/compiler/generate/t_mstch_cpp2_generator.cc @@ -274,8 +274,6 @@ class t_mstch_cpp2_generator : public t_mstch_generator { opts.allowed_undefined_variables = { "program:autogen_path", "service:autogen_path", - "program:qualified_namespace", - "service:qualified_namespace", "field:fatal_annotations?", "value:enable_referencing?", }; diff --git a/thrift/compiler/generate/templates/cpp2/module_data.h.mustache b/thrift/compiler/generate/templates/cpp2/module_data.h.mustache index 754f8e8c650..8d3694b7a66 100644 --- a/thrift/compiler/generate/templates/cpp2/module_data.h.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_data.h.mustache @@ -25,8 +25,8 @@ namespace apache { namespace thrift { {{#program:enums}} -template <> struct TEnumDataStorage<{{> common/namespace_cpp2}}{{enum:cpp_name}}> { - using type = {{> common/namespace_cpp2}}{{enum:cpp_name}}; +template <> struct TEnumDataStorage<::{{program:qualified_namespace}}::{{enum:cpp_name}}> { + using type = ::{{program:qualified_namespace}}::{{enum:cpp_name}}; static constexpr const std::size_t size = {{enum:size}}; static constexpr std::array values = { { {{#enum:values}}{{! diff --git a/thrift/compiler/generate/templates/cpp2/module_fatal.h.mustache b/thrift/compiler/generate/templates/cpp2/module_fatal.h.mustache index 5bbda3e42b9..f3b74ab5f5c 100644 --- a/thrift/compiler/generate/templates/cpp2/module_fatal.h.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_fatal.h.mustache @@ -45,17 +45,17 @@ struct {{program:name}}_module_traits { >; using enums = ::fatal::list< {{#program:fatal_enums}}{{#fatal_strings:items}} - ::fatal::pair<{{> common/namespace_cpp2}}{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}} + ::fatal::pair<::{{program:qualified_namespace}}::{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}} {{/fatal_strings:items}}{{/program:fatal_enums}} >; using unions = ::fatal::list< {{#program:fatal_unions}}{{#fatal_strings:items}} - ::fatal::pair<{{> common/namespace_cpp2}}{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}} + ::fatal::pair<::{{program:qualified_namespace}}::{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}} {{/fatal_strings:items}}{{/program:fatal_unions}} >; using structs = ::fatal::list< {{#program:fatal_structs}}{{#fatal_strings:items}} - ::fatal::pair<{{> common/namespace_cpp2}}{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}} + ::fatal::pair<::{{program:qualified_namespace}}::{{fatal_string:name}}, strings::{{fatal_string:name}}>{{^last?}},{{/last?}} {{/fatal_strings:items}}{{/program:fatal_structs}} >; using constants = ::fatal::list< diff --git a/thrift/compiler/generate/templates/cpp2/module_metadata.cpp.mustache b/thrift/compiler/generate/templates/cpp2/module_metadata.cpp.mustache index b29b076449d..5a82c281377 100644 --- a/thrift/compiler/generate/templates/cpp2/module_metadata.cpp.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_metadata.cpp.mustache @@ -38,14 +38,14 @@ using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext; using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&); {{#program:enums}} -void EnumMetadata<{{> common/namespace_cpp2}}{{enum:cpp_name}}>::gen(ThriftMetadata& metadata) { +void EnumMetadata<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::gen(ThriftMetadata& metadata) { auto res = metadata.enums()->emplace("{{program:name}}.{{enum:name}}", ::apache::thrift::metadata::ThriftEnum{}); if (!res.second) { return; } ::apache::thrift::metadata::ThriftEnum& enum_metadata = res.first->second; enum_metadata.name() = "{{program:name}}.{{enum:name}}"; - using EnumTraits = TEnumTraits<{{> common/namespace_cpp2}}{{enum:cpp_name}}>; + using EnumTraits = TEnumTraits<::{{program:qualified_namespace}}::{{enum:cpp_name}}>; for (std::size_t i = 0; i != EnumTraits::size; ++i) { enum_metadata.elements()->emplace(static_cast(EnumTraits::values[i]), EnumTraits::names[i]); } diff --git a/thrift/compiler/generate/templates/cpp2/module_metadata.h.mustache b/thrift/compiler/generate/templates/cpp2/module_metadata.h.mustache index dc4bb7b36a0..69730f1bdf7 100644 --- a/thrift/compiler/generate/templates/cpp2/module_metadata.h.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_metadata.h.mustache @@ -40,14 +40,14 @@ namespace md { {{#program:enums}} {{^program:no_metadata?}} template <> -class EnumMetadata<{{> common/namespace_cpp2}}{{enum:cpp_name}}> { +class EnumMetadata<::{{program:qualified_namespace}}::{{enum:cpp_name}}> { public: static void gen(ThriftMetadata& metadata); }; {{/program:no_metadata?}} {{#program:no_metadata?}} template <> -class EnumMetadata<{{> common/namespace_cpp2}}{{enum:cpp_name}}> +class EnumMetadata<::{{program:qualified_namespace}}::{{enum:cpp_name}}> : private EmptyMetadata { public: using EmptyMetadata::gen; diff --git a/thrift/compiler/generate/templates/cpp2/module_types.cpp.mustache b/thrift/compiler/generate/templates/cpp2/module_types.cpp.mustache index ac4b72a88b5..7fd6933c03d 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types.cpp.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types.cpp.mustache @@ -280,10 +280,10 @@ namespace detail { {{#program:split_enums}} const ::apache::thrift::detail::TypeInfo TypeToInfo< apache::thrift::type_class::enumeration, - {{> common/namespace_cpp2}}{{enum:cpp_name}}>::typeInfo = { + ::{{program:qualified_namespace}}::{{enum:cpp_name}}>::typeInfo = { /* .type */ apache::thrift::protocol::TType::T_I32, - /* .get */ get common/namespace_cpp2}}{{enum:cpp_name}}>, - /* .set */ reinterpret_cast(set<{{> common/namespace_cpp2}}{{enum:cpp_name}}, std::int32_t>), + /* .get */ get, + /* .set */ reinterpret_cast(set<::{{program:qualified_namespace}}::{{enum:cpp_name}}, std::int32_t>), /* .typeExt */ nullptr, }; {{/program:split_enums}} @@ -294,7 +294,7 @@ const ::apache::thrift::detail::TypeInfo TypeToInfo< /* .type */ ::apache::thrift::protocol::TType::T_STRUCT, /* .get */ nullptr, /* .set */ nullptr, - /* .typeExt */ &{{> common/namespace_cpp2 }}__fbthrift_struct_info_{{struct:cpp_underlying_name}}, + /* .typeExt */ &::{{program:qualified_namespace}}::__fbthrift_struct_info_{{struct:cpp_underlying_name}}, }; {{/program:split_structs}} }}} // namespace apache::thrift::detail diff --git a/thrift/compiler/generate/templates/cpp2/module_types.h.mustache b/thrift/compiler/generate/templates/cpp2/module_types.h.mustache index ba0d252f551..9de9654739e 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types.h.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types.h.mustache @@ -397,7 +397,7 @@ struct TypeToInfo< template <> struct TypeToInfo< ::apache::thrift::type_class::enumeration, - {{> common/namespace_cpp2}}{{enum:cpp_name}}> { + ::{{program:qualified_namespace}}::{{enum:cpp_name}}> { static const ::apache::thrift::detail::TypeInfo typeInfo; }; {{/program:enums}} diff --git a/thrift/compiler/generate/templates/cpp2/module_types_cpp/declare_enums.mustache b/thrift/compiler/generate/templates/cpp2/module_types_cpp/declare_enums.mustache index fa6b328ce23..dc657216789 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types_cpp/declare_enums.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types_cpp/declare_enums.mustache @@ -18,27 +18,27 @@ namespace apache { namespace thrift { -const std::string_view TEnumTraits<{{> common/namespace_cpp2}}{{enum:cpp_name}}>::__fbthrift_module_name_internal_do_not_use = kModuleName; -folly::Range<{{> common/namespace_cpp2}}{{enum:cpp_name}} const*> const TEnumTraits<{{> common/namespace_cpp2}}{{enum:cpp_name}}>::values = {{! +const std::string_view TEnumTraits<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::__fbthrift_module_name_internal_do_not_use = kModuleName; +folly::Range<::{{program:qualified_namespace}}::{{enum:cpp_name}} const*> const TEnumTraits<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::values = {{! }}{{#enum:empty?}}{{! }}{};{{! }}{{/enum:empty?}}{{! }}{{^enum:empty?}}{{! - }}folly::range(TEnumDataStorage<{{> common/namespace_cpp2}}{{enum:cpp_name}}>::values);{{! + }}folly::range(TEnumDataStorage<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::values);{{! }}{{/enum:empty?}} -folly::Range const TEnumTraits<{{> common/namespace_cpp2}}{{enum:cpp_name}}>::names = {{! +folly::Range const TEnumTraits<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::names = {{! }}{{#enum:empty?}}{{! }}{};{{! }}{{/enum:empty?}}{{! }}{{^enum:empty?}}{{! - }}folly::range(TEnumDataStorage<{{> common/namespace_cpp2}}{{enum:cpp_name}}>::names);{{! + }}folly::range(TEnumDataStorage<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::names);{{! }}{{/enum:empty?}} -bool TEnumTraits<{{> common/namespace_cpp2}}{{enum:cpp_name}}>::findName(type value, std::string_view* out) noexcept { +bool TEnumTraits<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::findName(type value, std::string_view* out) noexcept { return ::apache::thrift::detail::st::enum_find_name(value, out); } -bool TEnumTraits<{{> common/namespace_cpp2}}{{enum:cpp_name}}>::findValue(std::string_view name, type* out) noexcept { +bool TEnumTraits<::{{program:qualified_namespace}}::{{enum:cpp_name}}>::findValue(std::string_view name, type* out) noexcept { return ::apache::thrift::detail::st::enum_find_value(name, out); } diff --git a/thrift/compiler/generate/templates/cpp2/module_types_h/declare_enums.mustache b/thrift/compiler/generate/templates/cpp2/module_types_h/declare_enums.mustache index 259a91e4804..dd5f30355f2 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types_h/declare_enums.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types_h/declare_enums.mustache @@ -36,8 +36,8 @@ enum {{^enum:cpp_is_unscoped}}class {{/enum:cpp_is_unscoped}}{{enum:cpp_name}}{{ namespace std { {{#program:enums}} -template<> struct hash<{{> common/namespace_cpp2}}{{enum:cpp_name}}> : - ::apache::thrift::detail::enum_hash<{{> common/namespace_cpp2}}{{enum:cpp_name}}> {}; +template<> struct hash<::{{program:qualified_namespace}}::{{enum:cpp_name}}> : + ::apache::thrift::detail::enum_hash<::{{program:qualified_namespace}}::{{enum:cpp_name}}> {}; {{/program:enums}} } // std @@ -45,10 +45,10 @@ namespace apache { namespace thrift { {{#program:enums}} -template <> struct TEnumDataStorage<{{> common/namespace_cpp2}}{{enum:cpp_name}}>; +template <> struct TEnumDataStorage<::{{program:qualified_namespace}}::{{enum:cpp_name}}>; -template <> struct TEnumTraits<{{> common/namespace_cpp2}}{{enum:cpp_name}}> { - using type = {{> common/namespace_cpp2}}{{enum:cpp_name}}; +template <> struct TEnumTraits<::{{program:qualified_namespace}}::{{enum:cpp_name}}> { + using type = ::{{program:qualified_namespace}}::{{enum:cpp_name}}; static constexpr std::size_t const size = {{enum:size}}; static folly::Range const values; diff --git a/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_struct.mustache b/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_struct.mustache index b2e501ded58..d14575111df 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_struct.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_struct.mustache @@ -180,7 +180,7 @@ void {{struct:cpp_underlying_name}}::readNoXfer(Protocol_* iprot) { ::apache::thrift::detail::read( iprot, ::apache::thrift::detail::toStructInfo( - {{> common/namespace_cpp2}}__fbthrift_struct_info_{{struct:cpp_underlying_name}} + ::{{program:qualified_namespace}}::__fbthrift_struct_info_{{struct:cpp_underlying_name}} ), this); } diff --git a/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_union.mustache b/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_union.mustache index 8f3b4ad00ef..1aab02b47e3 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_union.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types_tcc/deserialize_union.mustache @@ -64,7 +64,7 @@ void {{struct:cpp_underlying_name}}::readNoXfer(Protocol_* iprot) { ::apache::thrift::detail::read( iprot, ::apache::thrift::detail::toStructInfo( - {{> common/namespace_cpp2}}__fbthrift_struct_info_{{struct:cpp_underlying_name}} + ::{{program:qualified_namespace}}::__fbthrift_struct_info_{{struct:cpp_underlying_name}} ), this); }{{! diff --git a/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_struct.mustache b/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_struct.mustache index e5d978c62bf..192a8f45361 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_struct.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_struct.mustache @@ -64,7 +64,7 @@ uint32_t {{struct:cpp_underlying_name}}::write(Protocol_* iprot) const { return ::apache::thrift::detail::write( iprot, ::apache::thrift::detail::toStructInfo( - {{> common/namespace_cpp2}}__fbthrift_struct_info_{{struct:cpp_underlying_name}} + ::{{program:qualified_namespace}}::__fbthrift_struct_info_{{struct:cpp_underlying_name}} ), this); } diff --git a/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_union.mustache b/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_union.mustache index 993be247606..465748e7068 100644 --- a/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_union.mustache +++ b/thrift/compiler/generate/templates/cpp2/module_types_tcc/serialize_union.mustache @@ -64,7 +64,7 @@ uint32_t {{struct:cpp_underlying_name}}::write(Protocol_* iprot) const { return ::apache::thrift::detail::write( iprot, ::apache::thrift::detail::toStructInfo( - {{> common/namespace_cpp2}}__fbthrift_struct_info_{{struct:cpp_underlying_name}} + ::{{program:qualified_namespace}}::__fbthrift_struct_info_{{struct:cpp_underlying_name}} ), this); } diff --git a/thrift/compiler/generate/templates/cpp2/service_async_client_cpp/function_implementation.mustache b/thrift/compiler/generate/templates/cpp2/service_async_client_cpp/function_implementation.mustache index 6d1955038c6..0e4b7fddd13 100644 --- a/thrift/compiler/generate/templates/cpp2/service_async_client_cpp/function_implementation.mustache +++ b/thrift/compiler/generate/templates/cpp2/service_async_client_cpp/function_implementation.mustache @@ -35,7 +35,7 @@ void {{> service_common/client_class_name}}::{{function:cpp_name}}(apache::thrif apache::thrift::SerializedRequest {{> service_common/client_class_name}}::fbthrift_serialize_{{function:cpp_name}}(const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack{{function:comma}}{{> service_common/function_param_list_client}}) { return apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& prot) { using ProtocolWriter = std::decay_t; - {{> common/namespace_cpp2}}{{service:parent_service_cpp_name}}_{{function:prefixed_name}}_pargs args; + ::{{service:qualified_namespace}}::{{service:parent_service_cpp_name}}_{{function:prefixed_name}}_pargs args; {{#function:args}}{{#field:type}} {{^type:resolves_to_complex_return?}} args.get<{{field:index}}>().value = &p_{{field:cpp_name}}; diff --git a/thrift/compiler/generate/templates/cpp2/service_async_client_cpp/received_wrapped.mustache b/thrift/compiler/generate/templates/cpp2/service_async_client_cpp/received_wrapped.mustache index e1af24ed7fd..8199e120454 100644 --- a/thrift/compiler/generate/templates/cpp2/service_async_client_cpp/received_wrapped.mustache +++ b/thrift/compiler/generate/templates/cpp2/service_async_client_cpp/received_wrapped.mustache @@ -27,7 +27,7 @@ folly::exception_wrapper {{> service_common/client_class_name}}::recv_wrapped_{{ return folly::make_exception_wrapper("recv_ called without result"); } - using result = {{> common/namespace_cpp2}}{{service:parent_service_cpp_name}}_{{function:prefixed_name}}_presult; + using result = ::{{service:qualified_namespace}}::{{service:parent_service_cpp_name}}_{{function:prefixed_name}}_presult; {{#function:sink?}} {{^function:sink_exceptions?}} using ExMapType = apache::thrift::detail::ap::EmptyExMapType; diff --git a/thrift/compiler/generate/templates/cpp2/service_cpp/processmap.mustache b/thrift/compiler/generate/templates/cpp2/service_cpp/processmap.mustache index 5b150e70f7d..76f0963144b 100644 --- a/thrift/compiler/generate/templates/cpp2/service_cpp/processmap.mustache +++ b/thrift/compiler/generate/templates/cpp2/service_cpp/processmap.mustache @@ -67,7 +67,7 @@ apache::thrift::ServiceRequestInfoMap {{service:cpp_name}}ServiceInfoHolder::sta {{/function:return_type}}{{/service:functions}}{{/service:interactions}} }; {{#service:extends}} - apache::thrift::ServiceRequestInfoMap parentMap = {{> common/namespace_cpp2}}{{service:cpp_name}}ServiceInfoHolder::staticRequestInfoMap(); + apache::thrift::ServiceRequestInfoMap parentMap = ::{{service:qualified_namespace}}::{{service:cpp_name}}ServiceInfoHolder::staticRequestInfoMap(); requestInfoMap.insert(std::begin(parentMap), std::end(parentMap)); {{/service:extends}} diff --git a/thrift/compiler/generate/templates/cpp2/service_h/async_client.mustache b/thrift/compiler/generate/templates/cpp2/service_h/async_client.mustache index 383ede1ef66..4400787c44b 100644 --- a/thrift/compiler/generate/templates/cpp2/service_h/async_client.mustache +++ b/thrift/compiler/generate/templates/cpp2/service_h/async_client.mustache @@ -21,9 +21,9 @@ class {{service:cpp_name}}; namespace apache::thrift { template <> -class Client<{{service:qualified_name}}> : public {{#service:extends}}{{> common/namespace_cpp2}}{{service:cpp_name}}AsyncClient{{/service:extends}}{{^service:extends}}apache::thrift::GeneratedAsyncClient{{/service:extends}} { +class Client<{{service:qualified_name}}> : public {{#service:extends}}::{{service:qualified_namespace}}::{{service:cpp_name}}AsyncClient{{/service:extends}}{{^service:extends}}apache::thrift::GeneratedAsyncClient{{/service:extends}} { public: - using {{#service:extends}}{{> common/namespace_cpp2}}{{service:cpp_name}}AsyncClient::{{service:cpp_name}}AsyncClient{{/service:extends}}{{^service:extends}}apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient{{/service:extends}}; + using {{#service:extends}}::{{service:qualified_namespace}}::{{service:cpp_name}}AsyncClient::{{service:cpp_name}}AsyncClient{{/service:extends}}{{^service:extends}}apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient{{/service:extends}}; char const* getServiceName() const noexcept override { return "{{service:parent_service_name}}"; diff --git a/thrift/compiler/generate/templates/cpp2/service_h/async_processor.mustache b/thrift/compiler/generate/templates/cpp2/service_h/async_processor.mustache index fca2ac43518..4f4b9782e9c 100644 --- a/thrift/compiler/generate/templates/cpp2/service_h/async_processor.mustache +++ b/thrift/compiler/generate/templates/cpp2/service_h/async_processor.mustache @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. -}}class {{service:cpp_name}}AsyncProcessor : public {{#service:extends}}{{> common/namespace_cpp2}}{{service:cpp_name}}AsyncProcessor{{/service:extends}}{{^service:extends}}::apache::thrift::GeneratedAsyncProcessorBase{{/service:extends}} { +}}class {{service:cpp_name}}AsyncProcessor : public {{#service:extends}}::{{service:qualified_namespace}}::{{service:cpp_name}}AsyncProcessor{{/service:extends}}{{^service:extends}}::apache::thrift::GeneratedAsyncProcessorBase{{/service:extends}} { public: const char* getServiceName() override; void getServiceMetadata(apache::thrift::metadata::ThriftServiceMetadataResponse& response) override; {{#service:extends}} - using BaseAsyncProcessor = {{> common/namespace_cpp2}}{{service:cpp_name}}AsyncProcessor; + using BaseAsyncProcessor = ::{{service:qualified_namespace}}::{{service:cpp_name}}AsyncProcessor; {{/service:extends}} {{^service:extends}} using BaseAsyncProcessor = void; @@ -56,7 +56,7 @@ public: {{service:cpp_name}}AsyncProcessor(::apache::thrift::ServiceHandler<{{service:qualified_name}}>* iface) : {{#service:extends}} - {{> common/namespace_cpp2}}{{service:cpp_name}}AsyncProcessor(iface), + ::{{service:qualified_namespace}}::{{service:cpp_name}}AsyncProcessor(iface), {{/service:extends}} iface_(iface) {} ~{{service:cpp_name}}AsyncProcessor() override {} diff --git a/thrift/compiler/generate/templates/cpp2/service_h/service_interface.mustache b/thrift/compiler/generate/templates/cpp2/service_h/service_interface.mustache index 2ebd4a5dc36..e3b15fd178d 100644 --- a/thrift/compiler/generate/templates/cpp2/service_h/service_interface.mustache +++ b/thrift/compiler/generate/templates/cpp2/service_h/service_interface.mustache @@ -25,7 +25,7 @@ class {{service:cpp_name}}AsyncProcessor; namespace apache::thrift { template <> -class ServiceHandler<{{service:qualified_name}}> : {{#service:extends}}virtual public {{> common/namespace_cpp2}}{{service:cpp_name}}SvIf{{/service:extends}}{{^service:extends}}public apache::thrift::ServerInterface{{/service:extends}} { +class ServiceHandler<{{service:qualified_name}}> : {{#service:extends}}virtual public ::{{service:qualified_namespace}}::{{service:cpp_name}}SvIf{{/service:extends}}{{^service:extends}}public apache::thrift::ServerInterface{{/service:extends}} { public: std::string_view getGeneratedName() const override { return "{{service:name}}"; } {{#service:thrift_uri}} diff --git a/thrift/compiler/generate/templates/cpp2/service_h/service_null.mustache b/thrift/compiler/generate/templates/cpp2/service_h/service_null.mustache index 39698a9c507..4aabc281bb9 100644 --- a/thrift/compiler/generate/templates/cpp2/service_h/service_null.mustache +++ b/thrift/compiler/generate/templates/cpp2/service_h/service_null.mustache @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. -}}class {{service:cpp_name}}SvNull : public ::apache::thrift::ServiceHandler<{{service:cpp_name}}>{{#service:extends}}, virtual public ::apache::thrift::ServiceHandler<{{> common/namespace_cpp2}}{{service:cpp_name}}>{{/service:extends}} { +}}class {{service:cpp_name}}SvNull : public ::apache::thrift::ServiceHandler<{{service:cpp_name}}>{{#service:extends}}, virtual public ::apache::thrift::ServiceHandler<::{{service:qualified_namespace}}::{{service:cpp_name}}>{{/service:extends}} { public: {{#service:functions}}{{#function:return_type}}{{^function:starts_interaction?}}{{^function:creates_interaction?}}{{^function:eb}}{{^function:stream?}} {{> service_common/sync_function_return_type_server}} {{function:cpp_name}}({{> service_common/sync_function_return_param_server}}{{> service_common/function_param_list_server_commented_out}}) override; diff --git a/thrift/compiler/generate/templates/cpp2/service_tcc/process_and_return.mustache b/thrift/compiler/generate/templates/cpp2/service_tcc/process_and_return.mustache index daa8d7c50cb..13f66301aad 100644 --- a/thrift/compiler/generate/templates/cpp2/service_tcc/process_and_return.mustache +++ b/thrift/compiler/generate/templates/cpp2/service_tcc/process_and_return.mustache @@ -290,7 +290,7 @@ std::pair common/function_name}}", &prot, ctx, result), std::move(sinkConsumerImpl)}; {{/function:sink?}} {{^function:stream?}}{{^function:sink?}} - {{> common/namespace_cpp2}}{{service:parent_service_cpp_name}}_{{function:prefixed_name}}_presult result; + ::{{service:qualified_namespace}}::{{service:parent_service_cpp_name}}_{{function:prefixed_name}}_presult result; {{^type:void?}} result.get<0>().value = const_cast<{{function:cpp_return_type}}*>(&_return); result.setIsSet(0, true); @@ -305,7 +305,7 @@ void {{service:parent_service_cpp_name}}AsyncProcessor::throw_wrapped_{{function return; } {{#function:exceptions?}} - {{> common/namespace_cpp2}}{{service:parent_service_cpp_name}}_{{function:prefixed_name}}_presult result; + ::{{service:qualified_namespace}}::{{service:parent_service_cpp_name}}_{{function:prefixed_name}}_presult result; {{/function:exceptions?}} {{#function:exceptions}} if (ew.with_exception([&]({{#field:type}} ::{{type:qualified_namespace}}::{{type:name}}{{/field:type}}& e) {