grpc 1.31.1 → 1.35.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +719 -17819
- data/etc/roots.pem +257 -573
- data/include/grpc/compression.h +1 -1
- data/include/grpc/grpc.h +15 -7
- data/include/grpc/grpc_security.h +254 -186
- data/include/grpc/impl/codegen/README.md +22 -0
- data/include/grpc/impl/codegen/atm_windows.h +4 -0
- data/include/grpc/impl/codegen/byte_buffer.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +10 -8
- data/include/grpc/impl/codegen/log.h +0 -2
- data/include/grpc/impl/codegen/port_platform.h +28 -56
- data/include/grpc/impl/codegen/sync_windows.h +4 -0
- data/include/grpc/slice_buffer.h +3 -3
- data/include/grpc/support/sync.h +3 -3
- data/include/grpc/support/time.h +7 -7
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -4
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +2831 -1540
- data/src/core/ext/filters/client_channel/client_channel.h +1 -5
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +0 -3
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
- data/src/core/ext/filters/client_channel/config_selector.cc +0 -4
- data/src/core/ext/filters/client_channel/config_selector.h +40 -8
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +186 -0
- data/src/core/ext/filters/client_channel/dynamic_filters.h +99 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -8
- data/src/core/ext/filters/client_channel/health/health_check_client.h +4 -4
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +7 -9
- data/src/core/ext/filters/client_channel/http_proxy.cc +21 -20
- data/src/core/ext/filters/client_channel/lb_policy.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +48 -35
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -7
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +210 -192
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -13
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +0 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -37
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +23 -17
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +79 -30
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +10 -9
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +14 -34
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +26 -15
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +350 -130
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +52 -24
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +24 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +812 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +722 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +1262 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +8 -1
- data/src/core/ext/filters/client_channel/resolver.cc +3 -1
- data/src/core/ext/filters/client_channel/resolver.h +4 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +9 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -32
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +457 -19
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +7 -10
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +35 -28
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +664 -63
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +28 -0
- data/src/core/ext/filters/client_channel/resolver_factory.h +6 -6
- data/src/core/ext/filters/client_channel/resolver_registry.cc +40 -39
- data/src/core/ext/filters/client_channel/resolver_registry.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +29 -74
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +12 -11
- data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -3
- data/src/core/ext/filters/client_channel/retry_throttle.h +4 -2
- data/src/core/ext/filters/client_channel/server_address.cc +120 -7
- data/src/core/ext/filters/client_channel/server_address.h +44 -21
- data/src/core/ext/filters/client_channel/service_config.cc +18 -13
- data/src/core/ext/filters/client_channel/service_config.h +8 -5
- data/src/core/ext/filters/client_channel/service_config_call_data.h +19 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +2 -2
- data/src/core/ext/filters/client_channel/service_config_parser.cc +8 -6
- data/src/core/ext/filters/client_channel/service_config_parser.h +8 -5
- data/src/core/ext/filters/client_channel/subchannel.cc +115 -87
- data/src/core/ext/filters/client_channel/subchannel.h +30 -24
- data/src/core/ext/filters/client_channel/subchannel_interface.h +41 -5
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +6 -2
- data/src/core/ext/filters/deadline/deadline_filter.cc +87 -79
- data/src/core/ext/filters/deadline/deadline_filter.h +7 -11
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -6
- data/src/core/ext/filters/http/http_filters_plugin.cc +6 -3
- data/src/core/ext/filters/http/server/http_server_filter.cc +3 -3
- data/src/core/ext/filters/max_age/max_age_filter.cc +3 -2
- data/src/core/ext/filters/message_size/message_size_filter.cc +3 -2
- data/src/core/ext/filters/message_size/message_size_filter.h +2 -1
- data/src/core/ext/filters/workarounds/workaround_utils.cc +1 -1
- data/src/core/ext/transport/chttp2/client/authority.cc +3 -3
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +87 -31
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +19 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +20 -8
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +21 -10
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +34 -47
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +200 -100
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +2 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +2 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +16 -9
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +267 -319
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +11 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.h +13 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +12 -8
- data/src/core/ext/transport/chttp2/transport/internal.h +10 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +19 -31
- data/src/core/ext/transport/chttp2/transport/writing.cc +8 -8
- data/src/core/ext/transport/inproc/inproc_transport.cc +52 -18
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +244 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +865 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +74 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +253 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +458 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1818 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +77 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +55 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +349 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +124 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +428 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +88 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +310 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +991 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +103 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +388 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +78 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +53 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +149 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +241 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +839 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +170 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +752 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +88 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +176 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +730 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +28 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/socket_option.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +95 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +92 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +243 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +305 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +112 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +367 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +33 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +73 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +128 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +512 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +155 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +591 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +41 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +107 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +178 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +662 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +220 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +900 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +3640 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +60 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +159 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +50 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +122 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +364 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1475 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +20 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +35 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +110 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +426 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +76 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +236 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +147 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +621 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/cluster/v3}/cds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/{v2 → v3}/ads.upb.c +6 -5
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +139 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +487 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/endpoint/v3}/eds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/listener/v3}/lds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +55 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +151 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/rds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/srds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +128 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +84 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +78 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +64 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +166 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +54 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +146 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +207 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +301 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +90 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +283 -0
- data/src/core/ext/upb-generated/envoy/type/{http.upb.c → v3/http.upb.c} +2 -2
- data/src/core/ext/upb-generated/envoy/type/{http.upb.h → v3/http.upb.h} +9 -8
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +40 -0
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +99 -0
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +51 -0
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +130 -0
- data/src/core/ext/upb-generated/envoy/type/{semantic_version.upb.c → v3/semantic_version.upb.c} +7 -6
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +68 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +242 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +830 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +234 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +842 -0
- data/src/core/ext/upb-generated/google/api/http.upb.c +3 -3
- data/src/core/ext/upb-generated/google/api/http.upb.h +25 -6
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +103 -103
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +455 -292
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +4 -4
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +23 -4
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +9 -9
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +55 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +1 -1
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +10 -3
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +11 -3
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +41 -41
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +149 -76
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -5
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +21 -6
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +2 -2
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +13 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +17 -17
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +82 -25
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +19 -0
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +31 -0
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +64 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +2 -2
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +9 -2
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +27 -0
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +60 -0
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +60 -0
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +52 -0
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +143 -0
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +42 -0
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +84 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +36 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +94 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +54 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +173 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +36 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +92 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +7 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +68 -68
- data/src/core/ext/upb-generated/validate/validate.upb.h +296 -157
- data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +38 -0
- data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.h +30 -0
- data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.c +41 -0
- data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +254 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +105 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +100 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +558 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +145 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.c +53 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +133 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +127 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +65 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +266 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +125 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +143 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.c +66 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +263 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.h +100 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +233 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +228 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +80 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +46 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +59 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +55 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +110 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +113 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.c +146 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.c +50 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +190 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +185 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.h +65 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +62 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +97 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +915 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +280 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.c +71 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +64 -0
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +511 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +115 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +48 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h +30 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +166 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +105 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +249 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h +60 -0
- data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.c +72 -0
- data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.c +60 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +152 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +60 -0
- data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +83 -0
- data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +82 -0
- data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +83 -0
- data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +86 -0
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.c +74 -0
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +64 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.c +54 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.c +53 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +73 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +72 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.c +81 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.c +92 -0
- data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.h +65 -0
- data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.c +95 -0
- data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/http.upbdefs.c +34 -0
- data/src/core/ext/{upb-generated/gogoproto/gogo.upb.h → upbdefs-generated/envoy/type/v3/http.upbdefs.h} +10 -9
- data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.c +59 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.c +54 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.c +47 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.c +40 -0
- data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.h +30 -0
- data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.c +61 -0
- data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +38 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +386 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +165 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +39 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +37 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +65 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +39 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +66 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.h +75 -0
- data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +42 -0
- data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +70 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +33 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.h +30 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +49 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +43 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.c +42 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.c +62 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.c +45 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.c +49 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.c +68 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.c +51 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +307 -0
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.h +145 -0
- data/src/core/ext/xds/certificate_provider_factory.h +61 -0
- data/src/core/ext/xds/certificate_provider_registry.cc +103 -0
- data/src/core/ext/xds/certificate_provider_registry.h +57 -0
- data/src/core/ext/xds/certificate_provider_store.cc +87 -0
- data/src/core/ext/xds/certificate_provider_store.h +112 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +144 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +69 -0
- data/src/core/ext/xds/xds_api.cc +2308 -0
- data/src/core/ext/xds/xds_api.h +469 -0
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.cc +208 -19
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.h +31 -11
- data/src/core/ext/xds/xds_certificate_provider.cc +299 -0
- data/src/core/ext/xds/xds_certificate_provider.h +112 -0
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_args.h +9 -6
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.cc +656 -865
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.h +126 -99
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.cc +61 -18
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.h +38 -10
- data/src/core/ext/xds/xds_server_config_fetcher.cc +131 -0
- data/src/core/lib/channel/channel_args.cc +9 -8
- data/src/core/lib/channel/channel_args.h +0 -1
- data/src/core/lib/channel/channel_trace.cc +4 -2
- data/src/core/lib/channel/channel_trace.h +1 -1
- data/src/core/lib/channel/channelz.cc +37 -74
- data/src/core/lib/channel/channelz.h +14 -23
- data/src/core/lib/channel/channelz_registry.cc +15 -12
- data/src/core/lib/channel/channelz_registry.h +3 -1
- data/src/core/lib/channel/handshaker.cc +2 -2
- data/src/core/lib/channel/handshaker.h +2 -2
- data/src/core/lib/compression/compression.cc +8 -4
- data/src/core/lib/compression/compression_args.cc +3 -2
- data/src/core/lib/compression/compression_internal.cc +10 -5
- data/src/core/lib/compression/compression_internal.h +2 -1
- data/src/core/lib/compression/stream_compression_identity.cc +1 -3
- data/src/core/lib/debug/stats.h +2 -2
- data/src/core/lib/debug/stats_data.cc +1 -0
- data/src/core/lib/debug/stats_data.h +13 -13
- data/src/core/lib/gpr/alloc.cc +3 -2
- data/src/core/lib/gpr/cpu_iphone.cc +10 -2
- data/src/core/lib/gpr/log.cc +53 -16
- data/src/core/lib/gpr/log_linux.cc +19 -3
- data/src/core/lib/gpr/log_posix.cc +15 -1
- data/src/core/lib/gpr/log_windows.cc +18 -4
- data/src/core/lib/gpr/murmur_hash.cc +1 -1
- data/src/core/lib/gpr/spinlock.h +10 -2
- data/src/core/lib/gpr/string.cc +23 -22
- data/src/core/lib/gpr/string.h +5 -6
- data/src/core/lib/gpr/sync.cc +4 -4
- data/src/core/lib/gpr/sync_posix.cc +2 -8
- data/src/core/lib/gpr/time.cc +12 -12
- data/src/core/lib/gpr/time_precise.cc +5 -2
- data/src/core/lib/gpr/time_precise.h +6 -2
- data/src/core/lib/gpr/tls.h +4 -0
- data/src/core/lib/gpr/tls_msvc.h +2 -0
- data/src/core/lib/gpr/tls_stdcpp.h +48 -0
- data/src/core/lib/gpr/useful.h +5 -4
- data/src/core/lib/gprpp/arena.h +3 -2
- data/src/core/lib/gprpp/dual_ref_counted.h +331 -0
- data/src/core/lib/gprpp/examine_stack.cc +43 -0
- data/src/core/lib/gprpp/examine_stack.h +46 -0
- data/src/core/lib/gprpp/fork.cc +2 -2
- data/src/core/lib/gprpp/manual_constructor.h +1 -1
- data/src/core/lib/gprpp/orphanable.h +4 -8
- data/src/core/lib/gprpp/ref_counted.h +91 -68
- data/src/core/lib/gprpp/ref_counted_ptr.h +166 -7
- data/src/core/lib/gprpp/stat.h +38 -0
- data/src/core/lib/gprpp/stat_posix.cc +49 -0
- data/src/core/lib/gprpp/stat_windows.cc +48 -0
- data/src/core/lib/gprpp/thd.h +2 -2
- data/src/core/lib/gprpp/thd_posix.cc +42 -37
- data/src/core/lib/gprpp/thd_windows.cc +3 -1
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +1 -1
- data/src/core/lib/http/parser.cc +47 -27
- data/src/core/lib/iomgr/call_combiner.cc +8 -5
- data/src/core/lib/iomgr/combiner.cc +2 -1
- data/src/core/lib/iomgr/endpoint.cc +5 -1
- data/src/core/lib/iomgr/endpoint.h +8 -4
- data/src/core/lib/iomgr/endpoint_cfstream.cc +36 -11
- data/src/core/lib/iomgr/error.cc +17 -12
- data/src/core/lib/iomgr/error_internal.h +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -13
- data/src/core/lib/iomgr/ev_epollex_linux.cc +25 -17
- data/src/core/lib/iomgr/ev_poll_posix.cc +9 -7
- data/src/core/lib/iomgr/ev_posix.cc +0 -2
- data/src/core/lib/iomgr/exec_ctx.cc +1 -1
- data/src/core/lib/iomgr/exec_ctx.h +16 -12
- data/src/core/lib/iomgr/executor.cc +2 -1
- data/src/core/lib/iomgr/executor.h +1 -1
- data/src/core/lib/iomgr/executor/mpmcqueue.h +5 -5
- data/src/core/lib/iomgr/executor/threadpool.h +4 -4
- data/src/core/lib/iomgr/iomgr.cc +1 -11
- data/src/core/lib/iomgr/iomgr.h +0 -10
- data/src/core/lib/iomgr/load_file.h +1 -1
- data/src/core/lib/iomgr/lockfree_event.cc +19 -14
- data/src/core/lib/iomgr/lockfree_event.h +2 -2
- data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.cc +128 -44
- data/src/core/lib/iomgr/parse_address.h +77 -0
- data/src/core/lib/iomgr/poller/eventmanager_libuv.cc +2 -1
- data/src/core/lib/iomgr/poller/eventmanager_libuv.h +1 -1
- data/src/core/lib/iomgr/pollset_set_custom.cc +1 -1
- data/src/core/lib/iomgr/python_util.h +4 -4
- data/src/core/lib/iomgr/resolve_address.cc +4 -4
- data/src/core/lib/iomgr/resolve_address_posix.cc +1 -5
- data/src/core/lib/iomgr/resource_quota.cc +4 -4
- data/src/core/lib/iomgr/sockaddr_utils.cc +12 -11
- data/src/core/lib/iomgr/sockaddr_utils.h +3 -2
- data/src/core/lib/iomgr/socket_factory_posix.cc +3 -2
- data/src/core/lib/iomgr/socket_mutator.cc +3 -2
- data/src/core/lib/iomgr/tcp_client.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_custom.cc +7 -6
- data/src/core/lib/iomgr/tcp_custom.cc +53 -32
- data/src/core/lib/iomgr/tcp_posix.cc +43 -21
- data/src/core/lib/iomgr/tcp_server_custom.cc +28 -22
- data/src/core/lib/iomgr/tcp_windows.cc +26 -10
- data/src/core/lib/iomgr/timer_custom.cc +5 -5
- data/src/core/lib/iomgr/timer_generic.cc +3 -3
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/udp_server.cc +1 -2
- data/src/core/lib/iomgr/udp_server.h +1 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +32 -21
- data/src/core/lib/iomgr/unix_sockets_posix.h +5 -0
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +7 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -2
- data/src/core/lib/json/json.h +12 -2
- data/src/core/lib/json/json_reader.cc +8 -4
- data/src/core/lib/json/json_util.cc +58 -0
- data/src/core/lib/json/json_util.h +204 -0
- data/src/core/lib/json/json_writer.cc +2 -1
- data/src/core/lib/security/authorization/authorization_engine.cc +177 -0
- data/src/core/lib/security/authorization/authorization_engine.h +84 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +148 -0
- data/src/core/lib/security/authorization/evaluate_args.h +59 -0
- data/src/core/lib/security/authorization/mock_cel/activation.h +57 -0
- data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +44 -0
- data/src/core/lib/security/authorization/mock_cel/cel_expression.h +69 -0
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +97 -0
- data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +67 -0
- data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +57 -0
- data/src/core/lib/security/context/security_context.cc +4 -3
- data/src/core/lib/security/context/security_context.h +3 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
- data/src/core/lib/security/credentials/credentials.cc +7 -7
- data/src/core/lib/security/credentials/credentials.h +3 -3
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +413 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +80 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +213 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.h +72 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +497 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.h +120 -0
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +135 -0
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +48 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +213 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +58 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +74 -50
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +64 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +6 -3
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +4 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +8 -4
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +39 -46
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +5 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +5 -5
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +346 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +213 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +399 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +138 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +78 -150
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +57 -187
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +16 -12
- data/src/core/lib/security/credentials/tls/tls_credentials.h +2 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +91 -0
- data/src/core/lib/security/credentials/tls/tls_utils.h +38 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +175 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.h +69 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -15
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +121 -0
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +87 -0
- data/src/core/lib/security/security_connector/load_system_roots.h +4 -0
- data/src/core/lib/security/security_connector/load_system_roots_linux.h +2 -0
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +3 -3
- data/src/core/lib/security/security_connector/security_connector.cc +4 -3
- data/src/core/lib/security/security_connector/security_connector.h +4 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -4
- data/src/core/lib/security/security_connector/ssl_utils.cc +2 -2
- data/src/core/lib/security/security_connector/ssl_utils.h +19 -19
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +342 -279
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +105 -61
- data/src/core/lib/security/transport/secure_endpoint.cc +9 -3
- data/src/core/lib/security/transport/security_handshaker.cc +3 -3
- data/src/core/lib/security/transport/server_auth_filter.cc +2 -1
- data/src/core/lib/security/util/json_util.h +1 -0
- data/src/core/lib/slice/slice.cc +7 -4
- data/src/core/lib/slice/slice_buffer.cc +2 -1
- data/src/core/lib/slice/slice_intern.cc +6 -7
- data/src/core/lib/slice/slice_internal.h +2 -2
- data/src/core/lib/surface/call.cc +53 -44
- data/src/core/lib/surface/call.h +2 -1
- data/src/core/lib/surface/call_details.cc +8 -8
- data/src/core/lib/surface/channel.cc +53 -61
- data/src/core/lib/surface/channel.h +21 -5
- data/src/core/lib/surface/channel_init.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +38 -294
- data/src/core/lib/surface/completion_queue.h +16 -24
- data/src/core/lib/surface/init.cc +32 -16
- data/src/core/lib/surface/lame_client.cc +20 -46
- data/src/core/lib/surface/lame_client.h +4 -0
- data/src/core/lib/surface/server.cc +1107 -1239
- data/src/core/lib/surface/server.h +394 -86
- data/src/core/lib/surface/validate_metadata.h +3 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/authority_override.cc +40 -0
- data/src/core/lib/transport/authority_override.h +37 -0
- data/src/core/lib/transport/bdp_estimator.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.h +2 -1
- data/src/core/lib/transport/byte_stream.h +3 -3
- data/src/core/lib/transport/connectivity_state.cc +18 -13
- data/src/core/lib/transport/connectivity_state.h +26 -12
- data/src/core/lib/transport/error_utils.cc +13 -0
- data/src/core/lib/transport/error_utils.h +7 -1
- data/src/core/lib/transport/metadata.cc +11 -1
- data/src/core/lib/transport/metadata.h +2 -2
- data/src/core/lib/transport/metadata_batch.h +4 -4
- data/src/core/lib/transport/static_metadata.cc +296 -277
- data/src/core/lib/transport/static_metadata.h +80 -73
- data/src/core/lib/transport/status_metadata.cc +4 -3
- data/src/core/lib/transport/timeout_encoding.cc +4 -4
- data/src/core/lib/transport/transport.cc +5 -3
- data/src/core/lib/transport/transport.h +15 -8
- data/src/core/lib/uri/uri_parser.cc +131 -247
- data/src/core/lib/uri/uri_parser.h +58 -20
- data/src/core/plugin_registry/grpc_plugin_registry.cc +41 -20
- data/src/core/tsi/alts/crypt/gsec.cc +5 -4
- data/src/core/tsi/alts/frame_protector/frame_handler.cc +8 -6
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +49 -26
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +8 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +4 -4
- data/src/core/tsi/fake_transport_security.cc +6 -3
- data/src/core/tsi/local_transport_security.cc +5 -1
- data/src/core/tsi/local_transport_security.h +6 -7
- data/src/core/tsi/ssl/session_cache/ssl_session.h +3 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -1
- data/src/core/tsi/ssl_transport_security.cc +81 -67
- data/src/core/tsi/ssl_transport_security.h +9 -6
- data/src/core/tsi/transport_security.cc +10 -8
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.c +9 -0
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +38 -18
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +74 -44
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +28 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +18 -0
- data/src/ruby/spec/channel_credentials_spec.rb +10 -0
- data/src/ruby/spec/generic/active_call_spec.rb +19 -8
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -6
- data/third_party/abseil-cpp/absl/algorithm/container.h +1764 -0
- data/third_party/abseil-cpp/absl/base/attributes.h +99 -38
- data/third_party/abseil-cpp/absl/base/call_once.h +1 -1
- data/third_party/abseil-cpp/absl/base/casts.h +9 -6
- data/third_party/abseil-cpp/absl/base/config.h +60 -17
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +428 -335
- data/third_party/abseil-cpp/absl/base/internal/bits.h +17 -16
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +166 -0
- data/third_party/abseil-cpp/absl/base/internal/dynamic_annotations.h +398 -0
- data/third_party/abseil-cpp/absl/base/internal/exponential_biased.cc +93 -0
- data/third_party/abseil-cpp/absl/base/internal/exponential_biased.h +130 -0
- data/third_party/abseil-cpp/absl/base/internal/invoke.h +4 -4
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +620 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +126 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +29 -1
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +2 -2
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +7 -5
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +25 -38
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +19 -25
- data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +8 -0
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +28 -5
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.h +8 -0
- data/third_party/abseil-cpp/absl/base/internal/tsan_mutex_interface.h +3 -1
- data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +2 -2
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +3 -3
- data/third_party/abseil-cpp/absl/base/macros.h +36 -109
- data/third_party/abseil-cpp/absl/base/optimization.h +61 -1
- data/third_party/abseil-cpp/absl/base/options.h +31 -4
- data/third_party/abseil-cpp/absl/base/policy_checks.h +1 -1
- data/third_party/abseil-cpp/absl/base/thread_annotations.h +94 -39
- data/third_party/abseil-cpp/absl/container/fixed_array.h +532 -0
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +606 -0
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +504 -0
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +33 -36
- data/third_party/abseil-cpp/absl/container/internal/common.h +206 -0
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +33 -8
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +460 -0
- data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +161 -0
- data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +208 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h +85 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +270 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +321 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +30 -0
- data/third_party/abseil-cpp/absl/container/internal/have_sse.h +50 -0
- data/third_party/abseil-cpp/absl/container/internal/layout.h +743 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +197 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +48 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1903 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +139 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h +32 -0
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +1945 -0
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +71 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +382 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +134 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +196 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +134 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +89 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +108 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +248 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +24 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +93 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +346 -0
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +149 -0
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +173 -0
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.h +158 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +140 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.h +231 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize.cc +36 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize.h +99 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +101 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +1560 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +40 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +81 -0
- data/third_party/abseil-cpp/absl/functional/bind_front.h +184 -0
- data/third_party/abseil-cpp/absl/functional/function_ref.h +139 -0
- data/third_party/abseil-cpp/absl/functional/internal/front_binder.h +95 -0
- data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +106 -0
- data/third_party/abseil-cpp/absl/hash/hash.h +325 -0
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +346 -0
- data/third_party/abseil-cpp/absl/hash/internal/city.h +96 -0
- data/third_party/abseil-cpp/absl/hash/internal/hash.cc +55 -0
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +996 -0
- data/third_party/abseil-cpp/absl/memory/memory.h +4 -0
- data/third_party/abseil-cpp/absl/meta/type_traits.h +2 -8
- data/third_party/abseil-cpp/absl/numeric/int128.cc +13 -27
- data/third_party/abseil-cpp/absl/numeric/int128.h +16 -15
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +51 -0
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +399 -0
- data/third_party/abseil-cpp/absl/status/status.cc +445 -0
- data/third_party/abseil-cpp/absl/status/status.h +817 -0
- data/third_party/abseil-cpp/absl/status/status_payload_printer.cc +38 -0
- data/third_party/abseil-cpp/absl/status/status_payload_printer.h +51 -0
- data/third_party/abseil-cpp/absl/status/statusor.cc +71 -0
- data/third_party/abseil-cpp/absl/status/statusor.h +760 -0
- data/third_party/abseil-cpp/absl/strings/charconv.cc +2 -2
- data/third_party/abseil-cpp/absl/strings/cord.cc +1998 -0
- data/third_party/abseil-cpp/absl/strings/cord.h +1276 -0
- data/third_party/abseil-cpp/absl/strings/escaping.cc +9 -9
- data/third_party/abseil-cpp/absl/strings/internal/char_map.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +173 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +222 -136
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +136 -64
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +14 -21
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +7 -14
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +31 -7
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +147 -135
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +999 -87
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +3 -3
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +4 -12
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +8 -6
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +13 -11
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +2 -2
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +4 -4
- data/third_party/abseil-cpp/absl/strings/str_cat.h +1 -1
- data/third_party/abseil-cpp/absl/strings/str_format.h +289 -13
- data/third_party/abseil-cpp/absl/strings/str_split.cc +2 -2
- data/third_party/abseil-cpp/absl/strings/str_split.h +1 -0
- data/third_party/abseil-cpp/absl/strings/string_view.h +26 -19
- data/third_party/abseil-cpp/absl/strings/substitute.cc +5 -5
- data/third_party/abseil-cpp/absl/strings/substitute.h +32 -29
- data/third_party/abseil-cpp/absl/synchronization/barrier.cc +52 -0
- data/third_party/abseil-cpp/absl/synchronization/barrier.h +79 -0
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +57 -0
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +99 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +140 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h +60 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +697 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h +141 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +155 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc +249 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +106 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +115 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +492 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +159 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +2739 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +1065 -0
- data/third_party/abseil-cpp/absl/synchronization/notification.cc +78 -0
- data/third_party/abseil-cpp/absl/synchronization/notification.h +123 -0
- data/third_party/abseil-cpp/absl/time/civil_time.cc +9 -9
- data/third_party/abseil-cpp/absl/time/clock.cc +3 -3
- data/third_party/abseil-cpp/absl/time/duration.cc +90 -59
- data/third_party/abseil-cpp/absl/time/format.cc +43 -36
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +26 -16
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +4 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +136 -29
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +13 -21
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +136 -129
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +4 -5
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +8 -7
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +6 -6
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +2 -1
- data/third_party/abseil-cpp/absl/time/time.h +15 -16
- data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +64 -0
- data/third_party/abseil-cpp/absl/types/bad_variant_access.h +82 -0
- data/third_party/abseil-cpp/absl/types/internal/variant.h +1646 -0
- data/third_party/abseil-cpp/absl/types/optional.h +9 -9
- data/third_party/abseil-cpp/absl/types/span.h +49 -36
- data/third_party/abseil-cpp/absl/types/variant.h +861 -0
- data/third_party/abseil-cpp/absl/utility/utility.h +2 -2
- data/third_party/address_sorting/include/address_sorting/address_sorting.h +2 -0
- data/third_party/boringssl-with-bazel/err_data.c +479 -467
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +0 -6
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +9 -43
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa_asn1.c +55 -4
- data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +34 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.c +6 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +173 -35
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +30 -10
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +56 -22
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +8 -2
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +543 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +237 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +118 -49
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +267 -95
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +210 -34
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +766 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +6 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +7 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +21 -18
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +24 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_txt.c +67 -67
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +29 -35
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +13 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +10 -10
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +28 -40
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +20 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/ext_dat.h +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +5 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +14 -14
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +55 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +24 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +54 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +0 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +6 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/des.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +12 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +9 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +4 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +3 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +202 -134
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +103 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +5 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +42 -14
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +199 -78
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +482 -432
- data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +18 -5
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +35 -0
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +18 -18
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +49 -10
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +42 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +3 -6
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +8 -9
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +77 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +11 -14
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +250 -20
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -2
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +57 -19
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +140 -41
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +5 -3
- data/third_party/upb/third_party/wyhash/wyhash.h +145 -0
- data/third_party/upb/upb/decode.c +275 -145
- data/third_party/upb/upb/decode.h +20 -1
- data/third_party/upb/upb/decode.int.h +163 -0
- data/third_party/upb/upb/decode_fast.c +1040 -0
- data/third_party/upb/upb/decode_fast.h +126 -0
- data/third_party/upb/upb/def.c +2178 -0
- data/third_party/upb/upb/def.h +315 -0
- data/third_party/upb/upb/def.hpp +439 -0
- data/third_party/upb/upb/encode.c +229 -171
- data/third_party/upb/upb/encode.h +27 -2
- data/third_party/upb/upb/json_decode.c +1443 -0
- data/third_party/upb/upb/json_decode.h +23 -0
- data/third_party/upb/upb/json_encode.c +713 -0
- data/third_party/upb/upb/json_encode.h +36 -0
- data/third_party/upb/upb/msg.c +167 -88
- data/third_party/upb/upb/msg.h +175 -35
- data/third_party/upb/upb/port_def.inc +75 -62
- data/third_party/upb/upb/port_undef.inc +3 -7
- data/third_party/upb/upb/reflection.c +408 -0
- data/third_party/upb/upb/reflection.h +168 -0
- data/third_party/upb/upb/table.c +34 -208
- data/third_party/upb/upb/table.int.h +14 -14
- data/third_party/upb/upb/text_encode.c +421 -0
- data/third_party/upb/upb/text_encode.h +38 -0
- data/third_party/upb/upb/upb.c +33 -54
- data/third_party/upb/upb/upb.h +56 -1
- data/third_party/upb/upb/upb.hpp +6 -4
- data/third_party/upb/upb/upb.int.h +29 -0
- metadata +508 -172
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +0 -938
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +0 -528
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +0 -1143
- data/src/core/ext/filters/client_channel/parse_address.h +0 -53
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +0 -485
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +0 -68
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +0 -353
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +0 -142
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +0 -2110
- data/src/core/ext/filters/client_channel/xds/xds_api.h +0 -345
- data/src/core/ext/filters/client_channel/xds/xds_channel.h +0 -46
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +0 -106
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -21
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -34
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +0 -114
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +0 -429
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +0 -72
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +0 -198
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +0 -105
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +0 -388
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +0 -403
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +0 -1453
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -74
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +0 -226
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +0 -35
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +0 -69
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +0 -55
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +0 -323
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +0 -334
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +0 -35
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +0 -79
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +0 -313
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +0 -891
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +0 -96
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +0 -328
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +0 -34
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +0 -71
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +0 -197
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +0 -649
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +0 -172
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +0 -693
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +0 -36
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +0 -80
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +0 -152
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +0 -536
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +0 -88
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -129
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +0 -386
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +0 -92
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +0 -224
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +0 -91
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +0 -273
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +0 -332
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +0 -109
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +0 -415
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +0 -145
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +0 -538
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +0 -43
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +0 -111
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +0 -63
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +0 -204
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +0 -815
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +0 -2984
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +0 -59
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +0 -135
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +0 -228
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +0 -732
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +0 -316
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +0 -1167
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +0 -33
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +0 -65
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +0 -51
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +0 -125
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +0 -49
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +0 -54
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +0 -136
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +0 -63
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +0 -145
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +0 -53
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +0 -133
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +0 -88
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +0 -258
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +0 -39
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +0 -86
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +0 -50
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +0 -111
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +0 -61
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +0 -89
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +0 -250
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +0 -17
- data/src/core/lib/gprpp/map.h +0 -53
- data/src/core/lib/security/transport/target_authority_table.cc +0 -75
- data/src/core/lib/security/transport/target_authority_table.h +0 -40
- data/src/core/lib/slice/slice_hash_table.h +0 -199
- data/src/core/lib/slice/slice_weak_hash_table.h +0 -102
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.cc +0 -129
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pku.c +0 -110
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_sxnet.c +0 -274
- data/third_party/upb/upb/port.c +0 -26
@@ -95,15 +95,14 @@ class TimeZoneInfo : public TimeZoneIf {
|
|
95
95
|
std::size_t DataLength(std::size_t time_len) const;
|
96
96
|
};
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
const std::string& abbr) const;
|
98
|
+
bool GetTransitionType(std::int_fast32_t utc_offset, bool is_dst,
|
99
|
+
const std::string& abbr, std::uint_least8_t* index);
|
101
100
|
bool EquivTransitions(std::uint_fast8_t tt1_index,
|
102
101
|
std::uint_fast8_t tt2_index) const;
|
103
|
-
|
102
|
+
bool ExtendTransitions();
|
104
103
|
|
105
104
|
bool ResetToBuiltinUTC(const seconds& offset);
|
106
|
-
bool Load(
|
105
|
+
bool Load(ZoneInfoSource* zip);
|
107
106
|
|
108
107
|
// Helpers for BreakTime() and MakeTime().
|
109
108
|
time_zone::absolute_lookup LocalTime(std::int_fast64_t unix_time,
|
@@ -153,7 +153,8 @@ std::time_t find_trans(std::time_t lo, std::time_t hi, int offset) {
|
|
153
153
|
std::tm tm;
|
154
154
|
while (lo + 1 != hi) {
|
155
155
|
const std::time_t mid = lo + (hi - lo) / 2;
|
156
|
-
|
156
|
+
std::tm* tmp = local_time(&mid, &tm);
|
157
|
+
if (tmp != nullptr) {
|
157
158
|
if (tm_gmtoff(*tmp) == offset) {
|
158
159
|
hi = mid;
|
159
160
|
} else {
|
@@ -163,7 +164,8 @@ std::time_t find_trans(std::time_t lo, std::time_t hi, int offset) {
|
|
163
164
|
// If std::tm cannot hold some result we resort to a linear search,
|
164
165
|
// ignoring all failed conversions. Slow, but never really happens.
|
165
166
|
while (++lo != hi) {
|
166
|
-
|
167
|
+
tmp = local_time(&lo, &tm);
|
168
|
+
if (tmp != nullptr) {
|
167
169
|
if (tm_gmtoff(*tmp) == offset) break;
|
168
170
|
}
|
169
171
|
}
|
@@ -223,11 +225,10 @@ time_zone::civil_lookup TimeZoneLibC::MakeTime(const civil_second& cs) const {
|
|
223
225
|
civil_second() + ToUnixSeconds(time_point<seconds>::min());
|
224
226
|
static const civil_second max_tp_cs =
|
225
227
|
civil_second() + ToUnixSeconds(time_point<seconds>::max());
|
226
|
-
const time_point<seconds> tp =
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
: FromUnixSeconds(cs - civil_second());
|
228
|
+
const time_point<seconds> tp = (cs < min_tp_cs) ? time_point<seconds>::min()
|
229
|
+
: (cs > max_tp_cs)
|
230
|
+
? time_point<seconds>::max()
|
231
|
+
: FromUnixSeconds(cs - civil_second());
|
231
232
|
return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
|
232
233
|
}
|
233
234
|
|
@@ -83,13 +83,13 @@ struct tzhead {
|
|
83
83
|
** If tzh_version is '2' or greater, the above is followed by a second instance
|
84
84
|
** of tzhead and a second instance of the data in which each coded transition
|
85
85
|
** time uses 8 rather than 4 chars,
|
86
|
-
** then a POSIX-TZ-environment-variable-style
|
86
|
+
** then a POSIX-TZ-environment-variable-style string for use in handling
|
87
87
|
** instants after the last transition time stored in the file
|
88
88
|
** (with nothing between the newlines if there is no POSIX representation for
|
89
89
|
** such instants).
|
90
90
|
**
|
91
91
|
** If tz_version is '3' or greater, the above is extended as follows.
|
92
|
-
** First, the POSIX TZ
|
92
|
+
** First, the POSIX TZ string's hour offset may range from -167
|
93
93
|
** through 167 as compared to the POSIX-required 0 through 24.
|
94
94
|
** Second, its DST start time may be January 1 at 00:00 and its stop
|
95
95
|
** time December 31 at 24:00 plus the difference between DST and
|
@@ -108,15 +108,15 @@ struct tzhead {
|
|
108
108
|
#ifndef TZ_MAX_TYPES
|
109
109
|
/* This must be at least 17 for Europe/Samara and Europe/Vilnius. */
|
110
110
|
#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
|
111
|
-
#endif
|
111
|
+
#endif /* !defined TZ_MAX_TYPES */
|
112
112
|
|
113
113
|
#ifndef TZ_MAX_CHARS
|
114
114
|
#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
|
115
|
-
|
116
|
-
#endif
|
115
|
+
/* (limited by what unsigned chars can hold) */
|
116
|
+
#endif /* !defined TZ_MAX_CHARS */
|
117
117
|
|
118
118
|
#ifndef TZ_MAX_LEAPS
|
119
119
|
#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
|
120
|
-
#endif
|
120
|
+
#endif /* !defined TZ_MAX_LEAPS */
|
121
121
|
|
122
122
|
#endif /* !defined TZFILE_H */
|
@@ -83,7 +83,8 @@ ZoneInfoSourceFactory default_factory = DefaultFactory;
|
|
83
83
|
"@@U?$default_delete@VZoneInfoSource@cctz@time_internal@" ABSL_INTERNAL_MANGLED_NS \
|
84
84
|
"@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z@" ABSL_INTERNAL_MANGLED_BACKREFERENCE \
|
85
85
|
"@@ZA")
|
86
|
-
#elif defined(_M_IA_64) || defined(_M_AMD64) || defined(
|
86
|
+
#elif defined(_M_IA_64) || defined(_M_AMD64) || defined(_M_ARM) || \
|
87
|
+
defined(_M_ARM64)
|
87
88
|
#pragma comment( \
|
88
89
|
linker, \
|
89
90
|
"/alternatename:?zone_info_source_factory@cctz_extension@time_internal@" ABSL_INTERNAL_MANGLED_NS \
|
@@ -545,7 +545,7 @@ inline std::ostream& operator<<(std::ostream& os, Duration d) {
|
|
545
545
|
// suffix. The valid suffixes are "ns", "us" "ms", "s", "m", and "h".
|
546
546
|
// Simple examples include "300ms", "-1.5h", and "2h45m". Parses "0" as
|
547
547
|
// `ZeroDuration()`. Parses "inf" and "-inf" as +/- `InfiniteDuration()`.
|
548
|
-
bool ParseDuration(
|
548
|
+
bool ParseDuration(absl::string_view dur_string, Duration* d);
|
549
549
|
|
550
550
|
// Support for flag values of type Duration. Duration flags must be specified
|
551
551
|
// in a format that is valid input for absl::ParseDuration().
|
@@ -1021,13 +1021,13 @@ class TimeZone {
|
|
1021
1021
|
// Loads the named zone. May perform I/O on the initial load of the named
|
1022
1022
|
// zone. If the name is invalid, or some other kind of error occurs, returns
|
1023
1023
|
// `false` and `*tz` is set to the UTC time zone.
|
1024
|
-
inline bool LoadTimeZone(
|
1024
|
+
inline bool LoadTimeZone(absl::string_view name, TimeZone* tz) {
|
1025
1025
|
if (name == "localtime") {
|
1026
1026
|
*tz = TimeZone(time_internal::cctz::local_time_zone());
|
1027
1027
|
return true;
|
1028
1028
|
}
|
1029
1029
|
time_internal::cctz::time_zone cz;
|
1030
|
-
const bool b = time_internal::cctz::load_time_zone(name, &cz);
|
1030
|
+
const bool b = time_internal::cctz::load_time_zone(std::string(name), &cz);
|
1031
1031
|
*tz = TimeZone(cz);
|
1032
1032
|
return b;
|
1033
1033
|
}
|
@@ -1203,18 +1203,15 @@ struct tm ToTM(Time t, TimeZone tz);
|
|
1203
1203
|
// time with UTC offset. Also note the use of "%Y": RFC3339 mandates that
|
1204
1204
|
// years have exactly four digits, but we allow them to take their natural
|
1205
1205
|
// width.
|
1206
|
-
ABSL_DLL extern const char
|
1207
|
-
|
1208
|
-
ABSL_DLL extern const char RFC3339_sec[]; // %Y-%m-%dT%H:%M:%S%Ez
|
1206
|
+
ABSL_DLL extern const char RFC3339_full[]; // %Y-%m-%d%ET%H:%M:%E*S%Ez
|
1207
|
+
ABSL_DLL extern const char RFC3339_sec[]; // %Y-%m-%d%ET%H:%M:%S%Ez
|
1209
1208
|
|
1210
1209
|
// RFC1123_full
|
1211
1210
|
// RFC1123_no_wday
|
1212
1211
|
//
|
1213
1212
|
// FormatTime()/ParseTime() format specifiers for RFC1123 date/time strings.
|
1214
|
-
ABSL_DLL extern const char
|
1215
|
-
|
1216
|
-
ABSL_DLL extern const char
|
1217
|
-
RFC1123_no_wday[]; // %d %b %E4Y %H:%M:%S %z
|
1213
|
+
ABSL_DLL extern const char RFC1123_full[]; // %a, %d %b %E4Y %H:%M:%S %z
|
1214
|
+
ABSL_DLL extern const char RFC1123_no_wday[]; // %d %b %E4Y %H:%M:%S %z
|
1218
1215
|
|
1219
1216
|
// FormatTime()
|
1220
1217
|
//
|
@@ -1229,6 +1226,7 @@ ABSL_DLL extern const char
|
|
1229
1226
|
// - %E#f - Fractional seconds with # digits of precision
|
1230
1227
|
// - %E*f - Fractional seconds with full precision (a literal '*')
|
1231
1228
|
// - %E4Y - Four-character years (-999 ... -001, 0000, 0001 ... 9999)
|
1229
|
+
// - %ET - The RFC3339 "date-time" separator "T"
|
1232
1230
|
//
|
1233
1231
|
// Note that %E0S behaves like %S, and %E0f produces no characters. In
|
1234
1232
|
// contrast %E*f always produces at least one digit, which may be '0'.
|
@@ -1252,7 +1250,7 @@ ABSL_DLL extern const char
|
|
1252
1250
|
// `absl::InfinitePast()`, the returned string will be exactly "infinite-past".
|
1253
1251
|
// In both cases the given format string and `absl::TimeZone` are ignored.
|
1254
1252
|
//
|
1255
|
-
std::string FormatTime(
|
1253
|
+
std::string FormatTime(absl::string_view format, Time t, TimeZone tz);
|
1256
1254
|
|
1257
1255
|
// Convenience functions that format the given time using the RFC3339_full
|
1258
1256
|
// format. The first overload uses the provided TimeZone, while the second
|
@@ -1271,7 +1269,8 @@ inline std::ostream& operator<<(std::ostream& os, Time t) {
|
|
1271
1269
|
// returns the corresponding `absl::Time`. Uses strftime()-like formatting
|
1272
1270
|
// options, with the same extensions as FormatTime(), but with the
|
1273
1271
|
// exceptions that %E#S is interpreted as %E*S, and %E#f as %E*f. %Ez
|
1274
|
-
// and %E*z also accept the same inputs
|
1272
|
+
// and %E*z also accept the same inputs, which (along with %z) includes
|
1273
|
+
// 'z' and 'Z' as synonyms for +00:00. %ET accepts either 'T' or 't'.
|
1275
1274
|
//
|
1276
1275
|
// %Y consumes as many numeric characters as it can, so the matching data
|
1277
1276
|
// should always be terminated with a non-numeric. %E4Y always consumes
|
@@ -1313,7 +1312,7 @@ inline std::ostream& operator<<(std::ostream& os, Time t) {
|
|
1313
1312
|
// If the input string is "infinite-past", the returned `absl::Time` will be
|
1314
1313
|
// `absl::InfinitePast()` and `true` will be returned.
|
1315
1314
|
//
|
1316
|
-
bool ParseTime(
|
1315
|
+
bool ParseTime(absl::string_view format, absl::string_view input, Time* time,
|
1317
1316
|
std::string* err);
|
1318
1317
|
|
1319
1318
|
// Like ParseTime() above, but if the format string does not contain a UTC
|
@@ -1323,7 +1322,7 @@ bool ParseTime(const std::string& format, const std::string& input, Time* time,
|
|
1323
1322
|
// of ambiguity or non-existence, in which case the "pre" time (as defined
|
1324
1323
|
// by TimeZone::TimeInfo) is returned. For these reasons we recommend that
|
1325
1324
|
// all date/time strings include a UTC offset so they're context independent.
|
1326
|
-
bool ParseTime(
|
1325
|
+
bool ParseTime(absl::string_view format, absl::string_view input, TimeZone tz,
|
1327
1326
|
Time* time, std::string* err);
|
1328
1327
|
|
1329
1328
|
// ============================================================================
|
@@ -1348,8 +1347,8 @@ constexpr Duration MakeDuration(int64_t hi, int64_t lo) {
|
|
1348
1347
|
// it's positive and can be converted to int64_t without risk of UB.
|
1349
1348
|
inline Duration MakePosDoubleDuration(double n) {
|
1350
1349
|
const int64_t int_secs = static_cast<int64_t>(n);
|
1351
|
-
const uint32_t ticks =
|
1352
|
-
|
1350
|
+
const uint32_t ticks = static_cast<uint32_t>(
|
1351
|
+
(n - static_cast<double>(int_secs)) * kTicksPerSecond + 0.5);
|
1353
1352
|
return ticks < kTicksPerSecond
|
1354
1353
|
? MakeDuration(int_secs, ticks)
|
1355
1354
|
: MakeDuration(int_secs + 1, ticks - kTicksPerSecond);
|
@@ -0,0 +1,64 @@
|
|
1
|
+
// Copyright 2017 The Abseil Authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#include "absl/types/bad_variant_access.h"
|
16
|
+
|
17
|
+
#ifndef ABSL_USES_STD_VARIANT
|
18
|
+
|
19
|
+
#include <cstdlib>
|
20
|
+
#include <stdexcept>
|
21
|
+
|
22
|
+
#include "absl/base/config.h"
|
23
|
+
#include "absl/base/internal/raw_logging.h"
|
24
|
+
|
25
|
+
namespace absl {
|
26
|
+
ABSL_NAMESPACE_BEGIN
|
27
|
+
|
28
|
+
//////////////////////////
|
29
|
+
// [variant.bad.access] //
|
30
|
+
//////////////////////////
|
31
|
+
|
32
|
+
bad_variant_access::~bad_variant_access() = default;
|
33
|
+
|
34
|
+
const char* bad_variant_access::what() const noexcept {
|
35
|
+
return "Bad variant access";
|
36
|
+
}
|
37
|
+
|
38
|
+
namespace variant_internal {
|
39
|
+
|
40
|
+
void ThrowBadVariantAccess() {
|
41
|
+
#ifdef ABSL_HAVE_EXCEPTIONS
|
42
|
+
throw bad_variant_access();
|
43
|
+
#else
|
44
|
+
ABSL_RAW_LOG(FATAL, "Bad variant access");
|
45
|
+
abort(); // TODO(calabrese) Remove once RAW_LOG FATAL is noreturn.
|
46
|
+
#endif
|
47
|
+
}
|
48
|
+
|
49
|
+
void Rethrow() {
|
50
|
+
#ifdef ABSL_HAVE_EXCEPTIONS
|
51
|
+
throw;
|
52
|
+
#else
|
53
|
+
ABSL_RAW_LOG(FATAL,
|
54
|
+
"Internal error in absl::variant implementation. Attempted to "
|
55
|
+
"rethrow an exception when building with exceptions disabled.");
|
56
|
+
abort(); // TODO(calabrese) Remove once RAW_LOG FATAL is noreturn.
|
57
|
+
#endif
|
58
|
+
}
|
59
|
+
|
60
|
+
} // namespace variant_internal
|
61
|
+
ABSL_NAMESPACE_END
|
62
|
+
} // namespace absl
|
63
|
+
|
64
|
+
#endif // ABSL_USES_STD_VARIANT
|
@@ -0,0 +1,82 @@
|
|
1
|
+
// Copyright 2018 The Abseil Authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
//
|
15
|
+
// -----------------------------------------------------------------------------
|
16
|
+
// bad_variant_access.h
|
17
|
+
// -----------------------------------------------------------------------------
|
18
|
+
//
|
19
|
+
// This header file defines the `absl::bad_variant_access` type.
|
20
|
+
|
21
|
+
#ifndef ABSL_TYPES_BAD_VARIANT_ACCESS_H_
|
22
|
+
#define ABSL_TYPES_BAD_VARIANT_ACCESS_H_
|
23
|
+
|
24
|
+
#include <stdexcept>
|
25
|
+
|
26
|
+
#include "absl/base/config.h"
|
27
|
+
|
28
|
+
#ifdef ABSL_USES_STD_VARIANT
|
29
|
+
|
30
|
+
#include <variant>
|
31
|
+
|
32
|
+
namespace absl {
|
33
|
+
ABSL_NAMESPACE_BEGIN
|
34
|
+
using std::bad_variant_access;
|
35
|
+
ABSL_NAMESPACE_END
|
36
|
+
} // namespace absl
|
37
|
+
|
38
|
+
#else // ABSL_USES_STD_VARIANT
|
39
|
+
|
40
|
+
namespace absl {
|
41
|
+
ABSL_NAMESPACE_BEGIN
|
42
|
+
|
43
|
+
// -----------------------------------------------------------------------------
|
44
|
+
// bad_variant_access
|
45
|
+
// -----------------------------------------------------------------------------
|
46
|
+
//
|
47
|
+
// An `absl::bad_variant_access` type is an exception type that is thrown in
|
48
|
+
// the following cases:
|
49
|
+
//
|
50
|
+
// * Calling `absl::get(absl::variant) with an index or type that does not
|
51
|
+
// match the currently selected alternative type
|
52
|
+
// * Calling `absl::visit on an `absl::variant` that is in the
|
53
|
+
// `variant::valueless_by_exception` state.
|
54
|
+
//
|
55
|
+
// Example:
|
56
|
+
//
|
57
|
+
// absl::variant<int, std::string> v;
|
58
|
+
// v = 1;
|
59
|
+
// try {
|
60
|
+
// absl::get<std::string>(v);
|
61
|
+
// } catch(const absl::bad_variant_access& e) {
|
62
|
+
// std::cout << "Bad variant access: " << e.what() << '\n';
|
63
|
+
// }
|
64
|
+
class bad_variant_access : public std::exception {
|
65
|
+
public:
|
66
|
+
bad_variant_access() noexcept = default;
|
67
|
+
~bad_variant_access() override;
|
68
|
+
const char* what() const noexcept override;
|
69
|
+
};
|
70
|
+
|
71
|
+
namespace variant_internal {
|
72
|
+
|
73
|
+
[[noreturn]] void ThrowBadVariantAccess();
|
74
|
+
[[noreturn]] void Rethrow();
|
75
|
+
|
76
|
+
} // namespace variant_internal
|
77
|
+
ABSL_NAMESPACE_END
|
78
|
+
} // namespace absl
|
79
|
+
|
80
|
+
#endif // ABSL_USES_STD_VARIANT
|
81
|
+
|
82
|
+
#endif // ABSL_TYPES_BAD_VARIANT_ACCESS_H_
|
@@ -0,0 +1,1646 @@
|
|
1
|
+
// Copyright 2018 The Abseil Authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
//
|
15
|
+
// Implementation details of absl/types/variant.h, pulled into a
|
16
|
+
// separate file to avoid cluttering the top of the API header with
|
17
|
+
// implementation details.
|
18
|
+
|
19
|
+
#ifndef ABSL_TYPES_variant_internal_H_
|
20
|
+
#define ABSL_TYPES_variant_internal_H_
|
21
|
+
|
22
|
+
#include <cassert>
|
23
|
+
#include <cstddef>
|
24
|
+
#include <cstdlib>
|
25
|
+
#include <memory>
|
26
|
+
#include <stdexcept>
|
27
|
+
#include <tuple>
|
28
|
+
#include <type_traits>
|
29
|
+
|
30
|
+
#include "absl/base/config.h"
|
31
|
+
#include "absl/base/internal/identity.h"
|
32
|
+
#include "absl/base/internal/inline_variable.h"
|
33
|
+
#include "absl/base/internal/invoke.h"
|
34
|
+
#include "absl/base/macros.h"
|
35
|
+
#include "absl/base/optimization.h"
|
36
|
+
#include "absl/meta/type_traits.h"
|
37
|
+
#include "absl/types/bad_variant_access.h"
|
38
|
+
#include "absl/utility/utility.h"
|
39
|
+
|
40
|
+
#if !defined(ABSL_USES_STD_VARIANT)
|
41
|
+
|
42
|
+
namespace absl {
|
43
|
+
ABSL_NAMESPACE_BEGIN
|
44
|
+
|
45
|
+
template <class... Types>
|
46
|
+
class variant;
|
47
|
+
|
48
|
+
ABSL_INTERNAL_INLINE_CONSTEXPR(size_t, variant_npos, -1);
|
49
|
+
|
50
|
+
template <class T>
|
51
|
+
struct variant_size;
|
52
|
+
|
53
|
+
template <std::size_t I, class T>
|
54
|
+
struct variant_alternative;
|
55
|
+
|
56
|
+
namespace variant_internal {
|
57
|
+
|
58
|
+
// NOTE: See specializations below for details.
|
59
|
+
template <std::size_t I, class T>
|
60
|
+
struct VariantAlternativeSfinae {};
|
61
|
+
|
62
|
+
// Requires: I < variant_size_v<T>.
|
63
|
+
//
|
64
|
+
// Value: The Ith type of Types...
|
65
|
+
template <std::size_t I, class T0, class... Tn>
|
66
|
+
struct VariantAlternativeSfinae<I, variant<T0, Tn...>>
|
67
|
+
: VariantAlternativeSfinae<I - 1, variant<Tn...>> {};
|
68
|
+
|
69
|
+
// Value: T0
|
70
|
+
template <class T0, class... Ts>
|
71
|
+
struct VariantAlternativeSfinae<0, variant<T0, Ts...>> {
|
72
|
+
using type = T0;
|
73
|
+
};
|
74
|
+
|
75
|
+
template <std::size_t I, class T>
|
76
|
+
using VariantAlternativeSfinaeT = typename VariantAlternativeSfinae<I, T>::type;
|
77
|
+
|
78
|
+
// NOTE: Requires T to be a reference type.
|
79
|
+
template <class T, class U>
|
80
|
+
struct GiveQualsTo;
|
81
|
+
|
82
|
+
template <class T, class U>
|
83
|
+
struct GiveQualsTo<T&, U> {
|
84
|
+
using type = U&;
|
85
|
+
};
|
86
|
+
|
87
|
+
template <class T, class U>
|
88
|
+
struct GiveQualsTo<T&&, U> {
|
89
|
+
using type = U&&;
|
90
|
+
};
|
91
|
+
|
92
|
+
template <class T, class U>
|
93
|
+
struct GiveQualsTo<const T&, U> {
|
94
|
+
using type = const U&;
|
95
|
+
};
|
96
|
+
|
97
|
+
template <class T, class U>
|
98
|
+
struct GiveQualsTo<const T&&, U> {
|
99
|
+
using type = const U&&;
|
100
|
+
};
|
101
|
+
|
102
|
+
template <class T, class U>
|
103
|
+
struct GiveQualsTo<volatile T&, U> {
|
104
|
+
using type = volatile U&;
|
105
|
+
};
|
106
|
+
|
107
|
+
template <class T, class U>
|
108
|
+
struct GiveQualsTo<volatile T&&, U> {
|
109
|
+
using type = volatile U&&;
|
110
|
+
};
|
111
|
+
|
112
|
+
template <class T, class U>
|
113
|
+
struct GiveQualsTo<volatile const T&, U> {
|
114
|
+
using type = volatile const U&;
|
115
|
+
};
|
116
|
+
|
117
|
+
template <class T, class U>
|
118
|
+
struct GiveQualsTo<volatile const T&&, U> {
|
119
|
+
using type = volatile const U&&;
|
120
|
+
};
|
121
|
+
|
122
|
+
template <class T, class U>
|
123
|
+
using GiveQualsToT = typename GiveQualsTo<T, U>::type;
|
124
|
+
|
125
|
+
// Convenience alias, since size_t integral_constant is used a lot in this file.
|
126
|
+
template <std::size_t I>
|
127
|
+
using SizeT = std::integral_constant<std::size_t, I>;
|
128
|
+
|
129
|
+
using NPos = SizeT<variant_npos>;
|
130
|
+
|
131
|
+
template <class Variant, class T, class = void>
|
132
|
+
struct IndexOfConstructedType {};
|
133
|
+
|
134
|
+
template <std::size_t I, class Variant>
|
135
|
+
struct VariantAccessResultImpl;
|
136
|
+
|
137
|
+
template <std::size_t I, template <class...> class Variantemplate, class... T>
|
138
|
+
struct VariantAccessResultImpl<I, Variantemplate<T...>&> {
|
139
|
+
using type = typename absl::variant_alternative<I, variant<T...>>::type&;
|
140
|
+
};
|
141
|
+
|
142
|
+
template <std::size_t I, template <class...> class Variantemplate, class... T>
|
143
|
+
struct VariantAccessResultImpl<I, const Variantemplate<T...>&> {
|
144
|
+
using type =
|
145
|
+
const typename absl::variant_alternative<I, variant<T...>>::type&;
|
146
|
+
};
|
147
|
+
|
148
|
+
template <std::size_t I, template <class...> class Variantemplate, class... T>
|
149
|
+
struct VariantAccessResultImpl<I, Variantemplate<T...>&&> {
|
150
|
+
using type = typename absl::variant_alternative<I, variant<T...>>::type&&;
|
151
|
+
};
|
152
|
+
|
153
|
+
template <std::size_t I, template <class...> class Variantemplate, class... T>
|
154
|
+
struct VariantAccessResultImpl<I, const Variantemplate<T...>&&> {
|
155
|
+
using type =
|
156
|
+
const typename absl::variant_alternative<I, variant<T...>>::type&&;
|
157
|
+
};
|
158
|
+
|
159
|
+
template <std::size_t I, class Variant>
|
160
|
+
using VariantAccessResult =
|
161
|
+
typename VariantAccessResultImpl<I, Variant&&>::type;
|
162
|
+
|
163
|
+
// NOTE: This is used instead of std::array to reduce instantiation overhead.
|
164
|
+
template <class T, std::size_t Size>
|
165
|
+
struct SimpleArray {
|
166
|
+
static_assert(Size != 0, "");
|
167
|
+
T value[Size];
|
168
|
+
};
|
169
|
+
|
170
|
+
template <class T>
|
171
|
+
struct AccessedType {
|
172
|
+
using type = T;
|
173
|
+
};
|
174
|
+
|
175
|
+
template <class T>
|
176
|
+
using AccessedTypeT = typename AccessedType<T>::type;
|
177
|
+
|
178
|
+
template <class T, std::size_t Size>
|
179
|
+
struct AccessedType<SimpleArray<T, Size>> {
|
180
|
+
using type = AccessedTypeT<T>;
|
181
|
+
};
|
182
|
+
|
183
|
+
template <class T>
|
184
|
+
constexpr T AccessSimpleArray(const T& value) {
|
185
|
+
return value;
|
186
|
+
}
|
187
|
+
|
188
|
+
template <class T, std::size_t Size, class... SizeT>
|
189
|
+
constexpr AccessedTypeT<T> AccessSimpleArray(const SimpleArray<T, Size>& table,
|
190
|
+
std::size_t head_index,
|
191
|
+
SizeT... tail_indices) {
|
192
|
+
return AccessSimpleArray(table.value[head_index], tail_indices...);
|
193
|
+
}
|
194
|
+
|
195
|
+
// Note: Intentionally is an alias.
|
196
|
+
template <class T>
|
197
|
+
using AlwaysZero = SizeT<0>;
|
198
|
+
|
199
|
+
template <class Op, class... Vs>
|
200
|
+
struct VisitIndicesResultImpl {
|
201
|
+
using type = absl::result_of_t<Op(AlwaysZero<Vs>...)>;
|
202
|
+
};
|
203
|
+
|
204
|
+
template <class Op, class... Vs>
|
205
|
+
using VisitIndicesResultT = typename VisitIndicesResultImpl<Op, Vs...>::type;
|
206
|
+
|
207
|
+
template <class ReturnType, class FunctionObject, class EndIndices,
|
208
|
+
class BoundIndices>
|
209
|
+
struct MakeVisitationMatrix;
|
210
|
+
|
211
|
+
template <class ReturnType, class FunctionObject, std::size_t... Indices>
|
212
|
+
constexpr ReturnType call_with_indices(FunctionObject&& function) {
|
213
|
+
static_assert(
|
214
|
+
std::is_same<ReturnType, decltype(std::declval<FunctionObject>()(
|
215
|
+
SizeT<Indices>()...))>::value,
|
216
|
+
"Not all visitation overloads have the same return type.");
|
217
|
+
return absl::forward<FunctionObject>(function)(SizeT<Indices>()...);
|
218
|
+
}
|
219
|
+
|
220
|
+
template <class ReturnType, class FunctionObject, std::size_t... BoundIndices>
|
221
|
+
struct MakeVisitationMatrix<ReturnType, FunctionObject, index_sequence<>,
|
222
|
+
index_sequence<BoundIndices...>> {
|
223
|
+
using ResultType = ReturnType (*)(FunctionObject&&);
|
224
|
+
static constexpr ResultType Run() {
|
225
|
+
return &call_with_indices<ReturnType, FunctionObject,
|
226
|
+
(BoundIndices - 1)...>;
|
227
|
+
}
|
228
|
+
};
|
229
|
+
|
230
|
+
template <typename Is, std::size_t J>
|
231
|
+
struct AppendToIndexSequence;
|
232
|
+
|
233
|
+
template <typename Is, std::size_t J>
|
234
|
+
using AppendToIndexSequenceT = typename AppendToIndexSequence<Is, J>::type;
|
235
|
+
|
236
|
+
template <std::size_t... Is, std::size_t J>
|
237
|
+
struct AppendToIndexSequence<index_sequence<Is...>, J> {
|
238
|
+
using type = index_sequence<Is..., J>;
|
239
|
+
};
|
240
|
+
|
241
|
+
template <class ReturnType, class FunctionObject, class EndIndices,
|
242
|
+
class CurrIndices, class BoundIndices>
|
243
|
+
struct MakeVisitationMatrixImpl;
|
244
|
+
|
245
|
+
template <class ReturnType, class FunctionObject, class EndIndices,
|
246
|
+
std::size_t... CurrIndices, class BoundIndices>
|
247
|
+
struct MakeVisitationMatrixImpl<ReturnType, FunctionObject, EndIndices,
|
248
|
+
index_sequence<CurrIndices...>, BoundIndices> {
|
249
|
+
using ResultType = SimpleArray<
|
250
|
+
typename MakeVisitationMatrix<ReturnType, FunctionObject, EndIndices,
|
251
|
+
index_sequence<>>::ResultType,
|
252
|
+
sizeof...(CurrIndices)>;
|
253
|
+
|
254
|
+
static constexpr ResultType Run() {
|
255
|
+
return {{MakeVisitationMatrix<
|
256
|
+
ReturnType, FunctionObject, EndIndices,
|
257
|
+
AppendToIndexSequenceT<BoundIndices, CurrIndices>>::Run()...}};
|
258
|
+
}
|
259
|
+
};
|
260
|
+
|
261
|
+
template <class ReturnType, class FunctionObject, std::size_t HeadEndIndex,
|
262
|
+
std::size_t... TailEndIndices, std::size_t... BoundIndices>
|
263
|
+
struct MakeVisitationMatrix<ReturnType, FunctionObject,
|
264
|
+
index_sequence<HeadEndIndex, TailEndIndices...>,
|
265
|
+
index_sequence<BoundIndices...>>
|
266
|
+
: MakeVisitationMatrixImpl<ReturnType, FunctionObject,
|
267
|
+
index_sequence<TailEndIndices...>,
|
268
|
+
absl::make_index_sequence<HeadEndIndex>,
|
269
|
+
index_sequence<BoundIndices...>> {};
|
270
|
+
|
271
|
+
struct UnreachableSwitchCase {
|
272
|
+
template <class Op>
|
273
|
+
[[noreturn]] static VisitIndicesResultT<Op, std::size_t> Run(
|
274
|
+
Op&& /*ignored*/) {
|
275
|
+
#if ABSL_HAVE_BUILTIN(__builtin_unreachable) || \
|
276
|
+
(defined(__GNUC__) && !defined(__clang__))
|
277
|
+
__builtin_unreachable();
|
278
|
+
#elif defined(_MSC_VER)
|
279
|
+
__assume(false);
|
280
|
+
#else
|
281
|
+
// Try to use assert of false being identified as an unreachable intrinsic.
|
282
|
+
// NOTE: We use assert directly to increase chances of exploiting an assume
|
283
|
+
// intrinsic.
|
284
|
+
assert(false); // NOLINT
|
285
|
+
|
286
|
+
// Hack to silence potential no return warning -- cause an infinite loop.
|
287
|
+
return Run(absl::forward<Op>(op));
|
288
|
+
#endif // Checks for __builtin_unreachable
|
289
|
+
}
|
290
|
+
};
|
291
|
+
|
292
|
+
template <class Op, std::size_t I>
|
293
|
+
struct ReachableSwitchCase {
|
294
|
+
static VisitIndicesResultT<Op, std::size_t> Run(Op&& op) {
|
295
|
+
return absl::base_internal::invoke(absl::forward<Op>(op), SizeT<I>());
|
296
|
+
}
|
297
|
+
};
|
298
|
+
|
299
|
+
// The number 33 is just a guess at a reasonable maximum to our switch. It is
|
300
|
+
// not based on any analysis. The reason it is a power of 2 plus 1 instead of a
|
301
|
+
// power of 2 is because the number was picked to correspond to a power of 2
|
302
|
+
// amount of "normal" alternatives, plus one for the possibility of the user
|
303
|
+
// providing "monostate" in addition to the more natural alternatives.
|
304
|
+
ABSL_INTERNAL_INLINE_CONSTEXPR(std::size_t, MaxUnrolledVisitCases, 33);
|
305
|
+
|
306
|
+
// Note: The default-definition is for unreachable cases.
|
307
|
+
template <bool IsReachable>
|
308
|
+
struct PickCaseImpl {
|
309
|
+
template <class Op, std::size_t I>
|
310
|
+
using Apply = UnreachableSwitchCase;
|
311
|
+
};
|
312
|
+
|
313
|
+
template <>
|
314
|
+
struct PickCaseImpl</*IsReachable =*/true> {
|
315
|
+
template <class Op, std::size_t I>
|
316
|
+
using Apply = ReachableSwitchCase<Op, I>;
|
317
|
+
};
|
318
|
+
|
319
|
+
// Note: This form of dance with template aliases is to make sure that we
|
320
|
+
// instantiate a number of templates proportional to the number of variant
|
321
|
+
// alternatives rather than a number of templates proportional to our
|
322
|
+
// maximum unrolled amount of visitation cases (aliases are effectively
|
323
|
+
// "free" whereas other template instantiations are costly).
|
324
|
+
template <class Op, std::size_t I, std::size_t EndIndex>
|
325
|
+
using PickCase = typename PickCaseImpl<(I < EndIndex)>::template Apply<Op, I>;
|
326
|
+
|
327
|
+
template <class ReturnType>
|
328
|
+
[[noreturn]] ReturnType TypedThrowBadVariantAccess() {
|
329
|
+
absl::variant_internal::ThrowBadVariantAccess();
|
330
|
+
}
|
331
|
+
|
332
|
+
// Given N variant sizes, determine the number of cases there would need to be
|
333
|
+
// in a single switch-statement that would cover every possibility in the
|
334
|
+
// corresponding N-ary visit operation.
|
335
|
+
template <std::size_t... NumAlternatives>
|
336
|
+
struct NumCasesOfSwitch;
|
337
|
+
|
338
|
+
template <std::size_t HeadNumAlternatives, std::size_t... TailNumAlternatives>
|
339
|
+
struct NumCasesOfSwitch<HeadNumAlternatives, TailNumAlternatives...> {
|
340
|
+
static constexpr std::size_t value =
|
341
|
+
(HeadNumAlternatives + 1) *
|
342
|
+
NumCasesOfSwitch<TailNumAlternatives...>::value;
|
343
|
+
};
|
344
|
+
|
345
|
+
template <>
|
346
|
+
struct NumCasesOfSwitch<> {
|
347
|
+
static constexpr std::size_t value = 1;
|
348
|
+
};
|
349
|
+
|
350
|
+
// A switch statement optimizes better than the table of function pointers.
|
351
|
+
template <std::size_t EndIndex>
|
352
|
+
struct VisitIndicesSwitch {
|
353
|
+
static_assert(EndIndex <= MaxUnrolledVisitCases,
|
354
|
+
"Maximum unrolled switch size exceeded.");
|
355
|
+
|
356
|
+
template <class Op>
|
357
|
+
static VisitIndicesResultT<Op, std::size_t> Run(Op&& op, std::size_t i) {
|
358
|
+
switch (i) {
|
359
|
+
case 0:
|
360
|
+
return PickCase<Op, 0, EndIndex>::Run(absl::forward<Op>(op));
|
361
|
+
case 1:
|
362
|
+
return PickCase<Op, 1, EndIndex>::Run(absl::forward<Op>(op));
|
363
|
+
case 2:
|
364
|
+
return PickCase<Op, 2, EndIndex>::Run(absl::forward<Op>(op));
|
365
|
+
case 3:
|
366
|
+
return PickCase<Op, 3, EndIndex>::Run(absl::forward<Op>(op));
|
367
|
+
case 4:
|
368
|
+
return PickCase<Op, 4, EndIndex>::Run(absl::forward<Op>(op));
|
369
|
+
case 5:
|
370
|
+
return PickCase<Op, 5, EndIndex>::Run(absl::forward<Op>(op));
|
371
|
+
case 6:
|
372
|
+
return PickCase<Op, 6, EndIndex>::Run(absl::forward<Op>(op));
|
373
|
+
case 7:
|
374
|
+
return PickCase<Op, 7, EndIndex>::Run(absl::forward<Op>(op));
|
375
|
+
case 8:
|
376
|
+
return PickCase<Op, 8, EndIndex>::Run(absl::forward<Op>(op));
|
377
|
+
case 9:
|
378
|
+
return PickCase<Op, 9, EndIndex>::Run(absl::forward<Op>(op));
|
379
|
+
case 10:
|
380
|
+
return PickCase<Op, 10, EndIndex>::Run(absl::forward<Op>(op));
|
381
|
+
case 11:
|
382
|
+
return PickCase<Op, 11, EndIndex>::Run(absl::forward<Op>(op));
|
383
|
+
case 12:
|
384
|
+
return PickCase<Op, 12, EndIndex>::Run(absl::forward<Op>(op));
|
385
|
+
case 13:
|
386
|
+
return PickCase<Op, 13, EndIndex>::Run(absl::forward<Op>(op));
|
387
|
+
case 14:
|
388
|
+
return PickCase<Op, 14, EndIndex>::Run(absl::forward<Op>(op));
|
389
|
+
case 15:
|
390
|
+
return PickCase<Op, 15, EndIndex>::Run(absl::forward<Op>(op));
|
391
|
+
case 16:
|
392
|
+
return PickCase<Op, 16, EndIndex>::Run(absl::forward<Op>(op));
|
393
|
+
case 17:
|
394
|
+
return PickCase<Op, 17, EndIndex>::Run(absl::forward<Op>(op));
|
395
|
+
case 18:
|
396
|
+
return PickCase<Op, 18, EndIndex>::Run(absl::forward<Op>(op));
|
397
|
+
case 19:
|
398
|
+
return PickCase<Op, 19, EndIndex>::Run(absl::forward<Op>(op));
|
399
|
+
case 20:
|
400
|
+
return PickCase<Op, 20, EndIndex>::Run(absl::forward<Op>(op));
|
401
|
+
case 21:
|
402
|
+
return PickCase<Op, 21, EndIndex>::Run(absl::forward<Op>(op));
|
403
|
+
case 22:
|
404
|
+
return PickCase<Op, 22, EndIndex>::Run(absl::forward<Op>(op));
|
405
|
+
case 23:
|
406
|
+
return PickCase<Op, 23, EndIndex>::Run(absl::forward<Op>(op));
|
407
|
+
case 24:
|
408
|
+
return PickCase<Op, 24, EndIndex>::Run(absl::forward<Op>(op));
|
409
|
+
case 25:
|
410
|
+
return PickCase<Op, 25, EndIndex>::Run(absl::forward<Op>(op));
|
411
|
+
case 26:
|
412
|
+
return PickCase<Op, 26, EndIndex>::Run(absl::forward<Op>(op));
|
413
|
+
case 27:
|
414
|
+
return PickCase<Op, 27, EndIndex>::Run(absl::forward<Op>(op));
|
415
|
+
case 28:
|
416
|
+
return PickCase<Op, 28, EndIndex>::Run(absl::forward<Op>(op));
|
417
|
+
case 29:
|
418
|
+
return PickCase<Op, 29, EndIndex>::Run(absl::forward<Op>(op));
|
419
|
+
case 30:
|
420
|
+
return PickCase<Op, 30, EndIndex>::Run(absl::forward<Op>(op));
|
421
|
+
case 31:
|
422
|
+
return PickCase<Op, 31, EndIndex>::Run(absl::forward<Op>(op));
|
423
|
+
case 32:
|
424
|
+
return PickCase<Op, 32, EndIndex>::Run(absl::forward<Op>(op));
|
425
|
+
default:
|
426
|
+
ABSL_ASSERT(i == variant_npos);
|
427
|
+
return absl::base_internal::invoke(absl::forward<Op>(op), NPos());
|
428
|
+
}
|
429
|
+
}
|
430
|
+
};
|
431
|
+
|
432
|
+
template <std::size_t... EndIndices>
|
433
|
+
struct VisitIndicesFallback {
|
434
|
+
template <class Op, class... SizeT>
|
435
|
+
static VisitIndicesResultT<Op, SizeT...> Run(Op&& op, SizeT... indices) {
|
436
|
+
return AccessSimpleArray(
|
437
|
+
MakeVisitationMatrix<VisitIndicesResultT<Op, SizeT...>, Op,
|
438
|
+
index_sequence<(EndIndices + 1)...>,
|
439
|
+
index_sequence<>>::Run(),
|
440
|
+
(indices + 1)...)(absl::forward<Op>(op));
|
441
|
+
}
|
442
|
+
};
|
443
|
+
|
444
|
+
// Take an N-dimensional series of indices and convert them into a single index
|
445
|
+
// without loss of information. The purpose of this is to be able to convert an
|
446
|
+
// N-ary visit operation into a single switch statement.
|
447
|
+
template <std::size_t...>
|
448
|
+
struct FlattenIndices;
|
449
|
+
|
450
|
+
template <std::size_t HeadSize, std::size_t... TailSize>
|
451
|
+
struct FlattenIndices<HeadSize, TailSize...> {
|
452
|
+
template<class... SizeType>
|
453
|
+
static constexpr std::size_t Run(std::size_t head, SizeType... tail) {
|
454
|
+
return head + HeadSize * FlattenIndices<TailSize...>::Run(tail...);
|
455
|
+
}
|
456
|
+
};
|
457
|
+
|
458
|
+
template <>
|
459
|
+
struct FlattenIndices<> {
|
460
|
+
static constexpr std::size_t Run() { return 0; }
|
461
|
+
};
|
462
|
+
|
463
|
+
// Take a single "flattened" index (flattened by FlattenIndices) and determine
|
464
|
+
// the value of the index of one of the logically represented dimensions.
|
465
|
+
template <std::size_t I, std::size_t IndexToGet, std::size_t HeadSize,
|
466
|
+
std::size_t... TailSize>
|
467
|
+
struct UnflattenIndex {
|
468
|
+
static constexpr std::size_t value =
|
469
|
+
UnflattenIndex<I / HeadSize, IndexToGet - 1, TailSize...>::value;
|
470
|
+
};
|
471
|
+
|
472
|
+
template <std::size_t I, std::size_t HeadSize, std::size_t... TailSize>
|
473
|
+
struct UnflattenIndex<I, 0, HeadSize, TailSize...> {
|
474
|
+
static constexpr std::size_t value = (I % HeadSize);
|
475
|
+
};
|
476
|
+
|
477
|
+
// The backend for converting an N-ary visit operation into a unary visit.
|
478
|
+
template <class IndexSequence, std::size_t... EndIndices>
|
479
|
+
struct VisitIndicesVariadicImpl;
|
480
|
+
|
481
|
+
template <std::size_t... N, std::size_t... EndIndices>
|
482
|
+
struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> {
|
483
|
+
// A type that can take an N-ary function object and converts it to a unary
|
484
|
+
// function object that takes a single, flattened index, and "unflattens" it
|
485
|
+
// into its individual dimensions when forwarding to the wrapped object.
|
486
|
+
template <class Op>
|
487
|
+
struct FlattenedOp {
|
488
|
+
template <std::size_t I>
|
489
|
+
VisitIndicesResultT<Op, decltype(EndIndices)...> operator()(
|
490
|
+
SizeT<I> /*index*/) && {
|
491
|
+
return base_internal::invoke(
|
492
|
+
absl::forward<Op>(op),
|
493
|
+
SizeT<UnflattenIndex<I, N, (EndIndices + 1)...>::value -
|
494
|
+
std::size_t{1}>()...);
|
495
|
+
}
|
496
|
+
|
497
|
+
Op&& op;
|
498
|
+
};
|
499
|
+
|
500
|
+
template <class Op, class... SizeType>
|
501
|
+
static VisitIndicesResultT<Op, decltype(EndIndices)...> Run(
|
502
|
+
Op&& op, SizeType... i) {
|
503
|
+
return VisitIndicesSwitch<NumCasesOfSwitch<EndIndices...>::value>::Run(
|
504
|
+
FlattenedOp<Op>{absl::forward<Op>(op)},
|
505
|
+
FlattenIndices<(EndIndices + std::size_t{1})...>::Run(
|
506
|
+
(i + std::size_t{1})...));
|
507
|
+
}
|
508
|
+
};
|
509
|
+
|
510
|
+
template <std::size_t... EndIndices>
|
511
|
+
struct VisitIndicesVariadic
|
512
|
+
: VisitIndicesVariadicImpl<absl::make_index_sequence<sizeof...(EndIndices)>,
|
513
|
+
EndIndices...> {};
|
514
|
+
|
515
|
+
// This implementation will flatten N-ary visit operations into a single switch
|
516
|
+
// statement when the number of cases would be less than our maximum specified
|
517
|
+
// switch-statement size.
|
518
|
+
// TODO(calabrese)
|
519
|
+
// Based on benchmarks, determine whether the function table approach actually
|
520
|
+
// does optimize better than a chain of switch statements and possibly update
|
521
|
+
// the implementation accordingly. Also consider increasing the maximum switch
|
522
|
+
// size.
|
523
|
+
template <std::size_t... EndIndices>
|
524
|
+
struct VisitIndices
|
525
|
+
: absl::conditional_t<(NumCasesOfSwitch<EndIndices...>::value <=
|
526
|
+
MaxUnrolledVisitCases),
|
527
|
+
VisitIndicesVariadic<EndIndices...>,
|
528
|
+
VisitIndicesFallback<EndIndices...>> {};
|
529
|
+
|
530
|
+
template <std::size_t EndIndex>
|
531
|
+
struct VisitIndices<EndIndex>
|
532
|
+
: absl::conditional_t<(EndIndex <= MaxUnrolledVisitCases),
|
533
|
+
VisitIndicesSwitch<EndIndex>,
|
534
|
+
VisitIndicesFallback<EndIndex>> {};
|
535
|
+
|
536
|
+
// Suppress bogus warning on MSVC: MSVC complains that the `reinterpret_cast`
|
537
|
+
// below is returning the address of a temporary or local object.
|
538
|
+
#ifdef _MSC_VER
|
539
|
+
#pragma warning(push)
|
540
|
+
#pragma warning(disable : 4172)
|
541
|
+
#endif // _MSC_VER
|
542
|
+
|
543
|
+
// TODO(calabrese) std::launder
|
544
|
+
// TODO(calabrese) constexpr
|
545
|
+
// NOTE: DO NOT REMOVE the `inline` keyword as it is necessary to work around a
|
546
|
+
// MSVC bug. See https://github.com/abseil/abseil-cpp/issues/129 for details.
|
547
|
+
template <class Self, std::size_t I>
|
548
|
+
inline VariantAccessResult<I, Self> AccessUnion(Self&& self, SizeT<I> /*i*/) {
|
549
|
+
return reinterpret_cast<VariantAccessResult<I, Self>>(self);
|
550
|
+
}
|
551
|
+
|
552
|
+
#ifdef _MSC_VER
|
553
|
+
#pragma warning(pop)
|
554
|
+
#endif // _MSC_VER
|
555
|
+
|
556
|
+
template <class T>
|
557
|
+
void DeducedDestroy(T& self) { // NOLINT
|
558
|
+
self.~T();
|
559
|
+
}
|
560
|
+
|
561
|
+
// NOTE: This type exists as a single entity for variant and its bases to
|
562
|
+
// befriend. It contains helper functionality that manipulates the state of the
|
563
|
+
// variant, such as the implementation of things like assignment and emplace
|
564
|
+
// operations.
|
565
|
+
struct VariantCoreAccess {
|
566
|
+
template <class VariantType>
|
567
|
+
static typename VariantType::Variant& Derived(VariantType& self) { // NOLINT
|
568
|
+
return static_cast<typename VariantType::Variant&>(self);
|
569
|
+
}
|
570
|
+
|
571
|
+
template <class VariantType>
|
572
|
+
static const typename VariantType::Variant& Derived(
|
573
|
+
const VariantType& self) { // NOLINT
|
574
|
+
return static_cast<const typename VariantType::Variant&>(self);
|
575
|
+
}
|
576
|
+
|
577
|
+
template <class VariantType>
|
578
|
+
static void Destroy(VariantType& self) { // NOLINT
|
579
|
+
Derived(self).destroy();
|
580
|
+
self.index_ = absl::variant_npos;
|
581
|
+
}
|
582
|
+
|
583
|
+
template <class Variant>
|
584
|
+
static void SetIndex(Variant& self, std::size_t i) { // NOLINT
|
585
|
+
self.index_ = i;
|
586
|
+
}
|
587
|
+
|
588
|
+
template <class Variant>
|
589
|
+
static void InitFrom(Variant& self, Variant&& other) { // NOLINT
|
590
|
+
VisitIndices<absl::variant_size<Variant>::value>::Run(
|
591
|
+
InitFromVisitor<Variant, Variant&&>{&self,
|
592
|
+
std::forward<Variant>(other)},
|
593
|
+
other.index());
|
594
|
+
self.index_ = other.index();
|
595
|
+
}
|
596
|
+
|
597
|
+
// Access a variant alternative, assuming the index is correct.
|
598
|
+
template <std::size_t I, class Variant>
|
599
|
+
static VariantAccessResult<I, Variant> Access(Variant&& self) {
|
600
|
+
// This cast instead of invocation of AccessUnion with an rvalue is a
|
601
|
+
// workaround for msvc. Without this there is a runtime failure when dealing
|
602
|
+
// with rvalues.
|
603
|
+
// TODO(calabrese) Reduce test case and find a simpler workaround.
|
604
|
+
return static_cast<VariantAccessResult<I, Variant>>(
|
605
|
+
variant_internal::AccessUnion(self.state_, SizeT<I>()));
|
606
|
+
}
|
607
|
+
|
608
|
+
// Access a variant alternative, throwing if the index is incorrect.
|
609
|
+
template <std::size_t I, class Variant>
|
610
|
+
static VariantAccessResult<I, Variant> CheckedAccess(Variant&& self) {
|
611
|
+
if (ABSL_PREDICT_FALSE(self.index_ != I)) {
|
612
|
+
TypedThrowBadVariantAccess<VariantAccessResult<I, Variant>>();
|
613
|
+
}
|
614
|
+
|
615
|
+
return Access<I>(absl::forward<Variant>(self));
|
616
|
+
}
|
617
|
+
|
618
|
+
// The implementation of the move-assignment operation for a variant.
|
619
|
+
template <class VType>
|
620
|
+
struct MoveAssignVisitor {
|
621
|
+
using DerivedType = typename VType::Variant;
|
622
|
+
template <std::size_t NewIndex>
|
623
|
+
void operator()(SizeT<NewIndex> /*new_i*/) const {
|
624
|
+
if (left->index_ == NewIndex) {
|
625
|
+
Access<NewIndex>(*left) = std::move(Access<NewIndex>(*right));
|
626
|
+
} else {
|
627
|
+
Derived(*left).template emplace<NewIndex>(
|
628
|
+
std::move(Access<NewIndex>(*right)));
|
629
|
+
}
|
630
|
+
}
|
631
|
+
|
632
|
+
void operator()(SizeT<absl::variant_npos> /*new_i*/) const {
|
633
|
+
Destroy(*left);
|
634
|
+
}
|
635
|
+
|
636
|
+
VType* left;
|
637
|
+
VType* right;
|
638
|
+
};
|
639
|
+
|
640
|
+
template <class VType>
|
641
|
+
static MoveAssignVisitor<VType> MakeMoveAssignVisitor(VType* left,
|
642
|
+
VType* other) {
|
643
|
+
return {left, other};
|
644
|
+
}
|
645
|
+
|
646
|
+
// The implementation of the assignment operation for a variant.
|
647
|
+
template <class VType>
|
648
|
+
struct CopyAssignVisitor {
|
649
|
+
using DerivedType = typename VType::Variant;
|
650
|
+
template <std::size_t NewIndex>
|
651
|
+
void operator()(SizeT<NewIndex> /*new_i*/) const {
|
652
|
+
using New =
|
653
|
+
typename absl::variant_alternative<NewIndex, DerivedType>::type;
|
654
|
+
|
655
|
+
if (left->index_ == NewIndex) {
|
656
|
+
Access<NewIndex>(*left) = Access<NewIndex>(*right);
|
657
|
+
} else if (std::is_nothrow_copy_constructible<New>::value ||
|
658
|
+
!std::is_nothrow_move_constructible<New>::value) {
|
659
|
+
Derived(*left).template emplace<NewIndex>(Access<NewIndex>(*right));
|
660
|
+
} else {
|
661
|
+
Derived(*left) = DerivedType(Derived(*right));
|
662
|
+
}
|
663
|
+
}
|
664
|
+
|
665
|
+
void operator()(SizeT<absl::variant_npos> /*new_i*/) const {
|
666
|
+
Destroy(*left);
|
667
|
+
}
|
668
|
+
|
669
|
+
VType* left;
|
670
|
+
const VType* right;
|
671
|
+
};
|
672
|
+
|
673
|
+
template <class VType>
|
674
|
+
static CopyAssignVisitor<VType> MakeCopyAssignVisitor(VType* left,
|
675
|
+
const VType& other) {
|
676
|
+
return {left, &other};
|
677
|
+
}
|
678
|
+
|
679
|
+
// The implementation of conversion-assignment operations for variant.
|
680
|
+
template <class Left, class QualifiedNew>
|
681
|
+
struct ConversionAssignVisitor {
|
682
|
+
using NewIndex =
|
683
|
+
variant_internal::IndexOfConstructedType<Left, QualifiedNew>;
|
684
|
+
|
685
|
+
void operator()(SizeT<NewIndex::value> /*old_i*/
|
686
|
+
) const {
|
687
|
+
Access<NewIndex::value>(*left) = absl::forward<QualifiedNew>(other);
|
688
|
+
}
|
689
|
+
|
690
|
+
template <std::size_t OldIndex>
|
691
|
+
void operator()(SizeT<OldIndex> /*old_i*/
|
692
|
+
) const {
|
693
|
+
using New =
|
694
|
+
typename absl::variant_alternative<NewIndex::value, Left>::type;
|
695
|
+
if (std::is_nothrow_constructible<New, QualifiedNew>::value ||
|
696
|
+
!std::is_nothrow_move_constructible<New>::value) {
|
697
|
+
left->template emplace<NewIndex::value>(
|
698
|
+
absl::forward<QualifiedNew>(other));
|
699
|
+
} else {
|
700
|
+
// the standard says "equivalent to
|
701
|
+
// operator=(variant(std::forward<T>(t)))", but we use `emplace` here
|
702
|
+
// because the variant's move assignment operator could be deleted.
|
703
|
+
left->template emplace<NewIndex::value>(
|
704
|
+
New(absl::forward<QualifiedNew>(other)));
|
705
|
+
}
|
706
|
+
}
|
707
|
+
|
708
|
+
Left* left;
|
709
|
+
QualifiedNew&& other;
|
710
|
+
};
|
711
|
+
|
712
|
+
template <class Left, class QualifiedNew>
|
713
|
+
static ConversionAssignVisitor<Left, QualifiedNew>
|
714
|
+
MakeConversionAssignVisitor(Left* left, QualifiedNew&& qual) {
|
715
|
+
return {left, absl::forward<QualifiedNew>(qual)};
|
716
|
+
}
|
717
|
+
|
718
|
+
// Backend for operations for `emplace()` which destructs `*self` then
|
719
|
+
// construct a new alternative with `Args...`.
|
720
|
+
template <std::size_t NewIndex, class Self, class... Args>
|
721
|
+
static typename absl::variant_alternative<NewIndex, Self>::type& Replace(
|
722
|
+
Self* self, Args&&... args) {
|
723
|
+
Destroy(*self);
|
724
|
+
using New = typename absl::variant_alternative<NewIndex, Self>::type;
|
725
|
+
New* const result = ::new (static_cast<void*>(&self->state_))
|
726
|
+
New(absl::forward<Args>(args)...);
|
727
|
+
self->index_ = NewIndex;
|
728
|
+
return *result;
|
729
|
+
}
|
730
|
+
|
731
|
+
template <class LeftVariant, class QualifiedRightVariant>
|
732
|
+
struct InitFromVisitor {
|
733
|
+
template <std::size_t NewIndex>
|
734
|
+
void operator()(SizeT<NewIndex> /*new_i*/) const {
|
735
|
+
using Alternative =
|
736
|
+
typename variant_alternative<NewIndex, LeftVariant>::type;
|
737
|
+
::new (static_cast<void*>(&left->state_)) Alternative(
|
738
|
+
Access<NewIndex>(std::forward<QualifiedRightVariant>(right)));
|
739
|
+
}
|
740
|
+
|
741
|
+
void operator()(SizeT<absl::variant_npos> /*new_i*/) const {
|
742
|
+
// This space intentionally left blank.
|
743
|
+
}
|
744
|
+
LeftVariant* left;
|
745
|
+
QualifiedRightVariant&& right;
|
746
|
+
};
|
747
|
+
};
|
748
|
+
|
749
|
+
template <class Expected, class... T>
|
750
|
+
struct IndexOfImpl;
|
751
|
+
|
752
|
+
template <class Expected>
|
753
|
+
struct IndexOfImpl<Expected> {
|
754
|
+
using IndexFromEnd = SizeT<0>;
|
755
|
+
using MatchedIndexFromEnd = IndexFromEnd;
|
756
|
+
using MultipleMatches = std::false_type;
|
757
|
+
};
|
758
|
+
|
759
|
+
template <class Expected, class Head, class... Tail>
|
760
|
+
struct IndexOfImpl<Expected, Head, Tail...> : IndexOfImpl<Expected, Tail...> {
|
761
|
+
using IndexFromEnd =
|
762
|
+
SizeT<IndexOfImpl<Expected, Tail...>::IndexFromEnd::value + 1>;
|
763
|
+
};
|
764
|
+
|
765
|
+
template <class Expected, class... Tail>
|
766
|
+
struct IndexOfImpl<Expected, Expected, Tail...>
|
767
|
+
: IndexOfImpl<Expected, Tail...> {
|
768
|
+
using IndexFromEnd =
|
769
|
+
SizeT<IndexOfImpl<Expected, Tail...>::IndexFromEnd::value + 1>;
|
770
|
+
using MatchedIndexFromEnd = IndexFromEnd;
|
771
|
+
using MultipleMatches = std::integral_constant<
|
772
|
+
bool, IndexOfImpl<Expected, Tail...>::MatchedIndexFromEnd::value != 0>;
|
773
|
+
};
|
774
|
+
|
775
|
+
template <class Expected, class... Types>
|
776
|
+
struct IndexOfMeta {
|
777
|
+
using Results = IndexOfImpl<Expected, Types...>;
|
778
|
+
static_assert(!Results::MultipleMatches::value,
|
779
|
+
"Attempted to access a variant by specifying a type that "
|
780
|
+
"matches more than one alternative.");
|
781
|
+
static_assert(Results::MatchedIndexFromEnd::value != 0,
|
782
|
+
"Attempted to access a variant by specifying a type that does "
|
783
|
+
"not match any alternative.");
|
784
|
+
using type = SizeT<sizeof...(Types) - Results::MatchedIndexFromEnd::value>;
|
785
|
+
};
|
786
|
+
|
787
|
+
template <class Expected, class... Types>
|
788
|
+
using IndexOf = typename IndexOfMeta<Expected, Types...>::type;
|
789
|
+
|
790
|
+
template <class Variant, class T, std::size_t CurrIndex>
|
791
|
+
struct UnambiguousIndexOfImpl;
|
792
|
+
|
793
|
+
// Terminating case encountered once we've checked all of the alternatives
|
794
|
+
template <class T, std::size_t CurrIndex>
|
795
|
+
struct UnambiguousIndexOfImpl<variant<>, T, CurrIndex> : SizeT<CurrIndex> {};
|
796
|
+
|
797
|
+
// Case where T is not Head
|
798
|
+
template <class Head, class... Tail, class T, std::size_t CurrIndex>
|
799
|
+
struct UnambiguousIndexOfImpl<variant<Head, Tail...>, T, CurrIndex>
|
800
|
+
: UnambiguousIndexOfImpl<variant<Tail...>, T, CurrIndex + 1>::type {};
|
801
|
+
|
802
|
+
// Case where T is Head
|
803
|
+
template <class Head, class... Tail, std::size_t CurrIndex>
|
804
|
+
struct UnambiguousIndexOfImpl<variant<Head, Tail...>, Head, CurrIndex>
|
805
|
+
: SizeT<UnambiguousIndexOfImpl<variant<Tail...>, Head, 0>::value ==
|
806
|
+
sizeof...(Tail)
|
807
|
+
? CurrIndex
|
808
|
+
: CurrIndex + sizeof...(Tail) + 1> {};
|
809
|
+
|
810
|
+
template <class Variant, class T>
|
811
|
+
struct UnambiguousIndexOf;
|
812
|
+
|
813
|
+
struct NoMatch {
|
814
|
+
struct type {};
|
815
|
+
};
|
816
|
+
|
817
|
+
template <class... Alts, class T>
|
818
|
+
struct UnambiguousIndexOf<variant<Alts...>, T>
|
819
|
+
: std::conditional<UnambiguousIndexOfImpl<variant<Alts...>, T, 0>::value !=
|
820
|
+
sizeof...(Alts),
|
821
|
+
UnambiguousIndexOfImpl<variant<Alts...>, T, 0>,
|
822
|
+
NoMatch>::type::type {};
|
823
|
+
|
824
|
+
template <class T, std::size_t /*Dummy*/>
|
825
|
+
using UnambiguousTypeOfImpl = T;
|
826
|
+
|
827
|
+
template <class Variant, class T>
|
828
|
+
using UnambiguousTypeOfT =
|
829
|
+
UnambiguousTypeOfImpl<T, UnambiguousIndexOf<Variant, T>::value>;
|
830
|
+
|
831
|
+
template <class H, class... T>
|
832
|
+
class VariantStateBase;
|
833
|
+
|
834
|
+
// This is an implementation of the "imaginary function" that is described in
|
835
|
+
// [variant.ctor]
|
836
|
+
// It is used in order to determine which alternative to construct during
|
837
|
+
// initialization from some type T.
|
838
|
+
template <class Variant, std::size_t I = 0>
|
839
|
+
struct ImaginaryFun;
|
840
|
+
|
841
|
+
template <std::size_t I>
|
842
|
+
struct ImaginaryFun<variant<>, I> {
|
843
|
+
static void Run() = delete;
|
844
|
+
};
|
845
|
+
|
846
|
+
template <class H, class... T, std::size_t I>
|
847
|
+
struct ImaginaryFun<variant<H, T...>, I> : ImaginaryFun<variant<T...>, I + 1> {
|
848
|
+
using ImaginaryFun<variant<T...>, I + 1>::Run;
|
849
|
+
|
850
|
+
// NOTE: const& and && are used instead of by-value due to lack of guaranteed
|
851
|
+
// move elision of C++17. This may have other minor differences, but tests
|
852
|
+
// pass.
|
853
|
+
static SizeT<I> Run(const H&, SizeT<I>);
|
854
|
+
static SizeT<I> Run(H&&, SizeT<I>);
|
855
|
+
};
|
856
|
+
|
857
|
+
// The following metafunctions are used in constructor and assignment
|
858
|
+
// constraints.
|
859
|
+
template <class Self, class T>
|
860
|
+
struct IsNeitherSelfNorInPlace : std::true_type {};
|
861
|
+
|
862
|
+
template <class Self>
|
863
|
+
struct IsNeitherSelfNorInPlace<Self, Self> : std::false_type {};
|
864
|
+
|
865
|
+
template <class Self, class T>
|
866
|
+
struct IsNeitherSelfNorInPlace<Self, in_place_type_t<T>> : std::false_type {};
|
867
|
+
|
868
|
+
template <class Self, std::size_t I>
|
869
|
+
struct IsNeitherSelfNorInPlace<Self, in_place_index_t<I>> : std::false_type {};
|
870
|
+
|
871
|
+
template <class Variant, class T, class = void>
|
872
|
+
struct ConversionIsPossibleImpl : std::false_type {};
|
873
|
+
|
874
|
+
template <class Variant, class T>
|
875
|
+
struct ConversionIsPossibleImpl<
|
876
|
+
Variant, T,
|
877
|
+
void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {}))>>
|
878
|
+
: std::true_type {};
|
879
|
+
|
880
|
+
template <class Variant, class T>
|
881
|
+
struct ConversionIsPossible : ConversionIsPossibleImpl<Variant, T>::type {};
|
882
|
+
|
883
|
+
template <class Variant, class T>
|
884
|
+
struct IndexOfConstructedType<
|
885
|
+
Variant, T,
|
886
|
+
void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {}))>>
|
887
|
+
: decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {})) {};
|
888
|
+
|
889
|
+
template <std::size_t... Is>
|
890
|
+
struct ContainsVariantNPos
|
891
|
+
: absl::negation<std::is_same< // NOLINT
|
892
|
+
absl::integer_sequence<bool, 0 <= Is...>,
|
893
|
+
absl::integer_sequence<bool, Is != absl::variant_npos...>>> {};
|
894
|
+
|
895
|
+
template <class Op, class... QualifiedVariants>
|
896
|
+
using RawVisitResult =
|
897
|
+
absl::result_of_t<Op(VariantAccessResult<0, QualifiedVariants>...)>;
|
898
|
+
|
899
|
+
// NOTE: The spec requires that all return-paths yield the same type and is not
|
900
|
+
// SFINAE-friendly, so we can deduce the return type by examining the first
|
901
|
+
// result. If it's not callable, then we get an error, but are compliant and
|
902
|
+
// fast to compile.
|
903
|
+
// TODO(calabrese) Possibly rewrite in a way that yields better compile errors
|
904
|
+
// at the cost of longer compile-times.
|
905
|
+
template <class Op, class... QualifiedVariants>
|
906
|
+
struct VisitResultImpl {
|
907
|
+
using type =
|
908
|
+
absl::result_of_t<Op(VariantAccessResult<0, QualifiedVariants>...)>;
|
909
|
+
};
|
910
|
+
|
911
|
+
// Done in two steps intentionally so that we don't cause substitution to fail.
|
912
|
+
template <class Op, class... QualifiedVariants>
|
913
|
+
using VisitResult = typename VisitResultImpl<Op, QualifiedVariants...>::type;
|
914
|
+
|
915
|
+
template <class Op, class... QualifiedVariants>
|
916
|
+
struct PerformVisitation {
|
917
|
+
using ReturnType = VisitResult<Op, QualifiedVariants...>;
|
918
|
+
|
919
|
+
template <std::size_t... Is>
|
920
|
+
constexpr ReturnType operator()(SizeT<Is>... indices) const {
|
921
|
+
return Run(typename ContainsVariantNPos<Is...>::type{},
|
922
|
+
absl::index_sequence_for<QualifiedVariants...>(), indices...);
|
923
|
+
}
|
924
|
+
|
925
|
+
template <std::size_t... TupIs, std::size_t... Is>
|
926
|
+
constexpr ReturnType Run(std::false_type /*has_valueless*/,
|
927
|
+
index_sequence<TupIs...>, SizeT<Is>...) const {
|
928
|
+
static_assert(
|
929
|
+
std::is_same<ReturnType,
|
930
|
+
absl::result_of_t<Op(VariantAccessResult<
|
931
|
+
Is, QualifiedVariants>...)>>::value,
|
932
|
+
"All visitation overloads must have the same return type.");
|
933
|
+
return absl::base_internal::invoke(
|
934
|
+
absl::forward<Op>(op),
|
935
|
+
VariantCoreAccess::Access<Is>(
|
936
|
+
absl::forward<QualifiedVariants>(std::get<TupIs>(variant_tup)))...);
|
937
|
+
}
|
938
|
+
|
939
|
+
template <std::size_t... TupIs, std::size_t... Is>
|
940
|
+
[[noreturn]] ReturnType Run(std::true_type /*has_valueless*/,
|
941
|
+
index_sequence<TupIs...>, SizeT<Is>...) const {
|
942
|
+
absl::variant_internal::ThrowBadVariantAccess();
|
943
|
+
}
|
944
|
+
|
945
|
+
// TODO(calabrese) Avoid using a tuple, which causes lots of instantiations
|
946
|
+
// Attempts using lambda variadic captures fail on current GCC.
|
947
|
+
std::tuple<QualifiedVariants&&...> variant_tup;
|
948
|
+
Op&& op;
|
949
|
+
};
|
950
|
+
|
951
|
+
template <class... T>
|
952
|
+
union Union;
|
953
|
+
|
954
|
+
// We want to allow for variant<> to be trivial. For that, we need the default
|
955
|
+
// constructor to be trivial, which means we can't define it ourselves.
|
956
|
+
// Instead, we use a non-default constructor that takes NoopConstructorTag
|
957
|
+
// that doesn't affect the triviality of the types.
|
958
|
+
struct NoopConstructorTag {};
|
959
|
+
|
960
|
+
template <std::size_t I>
|
961
|
+
struct EmplaceTag {};
|
962
|
+
|
963
|
+
template <>
|
964
|
+
union Union<> {
|
965
|
+
constexpr explicit Union(NoopConstructorTag) noexcept {}
|
966
|
+
};
|
967
|
+
|
968
|
+
// Suppress bogus warning on MSVC: MSVC complains that Union<T...> has a defined
|
969
|
+
// deleted destructor from the `std::is_destructible` check below.
|
970
|
+
#ifdef _MSC_VER
|
971
|
+
#pragma warning(push)
|
972
|
+
#pragma warning(disable : 4624)
|
973
|
+
#endif // _MSC_VER
|
974
|
+
|
975
|
+
template <class Head, class... Tail>
|
976
|
+
union Union<Head, Tail...> {
|
977
|
+
using TailUnion = Union<Tail...>;
|
978
|
+
|
979
|
+
explicit constexpr Union(NoopConstructorTag /*tag*/) noexcept
|
980
|
+
: tail(NoopConstructorTag()) {}
|
981
|
+
|
982
|
+
template <class... P>
|
983
|
+
explicit constexpr Union(EmplaceTag<0>, P&&... args)
|
984
|
+
: head(absl::forward<P>(args)...) {}
|
985
|
+
|
986
|
+
template <std::size_t I, class... P>
|
987
|
+
explicit constexpr Union(EmplaceTag<I>, P&&... args)
|
988
|
+
: tail(EmplaceTag<I - 1>{}, absl::forward<P>(args)...) {}
|
989
|
+
|
990
|
+
Head head;
|
991
|
+
TailUnion tail;
|
992
|
+
};
|
993
|
+
|
994
|
+
#ifdef _MSC_VER
|
995
|
+
#pragma warning(pop)
|
996
|
+
#endif // _MSC_VER
|
997
|
+
|
998
|
+
// TODO(calabrese) Just contain a Union in this union (certain configs fail).
|
999
|
+
template <class... T>
|
1000
|
+
union DestructibleUnionImpl;
|
1001
|
+
|
1002
|
+
template <>
|
1003
|
+
union DestructibleUnionImpl<> {
|
1004
|
+
constexpr explicit DestructibleUnionImpl(NoopConstructorTag) noexcept {}
|
1005
|
+
};
|
1006
|
+
|
1007
|
+
template <class Head, class... Tail>
|
1008
|
+
union DestructibleUnionImpl<Head, Tail...> {
|
1009
|
+
using TailUnion = DestructibleUnionImpl<Tail...>;
|
1010
|
+
|
1011
|
+
explicit constexpr DestructibleUnionImpl(NoopConstructorTag /*tag*/) noexcept
|
1012
|
+
: tail(NoopConstructorTag()) {}
|
1013
|
+
|
1014
|
+
template <class... P>
|
1015
|
+
explicit constexpr DestructibleUnionImpl(EmplaceTag<0>, P&&... args)
|
1016
|
+
: head(absl::forward<P>(args)...) {}
|
1017
|
+
|
1018
|
+
template <std::size_t I, class... P>
|
1019
|
+
explicit constexpr DestructibleUnionImpl(EmplaceTag<I>, P&&... args)
|
1020
|
+
: tail(EmplaceTag<I - 1>{}, absl::forward<P>(args)...) {}
|
1021
|
+
|
1022
|
+
~DestructibleUnionImpl() {}
|
1023
|
+
|
1024
|
+
Head head;
|
1025
|
+
TailUnion tail;
|
1026
|
+
};
|
1027
|
+
|
1028
|
+
// This union type is destructible even if one or more T are not trivially
|
1029
|
+
// destructible. In the case that all T are trivially destructible, then so is
|
1030
|
+
// this resultant type.
|
1031
|
+
template <class... T>
|
1032
|
+
using DestructibleUnion =
|
1033
|
+
absl::conditional_t<std::is_destructible<Union<T...>>::value, Union<T...>,
|
1034
|
+
DestructibleUnionImpl<T...>>;
|
1035
|
+
|
1036
|
+
// Deepest base, containing the actual union and the discriminator
|
1037
|
+
template <class H, class... T>
|
1038
|
+
class VariantStateBase {
|
1039
|
+
protected:
|
1040
|
+
using Variant = variant<H, T...>;
|
1041
|
+
|
1042
|
+
template <class LazyH = H,
|
1043
|
+
class ConstructibleH = absl::enable_if_t<
|
1044
|
+
std::is_default_constructible<LazyH>::value, LazyH>>
|
1045
|
+
constexpr VariantStateBase() noexcept(
|
1046
|
+
std::is_nothrow_default_constructible<ConstructibleH>::value)
|
1047
|
+
: state_(EmplaceTag<0>()), index_(0) {}
|
1048
|
+
|
1049
|
+
template <std::size_t I, class... P>
|
1050
|
+
explicit constexpr VariantStateBase(EmplaceTag<I> tag, P&&... args)
|
1051
|
+
: state_(tag, absl::forward<P>(args)...), index_(I) {}
|
1052
|
+
|
1053
|
+
explicit constexpr VariantStateBase(NoopConstructorTag)
|
1054
|
+
: state_(NoopConstructorTag()), index_(variant_npos) {}
|
1055
|
+
|
1056
|
+
void destroy() {} // Does nothing (shadowed in child if non-trivial)
|
1057
|
+
|
1058
|
+
DestructibleUnion<H, T...> state_;
|
1059
|
+
std::size_t index_;
|
1060
|
+
};
|
1061
|
+
|
1062
|
+
using absl::internal::identity;
|
1063
|
+
|
1064
|
+
// OverloadSet::Overload() is a unary function which is overloaded to
|
1065
|
+
// take any of the element types of the variant, by reference-to-const.
|
1066
|
+
// The return type of the overload on T is identity<T>, so that you
|
1067
|
+
// can statically determine which overload was called.
|
1068
|
+
//
|
1069
|
+
// Overload() is not defined, so it can only be called in unevaluated
|
1070
|
+
// contexts.
|
1071
|
+
template <typename... Ts>
|
1072
|
+
struct OverloadSet;
|
1073
|
+
|
1074
|
+
template <typename T, typename... Ts>
|
1075
|
+
struct OverloadSet<T, Ts...> : OverloadSet<Ts...> {
|
1076
|
+
using Base = OverloadSet<Ts...>;
|
1077
|
+
static identity<T> Overload(const T&);
|
1078
|
+
using Base::Overload;
|
1079
|
+
};
|
1080
|
+
|
1081
|
+
template <>
|
1082
|
+
struct OverloadSet<> {
|
1083
|
+
// For any case not handled above.
|
1084
|
+
static void Overload(...);
|
1085
|
+
};
|
1086
|
+
|
1087
|
+
template <class T>
|
1088
|
+
using LessThanResult = decltype(std::declval<T>() < std::declval<T>());
|
1089
|
+
|
1090
|
+
template <class T>
|
1091
|
+
using GreaterThanResult = decltype(std::declval<T>() > std::declval<T>());
|
1092
|
+
|
1093
|
+
template <class T>
|
1094
|
+
using LessThanOrEqualResult = decltype(std::declval<T>() <= std::declval<T>());
|
1095
|
+
|
1096
|
+
template <class T>
|
1097
|
+
using GreaterThanOrEqualResult =
|
1098
|
+
decltype(std::declval<T>() >= std::declval<T>());
|
1099
|
+
|
1100
|
+
template <class T>
|
1101
|
+
using EqualResult = decltype(std::declval<T>() == std::declval<T>());
|
1102
|
+
|
1103
|
+
template <class T>
|
1104
|
+
using NotEqualResult = decltype(std::declval<T>() != std::declval<T>());
|
1105
|
+
|
1106
|
+
using type_traits_internal::is_detected_convertible;
|
1107
|
+
|
1108
|
+
template <class... T>
|
1109
|
+
using RequireAllHaveEqualT = absl::enable_if_t<
|
1110
|
+
absl::conjunction<is_detected_convertible<bool, EqualResult, T>...>::value,
|
1111
|
+
bool>;
|
1112
|
+
|
1113
|
+
template <class... T>
|
1114
|
+
using RequireAllHaveNotEqualT =
|
1115
|
+
absl::enable_if_t<absl::conjunction<is_detected_convertible<
|
1116
|
+
bool, NotEqualResult, T>...>::value,
|
1117
|
+
bool>;
|
1118
|
+
|
1119
|
+
template <class... T>
|
1120
|
+
using RequireAllHaveLessThanT =
|
1121
|
+
absl::enable_if_t<absl::conjunction<is_detected_convertible<
|
1122
|
+
bool, LessThanResult, T>...>::value,
|
1123
|
+
bool>;
|
1124
|
+
|
1125
|
+
template <class... T>
|
1126
|
+
using RequireAllHaveLessThanOrEqualT =
|
1127
|
+
absl::enable_if_t<absl::conjunction<is_detected_convertible<
|
1128
|
+
bool, LessThanOrEqualResult, T>...>::value,
|
1129
|
+
bool>;
|
1130
|
+
|
1131
|
+
template <class... T>
|
1132
|
+
using RequireAllHaveGreaterThanOrEqualT =
|
1133
|
+
absl::enable_if_t<absl::conjunction<is_detected_convertible<
|
1134
|
+
bool, GreaterThanOrEqualResult, T>...>::value,
|
1135
|
+
bool>;
|
1136
|
+
|
1137
|
+
template <class... T>
|
1138
|
+
using RequireAllHaveGreaterThanT =
|
1139
|
+
absl::enable_if_t<absl::conjunction<is_detected_convertible<
|
1140
|
+
bool, GreaterThanResult, T>...>::value,
|
1141
|
+
bool>;
|
1142
|
+
|
1143
|
+
// Helper template containing implementations details of variant that can't go
|
1144
|
+
// in the private section. For convenience, this takes the variant type as a
|
1145
|
+
// single template parameter.
|
1146
|
+
template <typename T>
|
1147
|
+
struct VariantHelper;
|
1148
|
+
|
1149
|
+
template <typename... Ts>
|
1150
|
+
struct VariantHelper<variant<Ts...>> {
|
1151
|
+
// Type metafunction which returns the element type selected if
|
1152
|
+
// OverloadSet::Overload() is well-formed when called with argument type U.
|
1153
|
+
template <typename U>
|
1154
|
+
using BestMatch = decltype(
|
1155
|
+
variant_internal::OverloadSet<Ts...>::Overload(std::declval<U>()));
|
1156
|
+
|
1157
|
+
// Type metafunction which returns true if OverloadSet::Overload() is
|
1158
|
+
// well-formed when called with argument type U.
|
1159
|
+
// CanAccept can't be just an alias because there is a MSVC bug on parameter
|
1160
|
+
// pack expansion involving decltype.
|
1161
|
+
template <typename U>
|
1162
|
+
struct CanAccept :
|
1163
|
+
std::integral_constant<bool, !std::is_void<BestMatch<U>>::value> {};
|
1164
|
+
|
1165
|
+
// Type metafunction which returns true if Other is an instantiation of
|
1166
|
+
// variant, and variants's converting constructor from Other will be
|
1167
|
+
// well-formed. We will use this to remove constructors that would be
|
1168
|
+
// ill-formed from the overload set.
|
1169
|
+
template <typename Other>
|
1170
|
+
struct CanConvertFrom;
|
1171
|
+
|
1172
|
+
template <typename... Us>
|
1173
|
+
struct CanConvertFrom<variant<Us...>>
|
1174
|
+
: public absl::conjunction<CanAccept<Us>...> {};
|
1175
|
+
};
|
1176
|
+
|
1177
|
+
// A type with nontrivial copy ctor and trivial move ctor.
|
1178
|
+
struct TrivialMoveOnly {
|
1179
|
+
TrivialMoveOnly(TrivialMoveOnly&&) = default;
|
1180
|
+
};
|
1181
|
+
|
1182
|
+
// Trait class to detect whether a type is trivially move constructible.
|
1183
|
+
// A union's defaulted copy/move constructor is deleted if any variant member's
|
1184
|
+
// copy/move constructor is nontrivial.
|
1185
|
+
template <typename T>
|
1186
|
+
struct IsTriviallyMoveConstructible:
|
1187
|
+
std::is_move_constructible<Union<T, TrivialMoveOnly>> {};
|
1188
|
+
|
1189
|
+
// To guarantee triviality of all special-member functions that can be trivial,
|
1190
|
+
// we use a chain of conditional bases for each one.
|
1191
|
+
// The order of inheritance of bases from child to base are logically:
|
1192
|
+
//
|
1193
|
+
// variant
|
1194
|
+
// VariantCopyAssignBase
|
1195
|
+
// VariantMoveAssignBase
|
1196
|
+
// VariantCopyBase
|
1197
|
+
// VariantMoveBase
|
1198
|
+
// VariantStateBaseDestructor
|
1199
|
+
// VariantStateBase
|
1200
|
+
//
|
1201
|
+
// Note that there is a separate branch at each base that is dependent on
|
1202
|
+
// whether or not that corresponding special-member-function can be trivial in
|
1203
|
+
// the resultant variant type.
|
1204
|
+
|
1205
|
+
template <class... T>
|
1206
|
+
class VariantStateBaseDestructorNontrivial;
|
1207
|
+
|
1208
|
+
template <class... T>
|
1209
|
+
class VariantMoveBaseNontrivial;
|
1210
|
+
|
1211
|
+
template <class... T>
|
1212
|
+
class VariantCopyBaseNontrivial;
|
1213
|
+
|
1214
|
+
template <class... T>
|
1215
|
+
class VariantMoveAssignBaseNontrivial;
|
1216
|
+
|
1217
|
+
template <class... T>
|
1218
|
+
class VariantCopyAssignBaseNontrivial;
|
1219
|
+
|
1220
|
+
// Base that is dependent on whether or not the destructor can be trivial.
|
1221
|
+
template <class... T>
|
1222
|
+
using VariantStateBaseDestructor =
|
1223
|
+
absl::conditional_t<std::is_destructible<Union<T...>>::value,
|
1224
|
+
VariantStateBase<T...>,
|
1225
|
+
VariantStateBaseDestructorNontrivial<T...>>;
|
1226
|
+
|
1227
|
+
// Base that is dependent on whether or not the move-constructor can be
|
1228
|
+
// implicitly generated by the compiler (trivial or deleted).
|
1229
|
+
// Previously we were using `std::is_move_constructible<Union<T...>>` to check
|
1230
|
+
// whether all Ts have trivial move constructor, but it ran into a GCC bug:
|
1231
|
+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84866
|
1232
|
+
// So we have to use a different approach (i.e. `HasTrivialMoveConstructor`) to
|
1233
|
+
// work around the bug.
|
1234
|
+
template <class... T>
|
1235
|
+
using VariantMoveBase = absl::conditional_t<
|
1236
|
+
absl::disjunction<
|
1237
|
+
absl::negation<absl::conjunction<std::is_move_constructible<T>...>>,
|
1238
|
+
absl::conjunction<IsTriviallyMoveConstructible<T>...>>::value,
|
1239
|
+
VariantStateBaseDestructor<T...>, VariantMoveBaseNontrivial<T...>>;
|
1240
|
+
|
1241
|
+
// Base that is dependent on whether or not the copy-constructor can be trivial.
|
1242
|
+
template <class... T>
|
1243
|
+
using VariantCopyBase = absl::conditional_t<
|
1244
|
+
absl::disjunction<
|
1245
|
+
absl::negation<absl::conjunction<std::is_copy_constructible<T>...>>,
|
1246
|
+
std::is_copy_constructible<Union<T...>>>::value,
|
1247
|
+
VariantMoveBase<T...>, VariantCopyBaseNontrivial<T...>>;
|
1248
|
+
|
1249
|
+
// Base that is dependent on whether or not the move-assign can be trivial.
|
1250
|
+
template <class... T>
|
1251
|
+
using VariantMoveAssignBase = absl::conditional_t<
|
1252
|
+
absl::disjunction<
|
1253
|
+
absl::conjunction<absl::is_move_assignable<Union<T...>>,
|
1254
|
+
std::is_move_constructible<Union<T...>>,
|
1255
|
+
std::is_destructible<Union<T...>>>,
|
1256
|
+
absl::negation<absl::conjunction<std::is_move_constructible<T>...,
|
1257
|
+
// Note: We're not qualifying this with
|
1258
|
+
// absl:: because it doesn't compile
|
1259
|
+
// under MSVC.
|
1260
|
+
is_move_assignable<T>...>>>::value,
|
1261
|
+
VariantCopyBase<T...>, VariantMoveAssignBaseNontrivial<T...>>;
|
1262
|
+
|
1263
|
+
// Base that is dependent on whether or not the copy-assign can be trivial.
|
1264
|
+
template <class... T>
|
1265
|
+
using VariantCopyAssignBase = absl::conditional_t<
|
1266
|
+
absl::disjunction<
|
1267
|
+
absl::conjunction<absl::is_copy_assignable<Union<T...>>,
|
1268
|
+
std::is_copy_constructible<Union<T...>>,
|
1269
|
+
std::is_destructible<Union<T...>>>,
|
1270
|
+
absl::negation<absl::conjunction<std::is_copy_constructible<T>...,
|
1271
|
+
// Note: We're not qualifying this with
|
1272
|
+
// absl:: because it doesn't compile
|
1273
|
+
// under MSVC.
|
1274
|
+
is_copy_assignable<T>...>>>::value,
|
1275
|
+
VariantMoveAssignBase<T...>, VariantCopyAssignBaseNontrivial<T...>>;
|
1276
|
+
|
1277
|
+
template <class... T>
|
1278
|
+
using VariantBase = VariantCopyAssignBase<T...>;
|
1279
|
+
|
1280
|
+
template <class... T>
|
1281
|
+
class VariantStateBaseDestructorNontrivial : protected VariantStateBase<T...> {
|
1282
|
+
private:
|
1283
|
+
using Base = VariantStateBase<T...>;
|
1284
|
+
|
1285
|
+
protected:
|
1286
|
+
using Base::Base;
|
1287
|
+
|
1288
|
+
VariantStateBaseDestructorNontrivial() = default;
|
1289
|
+
VariantStateBaseDestructorNontrivial(VariantStateBaseDestructorNontrivial&&) =
|
1290
|
+
default;
|
1291
|
+
VariantStateBaseDestructorNontrivial(
|
1292
|
+
const VariantStateBaseDestructorNontrivial&) = default;
|
1293
|
+
VariantStateBaseDestructorNontrivial& operator=(
|
1294
|
+
VariantStateBaseDestructorNontrivial&&) = default;
|
1295
|
+
VariantStateBaseDestructorNontrivial& operator=(
|
1296
|
+
const VariantStateBaseDestructorNontrivial&) = default;
|
1297
|
+
|
1298
|
+
struct Destroyer {
|
1299
|
+
template <std::size_t I>
|
1300
|
+
void operator()(SizeT<I> i) const {
|
1301
|
+
using Alternative =
|
1302
|
+
typename absl::variant_alternative<I, variant<T...>>::type;
|
1303
|
+
variant_internal::AccessUnion(self->state_, i).~Alternative();
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
void operator()(SizeT<absl::variant_npos> /*i*/) const {
|
1307
|
+
// This space intentionally left blank
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
VariantStateBaseDestructorNontrivial* self;
|
1311
|
+
};
|
1312
|
+
|
1313
|
+
void destroy() { VisitIndices<sizeof...(T)>::Run(Destroyer{this}, index_); }
|
1314
|
+
|
1315
|
+
~VariantStateBaseDestructorNontrivial() { destroy(); }
|
1316
|
+
|
1317
|
+
protected:
|
1318
|
+
using Base::index_;
|
1319
|
+
using Base::state_;
|
1320
|
+
};
|
1321
|
+
|
1322
|
+
template <class... T>
|
1323
|
+
class VariantMoveBaseNontrivial : protected VariantStateBaseDestructor<T...> {
|
1324
|
+
private:
|
1325
|
+
using Base = VariantStateBaseDestructor<T...>;
|
1326
|
+
|
1327
|
+
protected:
|
1328
|
+
using Base::Base;
|
1329
|
+
|
1330
|
+
struct Construct {
|
1331
|
+
template <std::size_t I>
|
1332
|
+
void operator()(SizeT<I> i) const {
|
1333
|
+
using Alternative =
|
1334
|
+
typename absl::variant_alternative<I, variant<T...>>::type;
|
1335
|
+
::new (static_cast<void*>(&self->state_)) Alternative(
|
1336
|
+
variant_internal::AccessUnion(absl::move(other->state_), i));
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
void operator()(SizeT<absl::variant_npos> /*i*/) const {}
|
1340
|
+
|
1341
|
+
VariantMoveBaseNontrivial* self;
|
1342
|
+
VariantMoveBaseNontrivial* other;
|
1343
|
+
};
|
1344
|
+
|
1345
|
+
VariantMoveBaseNontrivial() = default;
|
1346
|
+
VariantMoveBaseNontrivial(VariantMoveBaseNontrivial&& other) noexcept(
|
1347
|
+
absl::conjunction<std::is_nothrow_move_constructible<T>...>::value)
|
1348
|
+
: Base(NoopConstructorTag()) {
|
1349
|
+
VisitIndices<sizeof...(T)>::Run(Construct{this, &other}, other.index_);
|
1350
|
+
index_ = other.index_;
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
VariantMoveBaseNontrivial(VariantMoveBaseNontrivial const&) = default;
|
1354
|
+
|
1355
|
+
VariantMoveBaseNontrivial& operator=(VariantMoveBaseNontrivial&&) = default;
|
1356
|
+
VariantMoveBaseNontrivial& operator=(VariantMoveBaseNontrivial const&) =
|
1357
|
+
default;
|
1358
|
+
|
1359
|
+
protected:
|
1360
|
+
using Base::index_;
|
1361
|
+
using Base::state_;
|
1362
|
+
};
|
1363
|
+
|
1364
|
+
template <class... T>
|
1365
|
+
class VariantCopyBaseNontrivial : protected VariantMoveBase<T...> {
|
1366
|
+
private:
|
1367
|
+
using Base = VariantMoveBase<T...>;
|
1368
|
+
|
1369
|
+
protected:
|
1370
|
+
using Base::Base;
|
1371
|
+
|
1372
|
+
VariantCopyBaseNontrivial() = default;
|
1373
|
+
VariantCopyBaseNontrivial(VariantCopyBaseNontrivial&&) = default;
|
1374
|
+
|
1375
|
+
struct Construct {
|
1376
|
+
template <std::size_t I>
|
1377
|
+
void operator()(SizeT<I> i) const {
|
1378
|
+
using Alternative =
|
1379
|
+
typename absl::variant_alternative<I, variant<T...>>::type;
|
1380
|
+
::new (static_cast<void*>(&self->state_))
|
1381
|
+
Alternative(variant_internal::AccessUnion(other->state_, i));
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
void operator()(SizeT<absl::variant_npos> /*i*/) const {}
|
1385
|
+
|
1386
|
+
VariantCopyBaseNontrivial* self;
|
1387
|
+
const VariantCopyBaseNontrivial* other;
|
1388
|
+
};
|
1389
|
+
|
1390
|
+
VariantCopyBaseNontrivial(VariantCopyBaseNontrivial const& other)
|
1391
|
+
: Base(NoopConstructorTag()) {
|
1392
|
+
VisitIndices<sizeof...(T)>::Run(Construct{this, &other}, other.index_);
|
1393
|
+
index_ = other.index_;
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
VariantCopyBaseNontrivial& operator=(VariantCopyBaseNontrivial&&) = default;
|
1397
|
+
VariantCopyBaseNontrivial& operator=(VariantCopyBaseNontrivial const&) =
|
1398
|
+
default;
|
1399
|
+
|
1400
|
+
protected:
|
1401
|
+
using Base::index_;
|
1402
|
+
using Base::state_;
|
1403
|
+
};
|
1404
|
+
|
1405
|
+
template <class... T>
|
1406
|
+
class VariantMoveAssignBaseNontrivial : protected VariantCopyBase<T...> {
|
1407
|
+
friend struct VariantCoreAccess;
|
1408
|
+
|
1409
|
+
private:
|
1410
|
+
using Base = VariantCopyBase<T...>;
|
1411
|
+
|
1412
|
+
protected:
|
1413
|
+
using Base::Base;
|
1414
|
+
|
1415
|
+
VariantMoveAssignBaseNontrivial() = default;
|
1416
|
+
VariantMoveAssignBaseNontrivial(VariantMoveAssignBaseNontrivial&&) = default;
|
1417
|
+
VariantMoveAssignBaseNontrivial(const VariantMoveAssignBaseNontrivial&) =
|
1418
|
+
default;
|
1419
|
+
VariantMoveAssignBaseNontrivial& operator=(
|
1420
|
+
VariantMoveAssignBaseNontrivial const&) = default;
|
1421
|
+
|
1422
|
+
VariantMoveAssignBaseNontrivial&
|
1423
|
+
operator=(VariantMoveAssignBaseNontrivial&& other) noexcept(
|
1424
|
+
absl::conjunction<std::is_nothrow_move_constructible<T>...,
|
1425
|
+
std::is_nothrow_move_assignable<T>...>::value) {
|
1426
|
+
VisitIndices<sizeof...(T)>::Run(
|
1427
|
+
VariantCoreAccess::MakeMoveAssignVisitor(this, &other), other.index_);
|
1428
|
+
return *this;
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
protected:
|
1432
|
+
using Base::index_;
|
1433
|
+
using Base::state_;
|
1434
|
+
};
|
1435
|
+
|
1436
|
+
template <class... T>
|
1437
|
+
class VariantCopyAssignBaseNontrivial : protected VariantMoveAssignBase<T...> {
|
1438
|
+
friend struct VariantCoreAccess;
|
1439
|
+
|
1440
|
+
private:
|
1441
|
+
using Base = VariantMoveAssignBase<T...>;
|
1442
|
+
|
1443
|
+
protected:
|
1444
|
+
using Base::Base;
|
1445
|
+
|
1446
|
+
VariantCopyAssignBaseNontrivial() = default;
|
1447
|
+
VariantCopyAssignBaseNontrivial(VariantCopyAssignBaseNontrivial&&) = default;
|
1448
|
+
VariantCopyAssignBaseNontrivial(const VariantCopyAssignBaseNontrivial&) =
|
1449
|
+
default;
|
1450
|
+
VariantCopyAssignBaseNontrivial& operator=(
|
1451
|
+
VariantCopyAssignBaseNontrivial&&) = default;
|
1452
|
+
|
1453
|
+
VariantCopyAssignBaseNontrivial& operator=(
|
1454
|
+
const VariantCopyAssignBaseNontrivial& other) {
|
1455
|
+
VisitIndices<sizeof...(T)>::Run(
|
1456
|
+
VariantCoreAccess::MakeCopyAssignVisitor(this, other), other.index_);
|
1457
|
+
return *this;
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
protected:
|
1461
|
+
using Base::index_;
|
1462
|
+
using Base::state_;
|
1463
|
+
};
|
1464
|
+
|
1465
|
+
////////////////////////////////////////
|
1466
|
+
// Visitors for Comparison Operations //
|
1467
|
+
////////////////////////////////////////
|
1468
|
+
|
1469
|
+
template <class... Types>
|
1470
|
+
struct EqualsOp {
|
1471
|
+
const variant<Types...>* v;
|
1472
|
+
const variant<Types...>* w;
|
1473
|
+
|
1474
|
+
constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
|
1475
|
+
return true;
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
template <std::size_t I>
|
1479
|
+
constexpr bool operator()(SizeT<I> /*v_i*/) const {
|
1480
|
+
return VariantCoreAccess::Access<I>(*v) == VariantCoreAccess::Access<I>(*w);
|
1481
|
+
}
|
1482
|
+
};
|
1483
|
+
|
1484
|
+
template <class... Types>
|
1485
|
+
struct NotEqualsOp {
|
1486
|
+
const variant<Types...>* v;
|
1487
|
+
const variant<Types...>* w;
|
1488
|
+
|
1489
|
+
constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
|
1490
|
+
return false;
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
template <std::size_t I>
|
1494
|
+
constexpr bool operator()(SizeT<I> /*v_i*/) const {
|
1495
|
+
return VariantCoreAccess::Access<I>(*v) != VariantCoreAccess::Access<I>(*w);
|
1496
|
+
}
|
1497
|
+
};
|
1498
|
+
|
1499
|
+
template <class... Types>
|
1500
|
+
struct LessThanOp {
|
1501
|
+
const variant<Types...>* v;
|
1502
|
+
const variant<Types...>* w;
|
1503
|
+
|
1504
|
+
constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
|
1505
|
+
return false;
|
1506
|
+
}
|
1507
|
+
|
1508
|
+
template <std::size_t I>
|
1509
|
+
constexpr bool operator()(SizeT<I> /*v_i*/) const {
|
1510
|
+
return VariantCoreAccess::Access<I>(*v) < VariantCoreAccess::Access<I>(*w);
|
1511
|
+
}
|
1512
|
+
};
|
1513
|
+
|
1514
|
+
template <class... Types>
|
1515
|
+
struct GreaterThanOp {
|
1516
|
+
const variant<Types...>* v;
|
1517
|
+
const variant<Types...>* w;
|
1518
|
+
|
1519
|
+
constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
|
1520
|
+
return false;
|
1521
|
+
}
|
1522
|
+
|
1523
|
+
template <std::size_t I>
|
1524
|
+
constexpr bool operator()(SizeT<I> /*v_i*/) const {
|
1525
|
+
return VariantCoreAccess::Access<I>(*v) > VariantCoreAccess::Access<I>(*w);
|
1526
|
+
}
|
1527
|
+
};
|
1528
|
+
|
1529
|
+
template <class... Types>
|
1530
|
+
struct LessThanOrEqualsOp {
|
1531
|
+
const variant<Types...>* v;
|
1532
|
+
const variant<Types...>* w;
|
1533
|
+
|
1534
|
+
constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
|
1535
|
+
return true;
|
1536
|
+
}
|
1537
|
+
|
1538
|
+
template <std::size_t I>
|
1539
|
+
constexpr bool operator()(SizeT<I> /*v_i*/) const {
|
1540
|
+
return VariantCoreAccess::Access<I>(*v) <= VariantCoreAccess::Access<I>(*w);
|
1541
|
+
}
|
1542
|
+
};
|
1543
|
+
|
1544
|
+
template <class... Types>
|
1545
|
+
struct GreaterThanOrEqualsOp {
|
1546
|
+
const variant<Types...>* v;
|
1547
|
+
const variant<Types...>* w;
|
1548
|
+
|
1549
|
+
constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
|
1550
|
+
return true;
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
template <std::size_t I>
|
1554
|
+
constexpr bool operator()(SizeT<I> /*v_i*/) const {
|
1555
|
+
return VariantCoreAccess::Access<I>(*v) >= VariantCoreAccess::Access<I>(*w);
|
1556
|
+
}
|
1557
|
+
};
|
1558
|
+
|
1559
|
+
// Precondition: v.index() == w.index();
|
1560
|
+
template <class... Types>
|
1561
|
+
struct SwapSameIndex {
|
1562
|
+
variant<Types...>* v;
|
1563
|
+
variant<Types...>* w;
|
1564
|
+
template <std::size_t I>
|
1565
|
+
void operator()(SizeT<I>) const {
|
1566
|
+
type_traits_internal::Swap(VariantCoreAccess::Access<I>(*v),
|
1567
|
+
VariantCoreAccess::Access<I>(*w));
|
1568
|
+
}
|
1569
|
+
|
1570
|
+
void operator()(SizeT<variant_npos>) const {}
|
1571
|
+
};
|
1572
|
+
|
1573
|
+
// TODO(calabrese) do this from a different namespace for proper adl usage
|
1574
|
+
template <class... Types>
|
1575
|
+
struct Swap {
|
1576
|
+
variant<Types...>* v;
|
1577
|
+
variant<Types...>* w;
|
1578
|
+
|
1579
|
+
void generic_swap() const {
|
1580
|
+
variant<Types...> tmp(std::move(*w));
|
1581
|
+
VariantCoreAccess::Destroy(*w);
|
1582
|
+
VariantCoreAccess::InitFrom(*w, std::move(*v));
|
1583
|
+
VariantCoreAccess::Destroy(*v);
|
1584
|
+
VariantCoreAccess::InitFrom(*v, std::move(tmp));
|
1585
|
+
}
|
1586
|
+
|
1587
|
+
void operator()(SizeT<absl::variant_npos> /*w_i*/) const {
|
1588
|
+
if (!v->valueless_by_exception()) {
|
1589
|
+
generic_swap();
|
1590
|
+
}
|
1591
|
+
}
|
1592
|
+
|
1593
|
+
template <std::size_t Wi>
|
1594
|
+
void operator()(SizeT<Wi> /*w_i*/) {
|
1595
|
+
if (v->index() == Wi) {
|
1596
|
+
VisitIndices<sizeof...(Types)>::Run(SwapSameIndex<Types...>{v, w}, Wi);
|
1597
|
+
} else {
|
1598
|
+
generic_swap();
|
1599
|
+
}
|
1600
|
+
}
|
1601
|
+
};
|
1602
|
+
|
1603
|
+
template <typename Variant, typename = void, typename... Ts>
|
1604
|
+
struct VariantHashBase {
|
1605
|
+
VariantHashBase() = delete;
|
1606
|
+
VariantHashBase(const VariantHashBase&) = delete;
|
1607
|
+
VariantHashBase(VariantHashBase&&) = delete;
|
1608
|
+
VariantHashBase& operator=(const VariantHashBase&) = delete;
|
1609
|
+
VariantHashBase& operator=(VariantHashBase&&) = delete;
|
1610
|
+
};
|
1611
|
+
|
1612
|
+
struct VariantHashVisitor {
|
1613
|
+
template <typename T>
|
1614
|
+
size_t operator()(const T& t) {
|
1615
|
+
return std::hash<T>{}(t);
|
1616
|
+
}
|
1617
|
+
};
|
1618
|
+
|
1619
|
+
template <typename Variant, typename... Ts>
|
1620
|
+
struct VariantHashBase<Variant,
|
1621
|
+
absl::enable_if_t<absl::conjunction<
|
1622
|
+
type_traits_internal::IsHashable<Ts>...>::value>,
|
1623
|
+
Ts...> {
|
1624
|
+
using argument_type = Variant;
|
1625
|
+
using result_type = size_t;
|
1626
|
+
size_t operator()(const Variant& var) const {
|
1627
|
+
type_traits_internal::AssertHashEnabled<Ts...>();
|
1628
|
+
if (var.valueless_by_exception()) {
|
1629
|
+
return 239799884;
|
1630
|
+
}
|
1631
|
+
size_t result = VisitIndices<variant_size<Variant>::value>::Run(
|
1632
|
+
PerformVisitation<VariantHashVisitor, const Variant&>{
|
1633
|
+
std::forward_as_tuple(var), VariantHashVisitor{}},
|
1634
|
+
var.index());
|
1635
|
+
// Combine the index and the hash result in order to distinguish
|
1636
|
+
// std::variant<int, int> holding the same value as different alternative.
|
1637
|
+
return result ^ var.index();
|
1638
|
+
}
|
1639
|
+
};
|
1640
|
+
|
1641
|
+
} // namespace variant_internal
|
1642
|
+
ABSL_NAMESPACE_END
|
1643
|
+
} // namespace absl
|
1644
|
+
|
1645
|
+
#endif // !defined(ABSL_USES_STD_VARIANT)
|
1646
|
+
#endif // ABSL_TYPES_variant_internal_H_
|