From ad936d371083899ce2140a57c95d5b48158b743e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 24 Jun 2022 04:04:12 -0700 Subject: [PATCH] [bloat] Prefer std::vector to absl::InlinedVector (#30086) * [bloat] Prefer std::vector to absl::InlinedVector * fix * fix * fix * fix * fixes * fix * fixes --- BUILD | 17 +---------------- CMakeLists.txt | 1 - build_autogenerated.yaml | 3 +-- .../filters/client_channel/client_channel.cc | 2 +- .../lb_policy/address_filtering.cc | 2 +- .../grpclb/grpclb_balancer_addresses.cc | 2 +- .../outlier_detection/outlier_detection.cc | 1 - .../lb_policy/pick_first/pick_first.cc | 3 ++- .../lb_policy/ring_hash/ring_hash.cc | 2 +- .../lb_policy/round_robin/round_robin.cc | 5 +++-- .../client_channel/lb_policy/subchannel_list.h | 5 ++--- .../weighted_target/weighted_target.cc | 5 ++--- .../lb_policy/xds/xds_cluster_resolver.cc | 1 - .../client_channel/lb_policy_registry.cc | 4 +--- .../client_channel/proxy_mapper_registry.cc | 1 - .../resolver/binder/binder_resolver.cc | 2 ++ .../resolver/dns/c_ares/dns_resolver_ares.cc | 2 +- .../resolver/dns/c_ares/grpc_ares_wrapper.cc | 3 +++ .../resolver/dns/native/dns_resolver.cc | 2 +- .../resolver/sockaddr/sockaddr_resolver.cc | 1 + .../client_channel/resolver/xds/xds_resolver.cc | 3 +-- .../ext/xds/certificate_provider_registry.cc | 12 +++--------- src/core/ext/xds/xds_bootstrap.cc | 3 +-- src/core/ext/xds/xds_bootstrap.h | 11 ++++++----- src/core/ext/xds/xds_cluster.cc | 3 +-- src/core/ext/xds/xds_common_types.cc | 5 ++--- src/core/ext/xds/xds_endpoint.h | 7 ++++--- src/core/ext/xds/xds_listener.cc | 7 +++---- src/core/ext/xds/xds_route_config.cc | 1 - src/core/lib/avl/avl.h | 6 +++--- src/core/lib/channel/channel_args.h | 1 + src/core/lib/channel/channelz.cc | 1 + src/core/lib/channel/channelz.h | 5 ++--- src/core/lib/channel/channelz_registry.cc | 9 ++++----- src/core/lib/resolver/resolver.cc | 1 + src/core/lib/resolver/server_address.h | 4 ++-- .../composite/composite_credentials.cc | 1 - .../composite/composite_credentials.h | 6 ++++-- .../credentials/oauth2/oauth2_credentials.cc | 3 +-- .../tls/grpc_tls_certificate_distributor.cc | 3 ++- .../tls/grpc_tls_certificate_provider.cc | 3 ++- .../load_system_roots_supported.cc | 8 +++++--- .../lib/security/security_connector/ssl_utils.h | 4 ++-- .../tls/tls_security_connector.cc | 1 - .../lib/service_config/service_config_impl.h | 4 +--- src/cpp/common/tls_certificate_verifier.cc | 1 - tools/distrib/iwyu_mappings.imp | 2 ++ 47 files changed, 78 insertions(+), 101 deletions(-) diff --git a/BUILD b/BUILD index 300fc820418..70dc45dc89a 100644 --- a/BUILD +++ b/BUILD @@ -2226,7 +2226,6 @@ grpc_cc_library( hdrs = [ "src/core/lib/avl/avl.h", ], - external_deps = ["absl/container:inlined_vector"], tags = ["grpc-autodeps"], deps = ["gpr_platform"], ) @@ -2930,7 +2929,6 @@ grpc_cc_library( "src/core/lib/service_config/service_config_impl.h", ], external_deps = [ - "absl/container:inlined_vector", "absl/memory", "absl/strings", ], @@ -2981,7 +2979,6 @@ grpc_cc_library( "src/core/lib/resolver/server_address.h", ], external_deps = [ - "absl/container:inlined_vector", "absl/memory", "absl/status", "absl/status:statusor", @@ -3591,7 +3588,6 @@ grpc_cc_library( hdrs = [ "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h", ], - external_deps = ["absl/container:inlined_vector"], language = "c++", tags = ["grpc-autodeps"], visibility = ["@grpc:grpclb"], @@ -4184,7 +4180,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/address_filtering.h", ], external_deps = [ - "absl/container:inlined_vector", "absl/memory", "absl/status:statusor", "absl/strings", @@ -4203,7 +4198,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h", ], external_deps = [ - "absl/container:inlined_vector", "absl/status", "absl/types:optional", ], @@ -4229,7 +4223,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc", ], external_deps = [ - "absl/container:inlined_vector", "absl/memory", "absl/status", "absl/status:statusor", @@ -4304,7 +4297,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc", ], external_deps = [ - "absl/container:inlined_vector", "absl/memory", "absl/status", "absl/status:statusor", @@ -4350,7 +4342,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc", ], external_deps = [ - "absl/container:inlined_vector", "absl/memory", "absl/random", "absl/status", @@ -4426,7 +4417,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc", ], external_deps = [ - "absl/container:inlined_vector", "absl/memory", "absl/status", "absl/status:statusor", @@ -5444,7 +5434,6 @@ grpc_cc_library( "src/core/lib/security/credentials/oauth2/oauth2_credentials.h", ], external_deps = [ - "absl/container:inlined_vector", "absl/status", "absl/status:statusor", "absl/strings", @@ -5704,10 +5693,7 @@ grpc_cc_library( "src/core/lib/security/security_connector/load_system_roots_supported.h", "src/core/lib/security/util/json_util.h", ], - external_deps = [ - "absl/container:inlined_vector", - "absl/strings", - ], + external_deps = ["absl/strings"], language = "c++", tags = ["grpc-autodeps"], visibility = ["@grpc:public"], @@ -5821,7 +5807,6 @@ grpc_cc_library( ], external_deps = [ "absl/base:core_headers", - "absl/container:inlined_vector", "absl/status", "absl/strings", "libcrypto", diff --git a/CMakeLists.txt b/CMakeLists.txt index e0e3bb1254d..e4fc0449fcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7944,7 +7944,6 @@ target_include_directories(avl_test target_link_libraries(avl_test ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} - absl::inlined_vector ) diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 0fc16d86fe2..7e787e067c2 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -4710,8 +4710,7 @@ targets: - src/core/lib/avl/avl.h src: - test/core/avl/avl_test.cc - deps: - - absl/container:inlined_vector + deps: [] uses_polling: false - name: aws_request_signer_test gtest: true diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index c9ae5f2d738..db4db4428ab 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -1234,7 +1234,7 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) { // (d) Address resolution that causes a new LB policy to be created. // // We track a list of strings to eventually be concatenated and traced. - absl::InlinedVector trace_strings; + std::vector trace_strings; const bool resolution_contains_addresses = result.addresses.ok() && !result.addresses->empty(); if (!resolution_contains_addresses && diff --git a/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc b/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc index 57b0002493c..1e39e77cb49 100644 --- a/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +++ b/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc @@ -20,9 +20,9 @@ #include +#include #include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_join.h" diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc index 4ed8fffe679..61f2ff1a7f0 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc @@ -20,7 +20,7 @@ #include -#include "absl/container/inlined_vector.h" +#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/useful.h" diff --git a/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc b/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc index bfd709cc3e7..beb0a2a50ae 100644 --- a/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +++ b/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc @@ -31,7 +31,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/random/random.h" #include "absl/status/status.h" diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index 1182700e9c4..4284f63f484 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -19,11 +19,12 @@ #include #include +#include #include #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/status/statusor.h" diff --git a/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc b/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc index 6bc65837f56..72ee8b7c7b0 100644 --- a/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +++ b/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc @@ -340,7 +340,7 @@ class RingHash : public LoadBalancingPolicy { RefCountedPtr ring_hash_lb_; grpc_closure closure_; - absl::InlinedVector, 10> subchannels_; + std::vector> subchannels_; }; RefCountedPtr parent_; diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc index 305ba26f08e..bc0fad6a112 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc @@ -19,11 +19,12 @@ #include #include +#include #include #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/status/statusor.h" @@ -175,7 +176,7 @@ class RoundRobin : public LoadBalancingPolicy { RoundRobin* parent_; size_t last_picked_index_; - absl::InlinedVector, 10> subchannels_; + std::vector> subchannels_; }; void ShutdownLocked() override; diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h index 67de4729a9d..a8a12960004 100644 --- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -25,8 +25,8 @@ #include #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/status/status.h" #include "absl/types/optional.h" @@ -180,8 +180,7 @@ class SubchannelList : public InternallyRefCounted { public: // We use ManualConstructor here to support SubchannelDataType classes // that are not copyable. - typedef absl::InlinedVector, 10> - SubchannelVector; + using SubchannelVector = std::vector>; // The number of subchannels in the list. size_t num_subchannels() const { return subchannels_.size(); } diff --git a/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc b/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc index 46de98c3e84..12fab0aac2a 100644 --- a/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +++ b/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc @@ -26,7 +26,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/status/statusor.h" @@ -129,8 +128,8 @@ class WeightedTargetLb : public LoadBalancingPolicy { // ready state. The first element in the pair represents the end of a // range proportional to the child's weight. The start of the range // is the previous value in the vector and is 0 for the first element. - using PickerList = absl::InlinedVector< - std::pair>, 1>; + using PickerList = + std::vector>>; explicit WeightedPicker(PickerList pickers) : pickers_(std::move(pickers)) {} diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc index 31df610de1b..07edc3ea2b3 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.cc b/src/core/ext/filters/client_channel/lb_policy_registry.cc index b4a2bc9926c..1757a5f4e34 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.cc +++ b/src/core/ext/filters/client_channel/lb_policy_registry.cc @@ -28,7 +28,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" @@ -65,8 +64,7 @@ class RegistryState { } private: - absl::InlinedVector, 10> - factories_; + std::vector> factories_; }; RegistryState* g_state = nullptr; diff --git a/src/core/ext/filters/client_channel/proxy_mapper_registry.cc b/src/core/ext/filters/client_channel/proxy_mapper_registry.cc index ff5905b853c..992d0bf33f4 100644 --- a/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +++ b/src/core/ext/filters/client_channel/proxy_mapper_registry.cc @@ -20,7 +20,6 @@ #include "src/core/ext/filters/client_channel/proxy_mapper_registry.h" -#include #include #include #include diff --git a/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc b/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc index 24be90a364f..77c1822fd17 100644 --- a/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc @@ -14,6 +14,8 @@ #include +#include + #include "src/core/lib/iomgr/port.h" // IWYU pragma: keep #ifdef GRPC_HAVE_UNIX_SOCKET diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc index 209283c9eb1..63cf9cec0f1 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -207,7 +207,7 @@ std::string ChooseServiceConfig(char* service_config_choice_json, return ""; } const Json* service_config = nullptr; - absl::InlinedVector error_list; + std::vector error_list; for (const Json& choice : json.array_value()) { if (choice.type() != Json::Type::OBJECT) { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc index 5d1f6926cb2..1c813152362 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc @@ -18,6 +18,9 @@ #include +#include +#include + #include "src/core/lib/iomgr/sockaddr.h" // IWYU pragma: no_include diff --git a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc index 02dfea0ffca..b7fd8d1c620 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc @@ -18,12 +18,12 @@ #include +#include #include #include #include #include -#include "absl/container/inlined_vector.h" #include "absl/functional/bind_front.h" #include "absl/memory/memory.h" #include "absl/status/status.h" diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc index a593aa24d8b..5ce1e4254da 100644 --- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc @@ -16,6 +16,7 @@ #include +#include #include #include #include diff --git a/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc b/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc index e225fe08eb0..b944212d2fd 100644 --- a/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc @@ -28,7 +28,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/meta/type_traits.h" #include "absl/random/random.h" @@ -337,7 +336,7 @@ class XdsResolver : public Resolver { XdsRouteConfigResource::Route route; RefCountedPtr method_config; - absl::InlinedVector weighted_cluster_state; + std::vector weighted_cluster_state; bool operator==(const Route& other) const; }; diff --git a/src/core/ext/xds/certificate_provider_registry.cc b/src/core/ext/xds/certificate_provider_registry.cc index f126a762f9f..fe89568338e 100644 --- a/src/core/ext/xds/certificate_provider_registry.cc +++ b/src/core/ext/xds/certificate_provider_registry.cc @@ -22,9 +22,9 @@ #include +#include #include - -#include "absl/container/inlined_vector.h" +#include #include @@ -55,13 +55,7 @@ class RegistryState { } private: - // We currently support 3 factories without doing additional - // allocation. This number could be raised if there is a case where - // more factories are needed and the additional allocations are - // hurting performance (which is unlikely, since these allocations - // only occur at gRPC initialization time). - absl::InlinedVector, 3> - factories_; + std::vector> factories_; }; RegistryState* g_state = nullptr; diff --git a/src/core/ext/xds/xds_bootstrap.cc b/src/core/ext/xds/xds_bootstrap.cc index 37c8cfd487e..0d969ddae09 100644 --- a/src/core/ext/xds/xds_bootstrap.cc +++ b/src/core/ext/xds/xds_bootstrap.cc @@ -20,7 +20,6 @@ #include -#include #include #include @@ -289,7 +288,7 @@ bool XdsBootstrap::XdsServerExists( } grpc_error_handle XdsBootstrap::ParseXdsServerList( - Json* json, absl::InlinedVector* servers) { + Json* json, std::vector* servers) { std::vector error_list; for (size_t i = 0; i < json->mutable_array()->size(); ++i) { Json& child = json->mutable_array()->at(i); diff --git a/src/core/ext/xds/xds_bootstrap.h b/src/core/ext/xds/xds_bootstrap.h index 3d155fec806..afb3570a2ed 100644 --- a/src/core/ext/xds/xds_bootstrap.h +++ b/src/core/ext/xds/xds_bootstrap.h @@ -19,12 +19,13 @@ #include +#include #include #include #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/strings/string_view.h" #include "src/core/ext/xds/certificate_provider_store.h" @@ -81,7 +82,7 @@ class XdsBootstrap { struct Authority { std::string client_listener_resource_name_template; - absl::InlinedVector xds_servers; + std::vector xds_servers; }; // Creates bootstrap object from json_string. @@ -117,8 +118,8 @@ class XdsBootstrap { bool XdsServerExists(const XdsServer& server) const; private: - grpc_error_handle ParseXdsServerList( - Json* json, absl::InlinedVector* servers); + grpc_error_handle ParseXdsServerList(Json* json, + std::vector* servers); grpc_error_handle ParseAuthorities(Json* json); grpc_error_handle ParseAuthority(Json* json, const std::string& name); grpc_error_handle ParseNode(Json* json); @@ -127,7 +128,7 @@ class XdsBootstrap { grpc_error_handle ParseCertificateProvider(const std::string& instance_name, Json* certificate_provider_json); - absl::InlinedVector servers_; + std::vector servers_; std::unique_ptr node_; std::string client_default_listener_resource_name_template_; std::string server_listener_resource_name_template_; diff --git a/src/core/ext/xds/xds_cluster.cc b/src/core/ext/xds/xds_cluster.cc index 44e218d0f81..f0cbdca823b 100644 --- a/src/core/ext/xds/xds_cluster.cc +++ b/src/core/ext/xds/xds_cluster.cc @@ -23,7 +23,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" @@ -62,7 +61,7 @@ namespace grpc_core { // std::string XdsClusterResource::ToString() const { - absl::InlinedVector contents; + std::vector contents; switch (cluster_type) { case EDS: contents.push_back("cluster_type=EDS"); diff --git a/src/core/ext/xds/xds_common_types.cc b/src/core/ext/xds/xds_common_types.cc index b2172cde2c7..43fd2be2bad 100644 --- a/src/core/ext/xds/xds_common_types.cc +++ b/src/core/ext/xds/xds_common_types.cc @@ -24,7 +24,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -66,7 +65,7 @@ bool CommonTlsContext::CertificateValidationContext::Empty() const { std::string CommonTlsContext::CertificateProviderPluginInstance::ToString() const { - absl::InlinedVector contents; + std::vector contents; if (!instance_name.empty()) { contents.push_back(absl::StrFormat("instance_name=%s", instance_name)); } @@ -86,7 +85,7 @@ bool CommonTlsContext::CertificateProviderPluginInstance::Empty() const { // std::string CommonTlsContext::ToString() const { - absl::InlinedVector contents; + std::vector contents; if (!tls_certificate_provider_instance.Empty()) { contents.push_back( absl::StrFormat("tls_certificate_provider_instance=%s", diff --git a/src/core/ext/xds/xds_endpoint.h b/src/core/ext/xds/xds_endpoint.h index e5ed5ff3644..655c8ca73c0 100644 --- a/src/core/ext/xds/xds_endpoint.h +++ b/src/core/ext/xds/xds_endpoint.h @@ -21,12 +21,13 @@ #include +#include #include #include #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "envoy/config/endpoint/v3/endpoint.upbdefs.h" @@ -61,7 +62,7 @@ struct XdsEndpointResource { bool operator==(const Priority& other) const; std::string ToString() const; }; - using PriorityList = absl::InlinedVector; + using PriorityList = std::vector; // There are two phases of accessing this class's content: // 1. to initialize in the control plane combiner; @@ -79,7 +80,7 @@ struct XdsEndpointResource { const uint32_t parts_per_million; }; - using DropCategoryList = absl::InlinedVector; + using DropCategoryList = std::vector; void AddCategory(std::string name, uint32_t parts_per_million) { drop_category_list_.emplace_back( diff --git a/src/core/ext/xds/xds_listener.cc b/src/core/ext/xds/xds_listener.cc index 3d38a6477df..35f069f6b44 100644 --- a/src/core/ext/xds/xds_listener.cc +++ b/src/core/ext/xds/xds_listener.cc @@ -24,7 +24,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" @@ -83,7 +82,7 @@ bool XdsListenerResource::DownstreamTlsContext::Empty() const { // std::string XdsListenerResource::HttpConnectionManager::ToString() const { - absl::InlinedVector contents; + std::vector contents; contents.push_back(absl::StrFormat( "route_config_name=%s", !route_config_name.empty() ? route_config_name.c_str() : "")); @@ -159,7 +158,7 @@ struct FilterChain { }; std::string FilterChain::FilterChainMatch::ToString() const { - absl::InlinedVector contents; + std::vector contents; if (destination_port != 0) { contents.push_back(absl::StrCat("destination_port=", destination_port)); } @@ -248,7 +247,7 @@ std::string XdsListenerResource::FilterChainMap::ToString() const { // std::string XdsListenerResource::ToString() const { - absl::InlinedVector contents; + std::vector contents; if (type == ListenerType::kTcpListener) { contents.push_back(absl::StrCat("address=", address)); contents.push_back( diff --git a/src/core/ext/xds/xds_route_config.cc b/src/core/ext/xds/xds_route_config.cc index d5050b820d5..3490e9123c8 100644 --- a/src/core/ext/xds/xds_route_config.cc +++ b/src/core/ext/xds/xds_route_config.cc @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/src/core/lib/avl/avl.h b/src/core/lib/avl/avl.h index d00f50c0bc8..df4f781c15e 100644 --- a/src/core/lib/avl/avl.h +++ b/src/core/lib/avl/avl.h @@ -19,10 +19,10 @@ #include +#include // IWYU pragma: keep #include #include - -#include "absl/container/inlined_vector.h" +#include namespace grpc_core { @@ -127,7 +127,7 @@ class AVL { } private: - absl::InlinedVector stack_; + std::vector stack_; }; explicit AVL(NodePtr root) : root_(std::move(root)) {} diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 9116b4384ca..47f317da505 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -23,6 +23,7 @@ #include +#include // IWYU pragma: keep #include #include #include diff --git a/src/core/lib/channel/channelz.cc b/src/core/lib/channel/channelz.cc index d8f3002b79f..f823af70c6c 100644 --- a/src/core/lib/channel/channelz.cc +++ b/src/core/lib/channel/channelz.cc @@ -24,6 +24,7 @@ #include #include +#include #include #include "absl/status/statusor.h" diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h index d3b23a9ce31..30b5ca2a9ba 100644 --- a/src/core/lib/channel/channelz.h +++ b/src/core/lib/channel/channelz.h @@ -29,8 +29,8 @@ #include #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" @@ -170,8 +170,7 @@ class CallCountingHelper { // collects the sharded data into one CounterData struct. void CollectData(CounterData* out); - // Really zero-sized, but 0-sized arrays are illegal on MSVC. - absl::InlinedVector per_cpu_counter_data_storage_; + std::vector per_cpu_counter_data_storage_; size_t num_cores_ = 0; }; diff --git a/src/core/lib/channel/channelz_registry.cc b/src/core/lib/channel/channelz_registry.cc index f0b3021999a..5b301f50705 100644 --- a/src/core/lib/channel/channelz_registry.cc +++ b/src/core/lib/channel/channelz_registry.cc @@ -24,8 +24,7 @@ #include #include #include - -#include "absl/container/inlined_vector.h" +#include #include #include @@ -77,7 +76,7 @@ RefCountedPtr ChannelzRegistry::InternalGet(intptr_t uuid) { std::string ChannelzRegistry::InternalGetTopChannels( intptr_t start_channel_id) { - absl::InlinedVector, 10> top_level_channels; + std::vector> top_level_channels; RefCountedPtr node_after_pagination_limit; { MutexLock lock(&mu_); @@ -116,7 +115,7 @@ std::string ChannelzRegistry::InternalGetTopChannels( } std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) { - absl::InlinedVector, 10> servers; + std::vector> servers; RefCountedPtr node_after_pagination_limit; { MutexLock lock(&mu_); @@ -155,7 +154,7 @@ std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) { } void ChannelzRegistry::InternalLogAllEntities() { - absl::InlinedVector, 10> nodes; + std::vector> nodes; { MutexLock lock(&mu_); for (auto& p : node_map_) { diff --git a/src/core/lib/resolver/resolver.cc b/src/core/lib/resolver/resolver.cc index 5970d76e7a8..f50b547253e 100644 --- a/src/core/lib/resolver/resolver.cc +++ b/src/core/lib/resolver/resolver.cc @@ -20,6 +20,7 @@ #include "src/core/lib/resolver/resolver.h" +#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/lib/resolver/server_address.h b/src/core/lib/resolver/server_address.h index 92e26cde21a..0ddb8f1b494 100644 --- a/src/core/lib/resolver/server_address.h +++ b/src/core/lib/resolver/server_address.h @@ -27,8 +27,8 @@ #include #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include @@ -117,7 +117,7 @@ class ServerAddress { // ServerAddressList // -typedef absl::InlinedVector ServerAddressList; +using ServerAddressList = std::vector; // // ServerAddressWeightAttribute diff --git a/src/core/lib/security/credentials/composite/composite_credentials.cc b/src/core/lib/security/credentials/composite/composite_credentials.cc index ccee7779ca5..324018c9224 100644 --- a/src/core/lib/security/credentials/composite/composite_credentials.cc +++ b/src/core/lib/security/credentials/composite/composite_credentials.cc @@ -20,7 +20,6 @@ #include "src/core/lib/security/credentials/composite/composite_credentials.h" -#include #include #include diff --git a/src/core/lib/security/credentials/composite/composite_credentials.h b/src/core/lib/security/credentials/composite/composite_credentials.h index 8fac9c59a27..4b35d1c1aff 100644 --- a/src/core/lib/security/credentials/composite/composite_credentials.h +++ b/src/core/lib/security/credentials/composite/composite_credentials.h @@ -18,12 +18,14 @@ #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H + #include +#include #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/status/statusor.h" #include @@ -93,7 +95,7 @@ class grpc_composite_channel_credentials : public grpc_channel_credentials { class grpc_composite_call_credentials : public grpc_call_credentials { public: using CallCredentialsList = - absl::InlinedVector, 2>; + std::vector>; grpc_composite_call_credentials( grpc_core::RefCountedPtr creds1, diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index 9f94a233dee..619766a4243 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -29,7 +29,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -663,7 +662,7 @@ class StsTokenFetcherCredentials absl::StatusOr ValidateStsCredentialsOptions( const grpc_sts_credentials_options* options) { - absl::InlinedVector error_list; + std::vector error_list; absl::StatusOr sts_url = URI::Parse(options->token_exchange_service_uri == nullptr ? "" diff --git a/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc b/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc index 6896337d44c..e6489384192 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +++ b/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc @@ -18,7 +18,8 @@ #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h" -#include "absl/container/inlined_vector.h" +#include +#include #include #include diff --git a/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc b/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc index 5d619a609cb..f1db3e47b33 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +++ b/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc @@ -21,7 +21,9 @@ #include #include +#include #include +#include #include #include @@ -29,7 +31,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/status/status.h" #include diff --git a/src/core/lib/security/security_connector/load_system_roots_supported.cc b/src/core/lib/security/security_connector/load_system_roots_supported.cc index b9b0aa85864..ff775c3f385 100644 --- a/src/core/lib/security/security_connector/load_system_roots_supported.cc +++ b/src/core/lib/security/security_connector/load_system_roots_supported.cc @@ -18,6 +18,10 @@ #include +#include +#include +#include + #if defined(GPR_LINUX) || defined(GPR_ANDROID) || defined(GPR_FREEBSD) || \ defined(GPR_APPLE) @@ -29,8 +33,6 @@ #include #include -#include "absl/container/inlined_vector.h" - #include #include @@ -107,7 +109,7 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) { char path[MAXPATHLEN]; off_t size; }; - absl::InlinedVector roots_filenames; + std::vector roots_filenames; size_t total_bundle_size = 0; struct dirent* directory_entry; while ((directory_entry = readdir(ca_directory)) != nullptr) { diff --git a/src/core/lib/security/security_connector/ssl_utils.h b/src/core/lib/security/security_connector/ssl_utils.h index abe37a8ce5b..69ada762ac9 100644 --- a/src/core/lib/security/security_connector/ssl_utils.h +++ b/src/core/lib/security/security_connector/ssl_utils.h @@ -25,8 +25,8 @@ #include #include +#include -#include "absl/container/inlined_vector.h" #include "absl/status/status.h" #include "absl/strings/string_view.h" @@ -180,7 +180,7 @@ class PemKeyCertPair { std::string cert_chain_; }; -typedef absl::InlinedVector PemKeyCertPairList; +using PemKeyCertPairList = std::vector; } // namespace grpc_core diff --git a/src/core/lib/security/security_connector/tls/tls_security_connector.cc b/src/core/lib/security/security_connector/tls/tls_security_connector.cc index 95ad684738b..8c4bd5dfe09 100644 --- a/src/core/lib/security/security_connector/tls/tls_security_connector.cc +++ b/src/core/lib/security/security_connector/tls/tls_security_connector.cc @@ -27,7 +27,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/functional/bind_front.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" diff --git a/src/core/lib/service_config/service_config_impl.h b/src/core/lib/service_config/service_config_impl.h index 361c1d3a9e5..949c4031d35 100644 --- a/src/core/lib/service_config/service_config_impl.h +++ b/src/core/lib/service_config/service_config_impl.h @@ -26,7 +26,6 @@ #include #include -#include "absl/container/inlined_vector.h" #include "absl/strings/string_view.h" #include @@ -122,8 +121,7 @@ class ServiceConfigImpl final : public ServiceConfig { nullptr; // Storage for all the vectors that are being used in // parsed_method_configs_table_. - absl::InlinedVector, - 32> + std::vector> parsed_method_config_vectors_storage_; }; diff --git a/src/cpp/common/tls_certificate_verifier.cc b/src/cpp/common/tls_certificate_verifier.cc index 0db6161fbf1..811585cbcff 100644 --- a/src/cpp/common/tls_certificate_verifier.cc +++ b/src/cpp/common/tls_certificate_verifier.cc @@ -16,7 +16,6 @@ #include -#include #include #include #include diff --git a/tools/distrib/iwyu_mappings.imp b/tools/distrib/iwyu_mappings.imp index 7f96a080674..3f993a9aee5 100644 --- a/tools/distrib/iwyu_mappings.imp +++ b/tools/distrib/iwyu_mappings.imp @@ -4,4 +4,6 @@ { include: ["", "public", "\"src/core/lib/iomgr/sockaddr.h\"", "public"]}, { include: ["", "private", "", "public"] }, { include: ["", "private", "", "public"] }, + # workaround: https://github.com/include-what-you-use/include-what-you-use/issues/908 + { symbol: ["std::max", "private", "", "public" ] }, ]