From 28316341bff708bd0c09285ca34783f5676d0da0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 8 Sep 2021 09:13:03 -0700 Subject: [PATCH] Annotate impl/codegen with IWYU pragmas (#27252) * Add a tool to annotate impl/codegen with IWYU pragmas * xx * oops * fmt * x * fix wrong direction bug * use defaultdict * better annotations * better annotations * Automated change: Fix sanity tests Co-authored-by: ctiller --- include/grpc/byte_buffer.h | 2 +- include/grpc/byte_buffer_reader.h | 2 +- include/grpc/fork.h | 2 +- include/grpc/impl/codegen/atm.h | 8 +- include/grpc/impl/codegen/atm_gcc_atomic.h | 2 + include/grpc/impl/codegen/atm_gcc_sync.h | 2 + include/grpc/impl/codegen/atm_windows.h | 2 + include/grpc/impl/codegen/byte_buffer.h | 2 + .../grpc/impl/codegen/byte_buffer_reader.h | 2 + include/grpc/impl/codegen/compression_types.h | 2 + .../grpc/impl/codegen/connectivity_state.h | 2 + include/grpc/impl/codegen/fork.h | 2 + include/grpc/impl/codegen/gpr_slice.h | 2 + include/grpc/impl/codegen/gpr_types.h | 2 + include/grpc/impl/codegen/grpc_types.h | 2 + include/grpc/impl/codegen/log.h | 2 + include/grpc/impl/codegen/port_platform.h | 2 + include/grpc/impl/codegen/propagation_bits.h | 2 + include/grpc/impl/codegen/slice.h | 2 + include/grpc/impl/codegen/status.h | 2 + include/grpc/impl/codegen/sync.h | 13 +- include/grpc/impl/codegen/sync_abseil.h | 2 + include/grpc/impl/codegen/sync_custom.h | 2 + include/grpc/impl/codegen/sync_generic.h | 3 + include/grpc/impl/codegen/sync_posix.h | 2 + include/grpc/impl/codegen/sync_windows.h | 2 + include/grpc/slice.h | 2 +- include/grpc/status.h | 2 +- include/grpc/support/atm.h | 2 +- include/grpc/support/atm_gcc_atomic.h | 2 +- include/grpc/support/atm_gcc_sync.h | 2 +- include/grpc/support/atm_windows.h | 2 +- include/grpc/support/log.h | 2 +- include/grpc/support/port_platform.h | 2 +- include/grpc/support/sync.h | 2 +- include/grpc/support/sync_abseil.h | 2 +- include/grpc/support/sync_custom.h | 2 +- include/grpc/support/sync_generic.h | 2 +- include/grpc/support/sync_posix.h | 2 +- include/grpc/support/sync_windows.h | 2 +- include/grpcpp/client_context.h | 2 +- include/grpcpp/completion_queue.h | 2 +- .../grpcpp/generic/async_generic_service.h | 2 +- include/grpcpp/impl/call.h | 2 +- include/grpcpp/impl/client_unary_call.h | 2 +- .../impl/codegen/async_generic_service.h | 2 + include/grpcpp/impl/codegen/async_stream.h | 2 + .../grpcpp/impl/codegen/async_unary_call.h | 2 + include/grpcpp/impl/codegen/byte_buffer.h | 2 + include/grpcpp/impl/codegen/call.h | 2 + include/grpcpp/impl/codegen/call_hook.h | 2 + include/grpcpp/impl/codegen/call_op_set.h | 2 + .../impl/codegen/call_op_set_interface.h | 2 + include/grpcpp/impl/codegen/callback_common.h | 2 + .../grpcpp/impl/codegen/channel_interface.h | 2 + include/grpcpp/impl/codegen/client_callback.h | 3 + include/grpcpp/impl/codegen/client_context.h | 2 + .../grpcpp/impl/codegen/client_interceptor.h | 2 + .../grpcpp/impl/codegen/client_unary_call.h | 2 + .../grpcpp/impl/codegen/completion_queue.h | 2 + .../impl/codegen/completion_queue_tag.h | 2 + include/grpcpp/impl/codegen/config.h | 2 + include/grpcpp/impl/codegen/config_protobuf.h | 2 + include/grpcpp/impl/codegen/core_codegen.h | 2 + .../impl/codegen/core_codegen_interface.h | 2 + .../grpcpp/impl/codegen/create_auth_context.h | 2 + .../grpcpp/impl/codegen/delegating_channel.h | 2 + include/grpcpp/impl/codegen/grpc_library.h | 2 + .../grpcpp/impl/codegen/intercepted_channel.h | 2 + include/grpcpp/impl/codegen/interceptor.h | 2 + .../grpcpp/impl/codegen/interceptor_common.h | 2 + .../grpcpp/impl/codegen/message_allocator.h | 2 + include/grpcpp/impl/codegen/metadata_map.h | 2 + include/grpcpp/impl/codegen/method_handler.h | 2 + .../grpcpp/impl/codegen/method_handler_impl.h | 2 + .../grpcpp/impl/codegen/proto_buffer_reader.h | 2 + .../grpcpp/impl/codegen/proto_buffer_writer.h | 2 + include/grpcpp/impl/codegen/proto_utils.h | 2 + include/grpcpp/impl/codegen/rpc_method.h | 2 + .../grpcpp/impl/codegen/rpc_service_method.h | 2 + .../impl/codegen/security/auth_context.h | 2 + .../impl/codegen/serialization_traits.h | 2 + include/grpcpp/impl/codegen/server_callback.h | 2 + .../impl/codegen/server_callback_handlers.h | 2 + include/grpcpp/impl/codegen/server_context.h | 2 + .../grpcpp/impl/codegen/server_interceptor.h | 2 + .../grpcpp/impl/codegen/server_interface.h | 2 + include/grpcpp/impl/codegen/service_type.h | 2 + include/grpcpp/impl/codegen/slice.h | 2 + include/grpcpp/impl/codegen/status.h | 2 + .../grpcpp/impl/codegen/status_code_enum.h | 2 + include/grpcpp/impl/codegen/string_ref.h | 2 + include/grpcpp/impl/codegen/stub_options.h | 2 + include/grpcpp/impl/codegen/sync.h | 2 + include/grpcpp/impl/codegen/sync_stream.h | 2 + include/grpcpp/impl/codegen/time.h | 2 + include/grpcpp/impl/grpc_library.h | 2 +- include/grpcpp/impl/rpc_method.h | 2 +- include/grpcpp/impl/rpc_service_method.h | 2 +- include/grpcpp/impl/serialization_traits.h | 2 +- include/grpcpp/impl/service_type.h | 2 +- include/grpcpp/security/auth_context.h | 2 +- include/grpcpp/server_context.h | 2 +- include/grpcpp/support/async_stream.h | 2 +- include/grpcpp/support/async_unary_call.h | 2 +- include/grpcpp/support/byte_buffer.h | 2 +- include/grpcpp/support/client_callback.h | 2 +- include/grpcpp/support/client_interceptor.h | 2 +- include/grpcpp/support/config.h | 2 +- include/grpcpp/support/interceptor.h | 2 +- include/grpcpp/support/message_allocator.h | 2 +- include/grpcpp/support/method_handler.h | 2 +- include/grpcpp/support/proto_buffer_reader.h | 2 +- include/grpcpp/support/proto_buffer_writer.h | 2 +- include/grpcpp/support/server_callback.h | 2 +- include/grpcpp/support/server_interceptor.h | 2 +- include/grpcpp/support/slice.h | 2 +- include/grpcpp/support/status.h | 2 +- include/grpcpp/support/status_code_enum.h | 2 +- include/grpcpp/support/string_ref.h | 2 +- include/grpcpp/support/stub_options.h | 2 +- include/grpcpp/support/sync_stream.h | 2 +- include/grpcpp/support/time.h | 2 +- tools/distrib/add-iwyu.py | 118 ++++++++++++++++++ tools/distrib/sanitize.sh | 1 + 125 files changed, 327 insertions(+), 57 deletions(-) create mode 100755 tools/distrib/add-iwyu.py diff --git a/include/grpc/byte_buffer.h b/include/grpc/byte_buffer.h index ee740f47944..fff33cb8608 100644 --- a/include/grpc/byte_buffer.h +++ b/include/grpc/byte_buffer.h @@ -21,7 +21,7 @@ #include -#include +#include // IWYU pragma: export #include #endif /* GRPC_BYTE_BUFFER_H */ diff --git a/include/grpc/byte_buffer_reader.h b/include/grpc/byte_buffer_reader.h index 15e06cad7c1..763dd780d0d 100644 --- a/include/grpc/byte_buffer_reader.h +++ b/include/grpc/byte_buffer_reader.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_BYTE_BUFFER_READER_H */ diff --git a/include/grpc/fork.h b/include/grpc/fork.h index 26f9df9871b..f52cb50246a 100644 --- a/include/grpc/fork.h +++ b/include/grpc/fork.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_FORK_H */ diff --git a/include/grpc/impl/codegen/atm.h b/include/grpc/impl/codegen/atm.h index 00d83f0604f..606369a25fc 100644 --- a/include/grpc/impl/codegen/atm.h +++ b/include/grpc/impl/codegen/atm.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_ATM_H #define GRPC_IMPL_CODEGEN_ATM_H +// IWYU pragma: private, include + /** This interface provides atomic operations and barriers. It is internal to gpr support code and should not be used outside it. @@ -70,11 +72,11 @@ #include #if defined(GPR_GCC_ATOMIC) -#include +#include // IWYU pragma: export #elif defined(GPR_GCC_SYNC) -#include +#include // IWYU pragma: export #elif defined(GPR_WINDOWS_ATOMIC) -#include +#include // IWYU pragma: export #else #error could not determine platform for atm #endif diff --git a/include/grpc/impl/codegen/atm_gcc_atomic.h b/include/grpc/impl/codegen/atm_gcc_atomic.h index 58797085482..05d6e42cecd 100644 --- a/include/grpc/impl/codegen/atm_gcc_atomic.h +++ b/include/grpc/impl/codegen/atm_gcc_atomic.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H #define GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H +// IWYU pragma: private, include + /* atm_platform.h for gcc and gcc-like compilers with the __atomic_* interface. */ #include diff --git a/include/grpc/impl/codegen/atm_gcc_sync.h b/include/grpc/impl/codegen/atm_gcc_sync.h index 728c3d5412f..bdc7a172bc8 100644 --- a/include/grpc/impl/codegen/atm_gcc_sync.h +++ b/include/grpc/impl/codegen/atm_gcc_sync.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H #define GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H +// IWYU pragma: private, include + /* variant of atm_platform.h for gcc and gcc-like compiers with __sync_* interface */ #include diff --git a/include/grpc/impl/codegen/atm_windows.h b/include/grpc/impl/codegen/atm_windows.h index 36c76ab6721..816c9a9c643 100644 --- a/include/grpc/impl/codegen/atm_windows.h +++ b/include/grpc/impl/codegen/atm_windows.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_ATM_WINDOWS_H #define GRPC_IMPL_CODEGEN_ATM_WINDOWS_H +// IWYU pragma: private, include + /** Win32 variant of atm_platform.h */ #include diff --git a/include/grpc/impl/codegen/byte_buffer.h b/include/grpc/impl/codegen/byte_buffer.h index 04137292ff6..eeec56c1db0 100644 --- a/include/grpc/impl/codegen/byte_buffer.h +++ b/include/grpc/impl/codegen/byte_buffer.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_BYTE_BUFFER_H #define GRPC_IMPL_CODEGEN_BYTE_BUFFER_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpc/impl/codegen/byte_buffer_reader.h b/include/grpc/impl/codegen/byte_buffer_reader.h index e06e19558a1..35b8ee70c6a 100644 --- a/include/grpc/impl/codegen/byte_buffer_reader.h +++ b/include/grpc/impl/codegen/byte_buffer_reader.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H #define GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H +// IWYU pragma: private, include + #ifdef __cplusplus extern "C" { #endif diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h index f778b005b9b..129310eae8d 100644 --- a/include/grpc/impl/codegen/compression_types.h +++ b/include/grpc/impl/codegen/compression_types.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H #define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H +// IWYU pragma: private + #include #ifdef __cplusplus diff --git a/include/grpc/impl/codegen/connectivity_state.h b/include/grpc/impl/codegen/connectivity_state.h index b70dbef3564..52084da4cd8 100644 --- a/include/grpc/impl/codegen/connectivity_state.h +++ b/include/grpc/impl/codegen/connectivity_state.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H #define GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H +// IWYU pragma: private + #ifdef __cplusplus extern "C" { #endif diff --git a/include/grpc/impl/codegen/fork.h b/include/grpc/impl/codegen/fork.h index 555df3490f0..6818b530154 100644 --- a/include/grpc/impl/codegen/fork.h +++ b/include/grpc/impl/codegen/fork.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_FORK_H #define GRPC_IMPL_CODEGEN_FORK_H +// IWYU pragma: private, include + /** * gRPC applications should call this before calling fork(). There should be no * active gRPC function calls between calling grpc_prefork() and diff --git a/include/grpc/impl/codegen/gpr_slice.h b/include/grpc/impl/codegen/gpr_slice.h index 89fa72d5fc9..8782ba3f8da 100644 --- a/include/grpc/impl/codegen/gpr_slice.h +++ b/include/grpc/impl/codegen/gpr_slice.h @@ -18,6 +18,8 @@ #ifndef GRPC_IMPL_CODEGEN_GPR_SLICE_H #define GRPC_IMPL_CODEGEN_GPR_SLICE_H +// IWYU pragma: private + /** WARNING: Please do not use this header. This was added as a temporary * measure to not break some of the external projects that depend on * gpr_slice_* functions. We are actively working on moving all the diff --git a/include/grpc/impl/codegen/gpr_types.h b/include/grpc/impl/codegen/gpr_types.h index 6daf3398619..415bf7a9da1 100644 --- a/include/grpc/impl/codegen/gpr_types.h +++ b/include/grpc/impl/codegen/gpr_types.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_GPR_TYPES_H #define GRPC_IMPL_CODEGEN_GPR_TYPES_H +// IWYU pragma: private + #include #include diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 9b0ded299c0..cb3471cb445 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_GRPC_TYPES_H #define GRPC_IMPL_CODEGEN_GRPC_TYPES_H +// IWYU pragma: private + #include #include diff --git a/include/grpc/impl/codegen/log.h b/include/grpc/impl/codegen/log.h index 9dd3a518347..1d5d2da200d 100644 --- a/include/grpc/impl/codegen/log.h +++ b/include/grpc/impl/codegen/log.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_LOG_H #define GRPC_IMPL_CODEGEN_LOG_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index abf9aa68314..d01280fcdf8 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_PORT_PLATFORM_H #define GRPC_IMPL_CODEGEN_PORT_PLATFORM_H +// IWYU pragma: private, include + /* * Define GPR_BACKWARDS_COMPATIBILITY_MODE to try harder to be ABI * compatible with older platforms (currently only on Linux) diff --git a/include/grpc/impl/codegen/propagation_bits.h b/include/grpc/impl/codegen/propagation_bits.h index 824bdbd8c9b..d7020998d94 100644 --- a/include/grpc/impl/codegen/propagation_bits.h +++ b/include/grpc/impl/codegen/propagation_bits.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H #define GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H +// IWYU pragma: private + #include #ifdef __cplusplus diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h index 3567b1e88b3..4412058104e 100644 --- a/include/grpc/impl/codegen/slice.h +++ b/include/grpc/impl/codegen/slice.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_SLICE_H #define GRPC_IMPL_CODEGEN_SLICE_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpc/impl/codegen/status.h b/include/grpc/impl/codegen/status.h index dec3b8f340e..2b18f6d952c 100644 --- a/include/grpc/impl/codegen/status.h +++ b/include/grpc/impl/codegen/status.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_STATUS_H #define GRPC_IMPL_CODEGEN_STATUS_H +// IWYU pragma: private, include + #ifdef __cplusplus extern "C" { #endif diff --git a/include/grpc/impl/codegen/sync.h b/include/grpc/impl/codegen/sync.h index 49e3194748f..1b30ea7551d 100644 --- a/include/grpc/impl/codegen/sync.h +++ b/include/grpc/impl/codegen/sync.h @@ -18,6 +18,9 @@ #ifndef GRPC_IMPL_CODEGEN_SYNC_H #define GRPC_IMPL_CODEGEN_SYNC_H + +// IWYU pragma: private, include + /** Synchronization primitives for GPR. The type gpr_mu provides a non-reentrant mutex (lock). @@ -44,16 +47,16 @@ extern "C" { /* Platform-specific type declarations of gpr_mu and gpr_cv. */ #include -#include +#include // IWYU pragma: export #if defined(GPR_CUSTOM_SYNC) -#include +#include // IWYU pragma: export #elif defined(GPR_ABSEIL_SYNC) -#include +#include // IWYU pragma: export #elif defined(GPR_POSIX_SYNC) -#include +#include // IWYU pragma: export #elif defined(GPR_WINDOWS) -#include +#include // IWYU pragma: export #else #error Unable to determine platform for sync #endif diff --git a/include/grpc/impl/codegen/sync_abseil.h b/include/grpc/impl/codegen/sync_abseil.h index 38dfab32737..92b31697fd0 100644 --- a/include/grpc/impl/codegen/sync_abseil.h +++ b/include/grpc/impl/codegen/sync_abseil.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_SYNC_ABSEIL_H #define GRPC_IMPL_CODEGEN_SYNC_ABSEIL_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpc/impl/codegen/sync_custom.h b/include/grpc/impl/codegen/sync_custom.h index 69b1bf6cd19..ec0d6728e87 100644 --- a/include/grpc/impl/codegen/sync_custom.h +++ b/include/grpc/impl/codegen/sync_custom.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_SYNC_CUSTOM_H #define GRPC_IMPL_CODEGEN_SYNC_CUSTOM_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpc/impl/codegen/sync_generic.h b/include/grpc/impl/codegen/sync_generic.h index eabdc513f48..a79b9c648b2 100644 --- a/include/grpc/impl/codegen/sync_generic.h +++ b/include/grpc/impl/codegen/sync_generic.h @@ -18,6 +18,9 @@ #ifndef GRPC_IMPL_CODEGEN_SYNC_GENERIC_H #define GRPC_IMPL_CODEGEN_SYNC_GENERIC_H + +// IWYU pragma: private, include + /* Generic type definitions for gpr_sync. */ #include diff --git a/include/grpc/impl/codegen/sync_posix.h b/include/grpc/impl/codegen/sync_posix.h index 2aec3a3f8d6..a6ef4f75f3e 100644 --- a/include/grpc/impl/codegen/sync_posix.h +++ b/include/grpc/impl/codegen/sync_posix.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_SYNC_POSIX_H #define GRPC_IMPL_CODEGEN_SYNC_POSIX_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpc/impl/codegen/sync_windows.h b/include/grpc/impl/codegen/sync_windows.h index f2ff83b303d..2bee03b653f 100644 --- a/include/grpc/impl/codegen/sync_windows.h +++ b/include/grpc/impl/codegen/sync_windows.h @@ -19,6 +19,8 @@ #ifndef GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H #define GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H +// IWYU pragma: private, include + #include #ifdef GPR_WINDOWS diff --git a/include/grpc/slice.h b/include/grpc/slice.h index 51fc62b44df..65d20878831 100644 --- a/include/grpc/slice.h +++ b/include/grpc/slice.h @@ -21,7 +21,7 @@ #include -#include +#include // IWYU pragma: export #include #ifdef __cplusplus diff --git a/include/grpc/status.h b/include/grpc/status.h index ecb9668bbb8..6763264e6b1 100644 --- a/include/grpc/status.h +++ b/include/grpc/status.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_STATUS_H */ diff --git a/include/grpc/support/atm.h b/include/grpc/support/atm.h index 073b0a6fcf1..fbfcee3bb6f 100644 --- a/include/grpc/support/atm.h +++ b/include/grpc/support/atm.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_ATM_H */ diff --git a/include/grpc/support/atm_gcc_atomic.h b/include/grpc/support/atm_gcc_atomic.h index ae603db497a..8226349f254 100644 --- a/include/grpc/support/atm_gcc_atomic.h +++ b/include/grpc/support/atm_gcc_atomic.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */ diff --git a/include/grpc/support/atm_gcc_sync.h b/include/grpc/support/atm_gcc_sync.h index 6f51fdb1aa1..500a9f14d5e 100644 --- a/include/grpc/support/atm_gcc_sync.h +++ b/include/grpc/support/atm_gcc_sync.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */ diff --git a/include/grpc/support/atm_windows.h b/include/grpc/support/atm_windows.h index 36955e4dae0..b85d7f747db 100644 --- a/include/grpc/support/atm_windows.h +++ b/include/grpc/support/atm_windows.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_ATM_WINDOWS_H */ diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index 8d8742b95d6..7af557d0611 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_LOG_H */ diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 26025dcd9dd..fced02a9657 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -19,6 +19,6 @@ #ifndef GRPC_SUPPORT_PORT_PLATFORM_H #define GRPC_SUPPORT_PORT_PLATFORM_H -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_PORT_PLATFORM_H */ diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index f617322f00c..b1f5b786855 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -22,7 +22,7 @@ #include #include /* for gpr_timespec */ -#include +#include // IWYU pragma: export #ifdef __cplusplus extern "C" { diff --git a/include/grpc/support/sync_abseil.h b/include/grpc/support/sync_abseil.h index 3ee73489786..d6ad969273e 100644 --- a/include/grpc/support/sync_abseil.h +++ b/include/grpc/support/sync_abseil.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_SYNC_ABSEIL_H */ diff --git a/include/grpc/support/sync_custom.h b/include/grpc/support/sync_custom.h index 27cf0e0578d..de7e2200d60 100644 --- a/include/grpc/support/sync_custom.h +++ b/include/grpc/support/sync_custom.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_SYNC_CUSTOM_H */ diff --git a/include/grpc/support/sync_generic.h b/include/grpc/support/sync_generic.h index 93028c4af05..d1d9fd7e54f 100644 --- a/include/grpc/support/sync_generic.h +++ b/include/grpc/support/sync_generic.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_SYNC_GENERIC_H */ diff --git a/include/grpc/support/sync_posix.h b/include/grpc/support/sync_posix.h index 3dce7ee48cc..b971cd10f4c 100644 --- a/include/grpc/support/sync_posix.h +++ b/include/grpc/support/sync_posix.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_SYNC_POSIX_H */ diff --git a/include/grpc/support/sync_windows.h b/include/grpc/support/sync_windows.h index a493c864220..3ee4a6ffa1b 100644 --- a/include/grpc/support/sync_windows.h +++ b/include/grpc/support/sync_windows.h @@ -21,6 +21,6 @@ #include -#include +#include // IWYU pragma: export #endif /* GRPC_SUPPORT_SYNC_WINDOWS_H */ diff --git a/include/grpcpp/client_context.h b/include/grpcpp/client_context.h index 1994fcc6bc8..74a91e26421 100644 --- a/include/grpcpp/client_context.h +++ b/include/grpcpp/client_context.h @@ -34,6 +34,6 @@ #ifndef GRPCPP_CLIENT_CONTEXT_H #define GRPCPP_CLIENT_CONTEXT_H -#include +#include // IWYU pragma: export #endif // GRPCPP_CLIENT_CONTEXT_H diff --git a/include/grpcpp/completion_queue.h b/include/grpcpp/completion_queue.h index 123b277f5f0..42637b59272 100644 --- a/include/grpcpp/completion_queue.h +++ b/include/grpcpp/completion_queue.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_COMPLETION_QUEUE_H #define GRPCPP_COMPLETION_QUEUE_H -#include +#include // IWYU pragma: export #endif // GRPCPP_COMPLETION_QUEUE_H diff --git a/include/grpcpp/generic/async_generic_service.h b/include/grpcpp/generic/async_generic_service.h index 2c67edc5170..01c79428e26 100644 --- a/include/grpcpp/generic/async_generic_service.h +++ b/include/grpcpp/generic/async_generic_service.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H #define GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H -#include +#include // IWYU pragma: export #endif // GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H diff --git a/include/grpcpp/impl/call.h b/include/grpcpp/impl/call.h index a6b13126934..97d8fdfc7cf 100644 --- a/include/grpcpp/impl/call.h +++ b/include/grpcpp/impl/call.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_IMPL_CALL_H #define GRPCPP_IMPL_CALL_H -#include +#include // IWYU pragma: export #endif // GRPCPP_IMPL_CALL_H diff --git a/include/grpcpp/impl/client_unary_call.h b/include/grpcpp/impl/client_unary_call.h index 378482c5403..7ecf3548f20 100644 --- a/include/grpcpp/impl/client_unary_call.h +++ b/include/grpcpp/impl/client_unary_call.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_IMPL_CLIENT_UNARY_CALL_H #define GRPCPP_IMPL_CLIENT_UNARY_CALL_H -#include +#include // IWYU pragma: export #endif // GRPCPP_IMPL_CLIENT_UNARY_CALL_H diff --git a/include/grpcpp/impl/codegen/async_generic_service.h b/include/grpcpp/impl/codegen/async_generic_service.h index 6cdd514a349..5a0f246ff71 100644 --- a/include/grpcpp/impl/codegen/async_generic_service.h +++ b/include/grpcpp/impl/codegen/async_generic_service.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_ASYNC_GENERIC_SERVICE_H #define GRPCPP_IMPL_CODEGEN_ASYNC_GENERIC_SERVICE_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/async_stream.h b/include/grpcpp/impl/codegen/async_stream.h index aaee93df933..db5b3747a26 100644 --- a/include/grpcpp/impl/codegen/async_stream.h +++ b/include/grpcpp/impl/codegen/async_stream.h @@ -18,6 +18,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H #define GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/async_unary_call.h b/include/grpcpp/impl/codegen/async_unary_call.h index 7cb7cc6f16e..d7a3b57314a 100644 --- a/include/grpcpp/impl/codegen/async_unary_call.h +++ b/include/grpcpp/impl/codegen/async_unary_call.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H #define GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/byte_buffer.h b/include/grpcpp/impl/codegen/byte_buffer.h index 6959fa29baf..fb2b20f7f93 100644 --- a/include/grpcpp/impl/codegen/byte_buffer.h +++ b/include/grpcpp/impl/codegen/byte_buffer.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H #define GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/call.h b/include/grpcpp/impl/codegen/call.h index b2292862157..96d0de53e3b 100644 --- a/include/grpcpp/impl/codegen/call.h +++ b/include/grpcpp/impl/codegen/call.h @@ -18,6 +18,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CALL_H #define GRPCPP_IMPL_CODEGEN_CALL_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/call_hook.h b/include/grpcpp/impl/codegen/call_hook.h index 4f7d370c4f7..8c4278e7dc1 100644 --- a/include/grpcpp/impl/codegen/call_hook.h +++ b/include/grpcpp/impl/codegen/call_hook.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CALL_HOOK_H #define GRPCPP_IMPL_CODEGEN_CALL_HOOK_H +// IWYU pragma: private + namespace grpc { namespace internal { diff --git a/include/grpcpp/impl/codegen/call_op_set.h b/include/grpcpp/impl/codegen/call_op_set.h index 7fde1edbb92..30b36c25eb6 100644 --- a/include/grpcpp/impl/codegen/call_op_set.h +++ b/include/grpcpp/impl/codegen/call_op_set.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CALL_OP_SET_H #define GRPCPP_IMPL_CODEGEN_CALL_OP_SET_H +// IWYU pragma: private + #include #include #include diff --git a/include/grpcpp/impl/codegen/call_op_set_interface.h b/include/grpcpp/impl/codegen/call_op_set_interface.h index 3b74566a6d3..a8eed9f6193 100644 --- a/include/grpcpp/impl/codegen/call_op_set_interface.h +++ b/include/grpcpp/impl/codegen/call_op_set_interface.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CALL_OP_SET_INTERFACE_H #define GRPCPP_IMPL_CODEGEN_CALL_OP_SET_INTERFACE_H +// IWYU pragma: private + #include namespace grpc { diff --git a/include/grpcpp/impl/codegen/callback_common.h b/include/grpcpp/impl/codegen/callback_common.h index d6707860a28..7c67c928511 100644 --- a/include/grpcpp/impl/codegen/callback_common.h +++ b/include/grpcpp/impl/codegen/callback_common.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H #define GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H +// IWYU pragma: private + #include #include diff --git a/include/grpcpp/impl/codegen/channel_interface.h b/include/grpcpp/impl/codegen/channel_interface.h index ac82e2f650b..4a60cd90495 100644 --- a/include/grpcpp/impl/codegen/channel_interface.h +++ b/include/grpcpp/impl/codegen/channel_interface.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H #define GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H +// IWYU pragma: private + #include #include #include diff --git a/include/grpcpp/impl/codegen/client_callback.h b/include/grpcpp/impl/codegen/client_callback.h index dea0cae492a..f16cd9f10f6 100644 --- a/include/grpcpp/impl/codegen/client_callback.h +++ b/include/grpcpp/impl/codegen/client_callback.h @@ -17,6 +17,9 @@ #ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CALLBACK_H #define GRPCPP_IMPL_CODEGEN_CLIENT_CALLBACK_H + +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/client_context.h b/include/grpcpp/impl/codegen/client_context.h index 761259c9b27..5c5e06568ca 100644 --- a/include/grpcpp/impl/codegen/client_context.h +++ b/include/grpcpp/impl/codegen/client_context.h @@ -34,6 +34,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H #define GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/client_interceptor.h b/include/grpcpp/impl/codegen/client_interceptor.h index ec78074ab2a..f3560b5ad21 100644 --- a/include/grpcpp/impl/codegen/client_interceptor.h +++ b/include/grpcpp/impl/codegen/client_interceptor.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CLIENT_INTERCEPTOR_H #define GRPCPP_IMPL_CODEGEN_CLIENT_INTERCEPTOR_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/client_unary_call.h b/include/grpcpp/impl/codegen/client_unary_call.h index d41ea1ad2d4..bad60a23bc9 100644 --- a/include/grpcpp/impl/codegen/client_unary_call.h +++ b/include/grpcpp/impl/codegen/client_unary_call.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H #define GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/completion_queue.h b/include/grpcpp/impl/codegen/completion_queue.h index ba2c8d2be80..ef0c7f14985 100644 --- a/include/grpcpp/impl/codegen/completion_queue.h +++ b/include/grpcpp/impl/codegen/completion_queue.h @@ -32,6 +32,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H #define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/completion_queue_tag.h b/include/grpcpp/impl/codegen/completion_queue_tag.h index 304386a9ecc..9af470b7502 100644 --- a/include/grpcpp/impl/codegen/completion_queue_tag.h +++ b/include/grpcpp/impl/codegen/completion_queue_tag.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H #define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H +// IWYU pragma: private + namespace grpc { namespace internal { diff --git a/include/grpcpp/impl/codegen/config.h b/include/grpcpp/impl/codegen/config.h index 0a8a9c139ca..d810cfae5a9 100644 --- a/include/grpcpp/impl/codegen/config.h +++ b/include/grpcpp/impl/codegen/config.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CONFIG_H #define GRPCPP_IMPL_CODEGEN_CONFIG_H +// IWYU pragma: private, include + #include /// The following macros are deprecated and appear only for users diff --git a/include/grpcpp/impl/codegen/config_protobuf.h b/include/grpcpp/impl/codegen/config_protobuf.h index 49db4c5dc31..da874c58eb6 100644 --- a/include/grpcpp/impl/codegen/config_protobuf.h +++ b/include/grpcpp/impl/codegen/config_protobuf.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H #define GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H +// IWYU pragma: private + #define GRPC_OPEN_SOURCE_PROTO #ifndef GRPC_CUSTOM_MESSAGE diff --git a/include/grpcpp/impl/codegen/core_codegen.h b/include/grpcpp/impl/codegen/core_codegen.h index df2a03cd259..0cefdb56a78 100644 --- a/include/grpcpp/impl/codegen/core_codegen.h +++ b/include/grpcpp/impl/codegen/core_codegen.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_H #define GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_H +// IWYU pragma: private + // This file should be compiled as part of grpcpp. #include diff --git a/include/grpcpp/impl/codegen/core_codegen_interface.h b/include/grpcpp/impl/codegen/core_codegen_interface.h index c08cf6c683d..edbeee203d1 100644 --- a/include/grpcpp/impl/codegen/core_codegen_interface.h +++ b/include/grpcpp/impl/codegen/core_codegen_interface.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H #define GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H +// IWYU pragma: private + #include #include #include diff --git a/include/grpcpp/impl/codegen/create_auth_context.h b/include/grpcpp/impl/codegen/create_auth_context.h index cb6095c3a5a..817988f3aa2 100644 --- a/include/grpcpp/impl/codegen/create_auth_context.h +++ b/include/grpcpp/impl/codegen/create_auth_context.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H #define GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H +// IWYU pragma: private + #include #include diff --git a/include/grpcpp/impl/codegen/delegating_channel.h b/include/grpcpp/impl/codegen/delegating_channel.h index 0479567b864..f4f6794b420 100644 --- a/include/grpcpp/impl/codegen/delegating_channel.h +++ b/include/grpcpp/impl/codegen/delegating_channel.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H #define GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H +// IWYU pragma: private + #include #include diff --git a/include/grpcpp/impl/codegen/grpc_library.h b/include/grpcpp/impl/codegen/grpc_library.h index 660d6d0abdc..9f83a7f938c 100644 --- a/include/grpcpp/impl/codegen/grpc_library.h +++ b/include/grpcpp/impl/codegen/grpc_library.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_GRPC_LIBRARY_H #define GRPCPP_IMPL_CODEGEN_GRPC_LIBRARY_H +// IWYU pragma: private, include + #include namespace grpc { diff --git a/include/grpcpp/impl/codegen/intercepted_channel.h b/include/grpcpp/impl/codegen/intercepted_channel.h index e3a4c8e7680..d3df6caa045 100644 --- a/include/grpcpp/impl/codegen/intercepted_channel.h +++ b/include/grpcpp/impl/codegen/intercepted_channel.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_INTERCEPTED_CHANNEL_H #define GRPCPP_IMPL_CODEGEN_INTERCEPTED_CHANNEL_H +// IWYU pragma: private + #include namespace grpc { diff --git a/include/grpcpp/impl/codegen/interceptor.h b/include/grpcpp/impl/codegen/interceptor.h index 58fb36c81c5..8faea760a85 100644 --- a/include/grpcpp/impl/codegen/interceptor.h +++ b/include/grpcpp/impl/codegen/interceptor.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_INTERCEPTOR_H #define GRPCPP_IMPL_CODEGEN_INTERCEPTOR_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/interceptor_common.h b/include/grpcpp/impl/codegen/interceptor_common.h index b9a6eded093..ec52706126f 100644 --- a/include/grpcpp/impl/codegen/interceptor_common.h +++ b/include/grpcpp/impl/codegen/interceptor_common.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_INTERCEPTOR_COMMON_H #define GRPCPP_IMPL_CODEGEN_INTERCEPTOR_COMMON_H +// IWYU pragma: private + #include #include diff --git a/include/grpcpp/impl/codegen/message_allocator.h b/include/grpcpp/impl/codegen/message_allocator.h index 23b990e15b7..440c7f1d232 100644 --- a/include/grpcpp/impl/codegen/message_allocator.h +++ b/include/grpcpp/impl/codegen/message_allocator.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_MESSAGE_ALLOCATOR_H #define GRPCPP_IMPL_CODEGEN_MESSAGE_ALLOCATOR_H +// IWYU pragma: private, include + namespace grpc { // NOTE: This is an API for advanced users who need custom allocators. diff --git a/include/grpcpp/impl/codegen/metadata_map.h b/include/grpcpp/impl/codegen/metadata_map.h index 9b9957bb4c1..931d682d196 100644 --- a/include/grpcpp/impl/codegen/metadata_map.h +++ b/include/grpcpp/impl/codegen/metadata_map.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_METADATA_MAP_H #define GRPCPP_IMPL_CODEGEN_METADATA_MAP_H +// IWYU pragma: private + #include #include diff --git a/include/grpcpp/impl/codegen/method_handler.h b/include/grpcpp/impl/codegen/method_handler.h index fb093f54b82..b02a42792d7 100644 --- a/include/grpcpp/impl/codegen/method_handler.h +++ b/include/grpcpp/impl/codegen/method_handler.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_H #define GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/method_handler_impl.h b/include/grpcpp/impl/codegen/method_handler_impl.h index cc88a135ca2..3f1d573ba5f 100644 --- a/include/grpcpp/impl/codegen/method_handler_impl.h +++ b/include/grpcpp/impl/codegen/method_handler_impl.h @@ -19,4 +19,6 @@ #ifndef GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H #define GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H +// IWYU pragma: private + #endif // GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H diff --git a/include/grpcpp/impl/codegen/proto_buffer_reader.h b/include/grpcpp/impl/codegen/proto_buffer_reader.h index d25b79a4027..d3baa2cd29d 100644 --- a/include/grpcpp/impl/codegen/proto_buffer_reader.h +++ b/include/grpcpp/impl/codegen/proto_buffer_reader.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H #define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/proto_buffer_writer.h b/include/grpcpp/impl/codegen/proto_buffer_writer.h index cd9d70c5a56..a4752a4e9af 100644 --- a/include/grpcpp/impl/codegen/proto_buffer_writer.h +++ b/include/grpcpp/impl/codegen/proto_buffer_writer.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H #define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/proto_utils.h b/include/grpcpp/impl/codegen/proto_utils.h index 7f5c6e9a99d..4f6d87415a1 100644 --- a/include/grpcpp/impl/codegen/proto_utils.h +++ b/include/grpcpp/impl/codegen/proto_utils.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H #define GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H +// IWYU pragma: private + #include #include diff --git a/include/grpcpp/impl/codegen/rpc_method.h b/include/grpcpp/impl/codegen/rpc_method.h index 388784e6ff1..83dedda42cb 100644 --- a/include/grpcpp/impl/codegen/rpc_method.h +++ b/include/grpcpp/impl/codegen/rpc_method.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_RPC_METHOD_H #define GRPCPP_IMPL_CODEGEN_RPC_METHOD_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/rpc_service_method.h b/include/grpcpp/impl/codegen/rpc_service_method.h index 4fcc2112435..f34cc8b17c4 100644 --- a/include/grpcpp/impl/codegen/rpc_service_method.h +++ b/include/grpcpp/impl/codegen/rpc_service_method.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_RPC_SERVICE_METHOD_H #define GRPCPP_IMPL_CODEGEN_RPC_SERVICE_METHOD_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/security/auth_context.h b/include/grpcpp/impl/codegen/security/auth_context.h index cea6dbea36f..d834ec16a2e 100644 --- a/include/grpcpp/impl/codegen/security/auth_context.h +++ b/include/grpcpp/impl/codegen/security/auth_context.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H #define GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/serialization_traits.h b/include/grpcpp/impl/codegen/serialization_traits.h index 8f792232909..3148dffc806 100644 --- a/include/grpcpp/impl/codegen/serialization_traits.h +++ b/include/grpcpp/impl/codegen/serialization_traits.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H #define GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H +// IWYU pragma: private, include + namespace grpc { /// Defines how to serialize and deserialize some type. diff --git a/include/grpcpp/impl/codegen/server_callback.h b/include/grpcpp/impl/codegen/server_callback.h index 70b4a36a3df..04ed5f86fd2 100644 --- a/include/grpcpp/impl/codegen/server_callback.h +++ b/include/grpcpp/impl/codegen/server_callback.h @@ -18,6 +18,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_H #define GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/server_callback_handlers.h b/include/grpcpp/impl/codegen/server_callback_handlers.h index 11115dd6e9b..8713d3eb30a 100644 --- a/include/grpcpp/impl/codegen/server_callback_handlers.h +++ b/include/grpcpp/impl/codegen/server_callback_handlers.h @@ -18,6 +18,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H #define GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H +// IWYU pragma: private + #include #include #include diff --git a/include/grpcpp/impl/codegen/server_context.h b/include/grpcpp/impl/codegen/server_context.h index 9cb645538aa..a1acb6adf5c 100644 --- a/include/grpcpp/impl/codegen/server_context.h +++ b/include/grpcpp/impl/codegen/server_context.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H #define GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/server_interceptor.h b/include/grpcpp/impl/codegen/server_interceptor.h index 7598e72a40e..3a8fd52acba 100644 --- a/include/grpcpp/impl/codegen/server_interceptor.h +++ b/include/grpcpp/impl/codegen/server_interceptor.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SERVER_INTERCEPTOR_H #define GRPCPP_IMPL_CODEGEN_SERVER_INTERCEPTOR_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/server_interface.h b/include/grpcpp/impl/codegen/server_interface.h index 0cea47ee372..69fbc418c08 100644 --- a/include/grpcpp/impl/codegen/server_interface.h +++ b/include/grpcpp/impl/codegen/server_interface.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H #define GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H +// IWYU pragma: private + #include #include diff --git a/include/grpcpp/impl/codegen/service_type.h b/include/grpcpp/impl/codegen/service_type.h index 9b12545cc6f..182570ef2f8 100644 --- a/include/grpcpp/impl/codegen/service_type.h +++ b/include/grpcpp/impl/codegen/service_type.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H #define GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/slice.h b/include/grpcpp/impl/codegen/slice.h index d84b842c843..cb43f1110f9 100644 --- a/include/grpcpp/impl/codegen/slice.h +++ b/include/grpcpp/impl/codegen/slice.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SLICE_H #define GRPCPP_IMPL_CODEGEN_SLICE_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/status.h b/include/grpcpp/impl/codegen/status.h index 9a6cf89b17f..f5ffc615fd3 100644 --- a/include/grpcpp/impl/codegen/status.h +++ b/include/grpcpp/impl/codegen/status.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_STATUS_H #define GRPCPP_IMPL_CODEGEN_STATUS_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/status_code_enum.h b/include/grpcpp/impl/codegen/status_code_enum.h index bdd7ead6add..36ea24fdfdf 100644 --- a/include/grpcpp/impl/codegen/status_code_enum.h +++ b/include/grpcpp/impl/codegen/status_code_enum.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H #define GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H +// IWYU pragma: private, include + namespace grpc { enum StatusCode { diff --git a/include/grpcpp/impl/codegen/string_ref.h b/include/grpcpp/impl/codegen/string_ref.h index 4543e426042..f71778b57f1 100644 --- a/include/grpcpp/impl/codegen/string_ref.h +++ b/include/grpcpp/impl/codegen/string_ref.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_STRING_REF_H #define GRPCPP_IMPL_CODEGEN_STRING_REF_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/codegen/stub_options.h b/include/grpcpp/impl/codegen/stub_options.h index 30509c250a7..efa1e38ee02 100644 --- a/include/grpcpp/impl/codegen/stub_options.h +++ b/include/grpcpp/impl/codegen/stub_options.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H #define GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H +// IWYU pragma: private, include + namespace grpc { /// Useful interface for generated stubs diff --git a/include/grpcpp/impl/codegen/sync.h b/include/grpcpp/impl/codegen/sync.h index 1f4e4aac589..2dac2e08e6c 100644 --- a/include/grpcpp/impl/codegen/sync.h +++ b/include/grpcpp/impl/codegen/sync.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SYNC_H #define GRPCPP_IMPL_CODEGEN_SYNC_H +// IWYU pragma: private + #include #ifdef GPR_HAS_PTHREAD_H diff --git a/include/grpcpp/impl/codegen/sync_stream.h b/include/grpcpp/impl/codegen/sync_stream.h index 408f42f280d..17faeb57b56 100644 --- a/include/grpcpp/impl/codegen/sync_stream.h +++ b/include/grpcpp/impl/codegen/sync_stream.h @@ -18,6 +18,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H #define GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H +// IWYU pragma: private, include + #include #include #include diff --git a/include/grpcpp/impl/codegen/time.h b/include/grpcpp/impl/codegen/time.h index 340a06f5002..f2021f51edf 100644 --- a/include/grpcpp/impl/codegen/time.h +++ b/include/grpcpp/impl/codegen/time.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_TIME_H #define GRPCPP_IMPL_CODEGEN_TIME_H +// IWYU pragma: private, include + #include #include diff --git a/include/grpcpp/impl/grpc_library.h b/include/grpcpp/impl/grpc_library.h index 3711c098790..0afca8e46fe 100644 --- a/include/grpcpp/impl/grpc_library.h +++ b/include/grpcpp/impl/grpc_library.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include // IWYU pragma: export namespace grpc { diff --git a/include/grpcpp/impl/rpc_method.h b/include/grpcpp/impl/rpc_method.h index 5da70416718..aeef8b778cf 100644 --- a/include/grpcpp/impl/rpc_method.h +++ b/include/grpcpp/impl/rpc_method.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_IMPL_RPC_METHOD_H #define GRPCPP_IMPL_RPC_METHOD_H -#include +#include // IWYU pragma: export #endif // GRPCPP_IMPL_RPC_METHOD_H diff --git a/include/grpcpp/impl/rpc_service_method.h b/include/grpcpp/impl/rpc_service_method.h index ef70a3a1008..86cb2dc5a73 100644 --- a/include/grpcpp/impl/rpc_service_method.h +++ b/include/grpcpp/impl/rpc_service_method.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_IMPL_RPC_SERVICE_METHOD_H #define GRPCPP_IMPL_RPC_SERVICE_METHOD_H -#include +#include // IWYU pragma: export #endif // GRPCPP_IMPL_RPC_SERVICE_METHOD_H diff --git a/include/grpcpp/impl/serialization_traits.h b/include/grpcpp/impl/serialization_traits.h index 95194fbd894..6da8b4dfcc7 100644 --- a/include/grpcpp/impl/serialization_traits.h +++ b/include/grpcpp/impl/serialization_traits.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_IMPL_SERIALIZATION_TRAITS_H #define GRPCPP_IMPL_SERIALIZATION_TRAITS_H -#include +#include // IWYU pragma: export #endif // GRPCPP_IMPL_SERIALIZATION_TRAITS_H diff --git a/include/grpcpp/impl/service_type.h b/include/grpcpp/impl/service_type.h index 250bc8cd56d..de45c4266a7 100644 --- a/include/grpcpp/impl/service_type.h +++ b/include/grpcpp/impl/service_type.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_IMPL_SERVICE_TYPE_H #define GRPCPP_IMPL_SERVICE_TYPE_H -#include +#include // IWYU pragma: export #endif // GRPCPP_IMPL_SERVICE_TYPE_H diff --git a/include/grpcpp/security/auth_context.h b/include/grpcpp/security/auth_context.h index 7a6f2cb718b..17784508e2e 100644 --- a/include/grpcpp/security/auth_context.h +++ b/include/grpcpp/security/auth_context.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SECURITY_AUTH_CONTEXT_H #define GRPCPP_SECURITY_AUTH_CONTEXT_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SECURITY_AUTH_CONTEXT_H diff --git a/include/grpcpp/server_context.h b/include/grpcpp/server_context.h index 45f26149941..ed6bd66d06b 100644 --- a/include/grpcpp/server_context.h +++ b/include/grpcpp/server_context.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SERVER_CONTEXT_H #define GRPCPP_SERVER_CONTEXT_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SERVER_CONTEXT_H diff --git a/include/grpcpp/support/async_stream.h b/include/grpcpp/support/async_stream.h index ff9e4556793..5f717014170 100644 --- a/include/grpcpp/support/async_stream.h +++ b/include/grpcpp/support/async_stream.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H #define GRPCPP_SUPPORT_ASYNC_STREAM_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_ASYNC_STREAM_H diff --git a/include/grpcpp/support/async_unary_call.h b/include/grpcpp/support/async_unary_call.h index 2e5181c5570..02071e48c58 100644 --- a/include/grpcpp/support/async_unary_call.h +++ b/include/grpcpp/support/async_unary_call.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H #define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H diff --git a/include/grpcpp/support/byte_buffer.h b/include/grpcpp/support/byte_buffer.h index 53aeff19f77..6f566e76da1 100644 --- a/include/grpcpp/support/byte_buffer.h +++ b/include/grpcpp/support/byte_buffer.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include // IWYU pragma: export #include #include #include diff --git a/include/grpcpp/support/client_callback.h b/include/grpcpp/support/client_callback.h index 063fdc4f859..c15bca0dbe8 100644 --- a/include/grpcpp/support/client_callback.h +++ b/include/grpcpp/support/client_callback.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_CLIENT_CALLBACK_H #define GRPCPP_SUPPORT_CLIENT_CALLBACK_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_CLIENT_CALLBACK_H diff --git a/include/grpcpp/support/client_interceptor.h b/include/grpcpp/support/client_interceptor.h index 50810e3fe3c..552cab4c706 100644 --- a/include/grpcpp/support/client_interceptor.h +++ b/include/grpcpp/support/client_interceptor.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H #define GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H diff --git a/include/grpcpp/support/config.h b/include/grpcpp/support/config.h index 16bdab64275..f2632f26403 100644 --- a/include/grpcpp/support/config.h +++ b/include/grpcpp/support/config.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_CONFIG_H #define GRPCPP_SUPPORT_CONFIG_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_CONFIG_H diff --git a/include/grpcpp/support/interceptor.h b/include/grpcpp/support/interceptor.h index 7ff79516bae..d4f2ea180ec 100644 --- a/include/grpcpp/support/interceptor.h +++ b/include/grpcpp/support/interceptor.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_INTERCEPTOR_H #define GRPCPP_SUPPORT_INTERCEPTOR_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_INTERCEPTOR_H diff --git a/include/grpcpp/support/message_allocator.h b/include/grpcpp/support/message_allocator.h index 20ce072b901..22a963f3afe 100644 --- a/include/grpcpp/support/message_allocator.h +++ b/include/grpcpp/support/message_allocator.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_MESSAGE_ALLOCATOR_H #define GRPCPP_SUPPORT_MESSAGE_ALLOCATOR_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_MESSAGE_ALLOCATOR_H diff --git a/include/grpcpp/support/method_handler.h b/include/grpcpp/support/method_handler.h index 038e76c8af8..0b97a7af030 100644 --- a/include/grpcpp/support/method_handler.h +++ b/include/grpcpp/support/method_handler.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_METHOD_HANDLER_H #define GRPCPP_SUPPORT_METHOD_HANDLER_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_METHOD_HANDLER_H diff --git a/include/grpcpp/support/proto_buffer_reader.h b/include/grpcpp/support/proto_buffer_reader.h index 4cdb65d531b..07e523ed74b 100644 --- a/include/grpcpp/support/proto_buffer_reader.h +++ b/include/grpcpp/support/proto_buffer_reader.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_PROTO_BUFFER_READER_H #define GRPCPP_SUPPORT_PROTO_BUFFER_READER_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_PROTO_BUFFER_READER_H diff --git a/include/grpcpp/support/proto_buffer_writer.h b/include/grpcpp/support/proto_buffer_writer.h index 01cf29c457e..589deb82e35 100644 --- a/include/grpcpp/support/proto_buffer_writer.h +++ b/include/grpcpp/support/proto_buffer_writer.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H #define GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H diff --git a/include/grpcpp/support/server_callback.h b/include/grpcpp/support/server_callback.h index b0aeeb53c5d..1ffdce53d9e 100644 --- a/include/grpcpp/support/server_callback.h +++ b/include/grpcpp/support/server_callback.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_SERVER_CALLBACK_H #define GRPCPP_SUPPORT_SERVER_CALLBACK_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_SERVER_CALLBACK_H diff --git a/include/grpcpp/support/server_interceptor.h b/include/grpcpp/support/server_interceptor.h index b0a6229b667..ad9c7a18693 100644 --- a/include/grpcpp/support/server_interceptor.h +++ b/include/grpcpp/support/server_interceptor.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H #define GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H diff --git a/include/grpcpp/support/slice.h b/include/grpcpp/support/slice.h index eaeb29a40b2..2434983f596 100644 --- a/include/grpcpp/support/slice.h +++ b/include/grpcpp/support/slice.h @@ -20,7 +20,7 @@ #define GRPCPP_SUPPORT_SLICE_H #include -#include +#include // IWYU pragma: export #include #endif // GRPCPP_SUPPORT_SLICE_H diff --git a/include/grpcpp/support/status.h b/include/grpcpp/support/status.h index 91b629f1676..e46b46d16f9 100644 --- a/include/grpcpp/support/status.h +++ b/include/grpcpp/support/status.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_STATUS_H #define GRPCPP_SUPPORT_STATUS_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_STATUS_H diff --git a/include/grpcpp/support/status_code_enum.h b/include/grpcpp/support/status_code_enum.h index bfb47f39c0a..eac697f45a1 100644 --- a/include/grpcpp/support/status_code_enum.h +++ b/include/grpcpp/support/status_code_enum.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_STATUS_CODE_ENUM_H #define GRPCPP_SUPPORT_STATUS_CODE_ENUM_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_STATUS_CODE_ENUM_H diff --git a/include/grpcpp/support/string_ref.h b/include/grpcpp/support/string_ref.h index 0e0d3d4389e..6cf82bedf67 100644 --- a/include/grpcpp/support/string_ref.h +++ b/include/grpcpp/support/string_ref.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_STRING_REF_H #define GRPCPP_SUPPORT_STRING_REF_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_STRING_REF_H diff --git a/include/grpcpp/support/stub_options.h b/include/grpcpp/support/stub_options.h index e9700ea4928..ffe1ad77ea1 100644 --- a/include/grpcpp/support/stub_options.h +++ b/include/grpcpp/support/stub_options.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_STUB_OPTIONS_H #define GRPCPP_SUPPORT_STUB_OPTIONS_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_STUB_OPTIONS_H diff --git a/include/grpcpp/support/sync_stream.h b/include/grpcpp/support/sync_stream.h index ea60b6da6b9..78a348de752 100644 --- a/include/grpcpp/support/sync_stream.h +++ b/include/grpcpp/support/sync_stream.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_SYNC_STREAM_H #define GRPCPP_SUPPORT_SYNC_STREAM_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_SYNC_STREAM_H diff --git a/include/grpcpp/support/time.h b/include/grpcpp/support/time.h index c7408ff27d1..b5e07b68f22 100644 --- a/include/grpcpp/support/time.h +++ b/include/grpcpp/support/time.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_TIME_H #define GRPCPP_SUPPORT_TIME_H -#include +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_TIME_H diff --git a/tools/distrib/add-iwyu.py b/tools/distrib/add-iwyu.py new file mode 100755 index 00000000000..e6d800cb48d --- /dev/null +++ b/tools/distrib/add-iwyu.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 + +# Copyright 2021 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import collections +import os + + +def to_inc(filename): + """Given filename, synthesize what should go in an include statement to get that file""" + if filename.startswith("include/"): + return '<%s>' % filename[len("include/"):] + return '"%s"' % filename + + +def set_pragma(filename, pragma): + """Set the file-level IWYU pragma in filename""" + lines = [] + saw_first_define = False + for line in open(filename).read().splitlines(): + if line.startswith('// IWYU pragma: '): + continue + lines.append(line) + if not saw_first_define and line.startswith('#define '): + saw_first_define = True + lines.append('') + lines.append('// IWYU pragma: %s' % pragma) + lines.append('') + open(filename, 'w').write('\n'.join(lines) + '\n') + + +def set_exports(pub, cg): + """In file pub, mark the include for cg with IWYU pragma: export""" + lines = [] + for line in open(pub).read().splitlines(): + if line.startswith('#include %s' % to_inc(cg)): + lines.append('#include %s // IWYU pragma: export' % to_inc(cg)) + else: + lines.append(line) + open(pub, 'w').write('\n'.join(lines) + '\n') + + +CG_ROOTS_GRPC = ( + (r'sync', 'grpc/support/sync.h'), + (r'atm', 'grpc/support/atm.h'), +) + +CG_ROOTS_GRPCPP = [] + + +def fix_tree(tree, cg_roots): + """Fix one include tree""" + # Map of filename --> paths including that filename + reverse_map = collections.defaultdict(list) + # The same, but for things with '/impl/codegen' in their names + cg_reverse_map = collections.defaultdict(list) + for root, dirs, files in os.walk(tree): + root_map = cg_reverse_map if '/impl/codegen' in root else reverse_map + for filename in files: + root_map[filename].append(root) + # For each thing in '/impl/codegen' figure out what exports it + for filename, paths in cg_reverse_map.items(): + # Exclude non-headers + if not filename.endswith('.h'): + continue + pragma = None + # Check for our 'special' headers: if we see one of these, we just + # hardcode where they go to because there's some complicated rules. + for root, target in cg_roots: + if filename.startswith(root): + pragma = 'private, include <%s>' % target + if len(paths) == 1: + path = paths[0] + if filename.startswith(root + '.'): + set_exports('include/' + target, path + '/' + filename) + if filename.startswith(root + '_'): + set_exports(path + '/' + root + '.h', + path + '/' + filename) + # If the path for a file in /impl/codegen is ambiguous, just don't bother + if not pragma and len(paths) == 1: + path = paths[0] + # Check if we have an exporting candidate + if filename in reverse_map: + proper = reverse_map[filename] + # And that it too is unambiguous + if len(proper) == 1: + # Build the two relevant pathnames + cg = path + '/' + filename + pub = proper[0] + '/' + filename + # And see if the public file actually includes the /impl/codegen file + if ('#include %s' % to_inc(cg)) in open(pub).read(): + # Finally, if it does, we'll set that pragma + pragma = 'private, include %s' % to_inc(pub) + # And mark the export + set_exports(pub, cg) + # If we can't find a good alternative include to point people to, + # mark things private anyway... we don't want to recommend people include + # from impl/codegen + if not pragma: + pragma = 'private' + for path in paths: + set_pragma(path + '/' + filename, pragma) + + +fix_tree('include/grpc', CG_ROOTS_GRPC) +fix_tree('include/grpcpp', CG_ROOTS_GRPCPP) diff --git a/tools/distrib/sanitize.sh b/tools/distrib/sanitize.sh index c0541016114..7bc58eb6d0d 100755 --- a/tools/distrib/sanitize.sh +++ b/tools/distrib/sanitize.sh @@ -20,6 +20,7 @@ cd $(dirname $0)/../.. tools/buildgen/generate_projects.sh tools/distrib/check_include_guards.py --fix tools/distrib/check_copyright.py --fix +tools/distrib/add-iwyu.py tools/distrib/check_trailing_newlines.sh --fix tools/run_tests/sanity/check_port_platform.py --fix tools/run_tests/sanity/check_include_style.py --fix || true