From f4b25ab837358b0ab9b66149a5f5ebe7b39c6d53 Mon Sep 17 00:00:00 2001 From: Cheng-Yu Chung Date: Fri, 21 Oct 2022 20:23:54 -0400 Subject: [PATCH] Remove `include/grpcpp/impl/codegen/stub_options.h` (#31287) --- include/grpcpp/generic/generic_stub.h | 2 +- include/grpcpp/impl/codegen/stub_options.h | 23 +++------------------- include/grpcpp/support/stub_options.h | 20 ++++++++++++++++++- src/compiler/cpp_generator.cc | 2 +- test/cpp/codegen/compiler_test_golden | 2 +- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/include/grpcpp/generic/generic_stub.h b/include/grpcpp/generic/generic_stub.h index 6ae6c991517..0cdd6a5c85d 100644 --- a/include/grpcpp/generic/generic_stub.h +++ b/include/grpcpp/generic/generic_stub.h @@ -22,13 +22,13 @@ #include #include -#include #include #include #include #include #include #include +#include namespace grpc { diff --git a/include/grpcpp/impl/codegen/stub_options.h b/include/grpcpp/impl/codegen/stub_options.h index efa1e38ee02..ca83c5cc571 100644 --- a/include/grpcpp/impl/codegen/stub_options.h +++ b/include/grpcpp/impl/codegen/stub_options.h @@ -19,26 +19,9 @@ #ifndef GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H #define GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H -// IWYU pragma: private, include +// IWYU pragma: private -namespace grpc { - -/// Useful interface for generated stubs -class StubOptions { - public: - StubOptions() = default; - explicit StubOptions(const char* suffix_for_stats) - : suffix_for_stats_(suffix_for_stats) {} - - void set_suffix_for_stats(const char* suffix_for_stats) { - suffix_for_stats_ = suffix_for_stats; - } - const char* suffix_for_stats() const { return suffix_for_stats_; } - - private: - const char* suffix_for_stats_ = nullptr; -}; - -} // namespace grpc +/// TODO(chengyuc): Remove this file after solving compatibility. +#include #endif // GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H diff --git a/include/grpcpp/support/stub_options.h b/include/grpcpp/support/stub_options.h index ffe1ad77ea1..114681a82e3 100644 --- a/include/grpcpp/support/stub_options.h +++ b/include/grpcpp/support/stub_options.h @@ -19,6 +19,24 @@ #ifndef GRPCPP_SUPPORT_STUB_OPTIONS_H #define GRPCPP_SUPPORT_STUB_OPTIONS_H -#include // IWYU pragma: export +namespace grpc { + +/// Useful interface for generated stubs +class StubOptions { + public: + StubOptions() = default; + explicit StubOptions(const char* suffix_for_stats) + : suffix_for_stats_(suffix_for_stats) {} + + void set_suffix_for_stats(const char* suffix_for_stats) { + suffix_for_stats_ = suffix_for_stats; + } + const char* suffix_for_stats() const { return suffix_for_stats_; } + + private: + const char* suffix_for_stats_ = nullptr; +}; + +} // namespace grpc #endif // GRPCPP_SUPPORT_STUB_OPTIONS_H diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 104a628048e..95741421499 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -152,7 +152,7 @@ std::string GetHeaderIncludes(grpc_generator::File* file, "grpcpp/server_context.h", "grpcpp/impl/service_type.h", "grpcpp/impl/codegen/status.h", - "grpcpp/impl/codegen/stub_options.h", + "grpcpp/support/stub_options.h", "grpcpp/impl/codegen/sync_stream.h", }; std::vector headers(headers_strs, array_end(headers_strs)); diff --git a/test/cpp/codegen/compiler_test_golden b/test/cpp/codegen/compiler_test_golden index ea0ea26aa3a..eef752f12b4 100644 --- a/test/cpp/codegen/compiler_test_golden +++ b/test/cpp/codegen/compiler_test_golden @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include namespace grpc {