re2 1.23.0 → 1.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/binding.gyp +3 -2
- package/package.json +5 -5
- package/vendor/abseil-cpp/CMake/AbseilDll.cmake +25 -4
- package/vendor/abseil-cpp/CMake/AbseilHelpers.cmake +6 -1
- package/vendor/abseil-cpp/CMakeLists.txt +2 -2
- package/vendor/abseil-cpp/MODULE.bazel +2 -2
- package/vendor/abseil-cpp/absl/algorithm/BUILD.bazel +0 -1
- package/vendor/abseil-cpp/absl/algorithm/CMakeLists.txt +0 -2
- package/vendor/abseil-cpp/absl/algorithm/container.h +191 -140
- package/vendor/abseil-cpp/absl/algorithm/container_test.cc +818 -0
- package/vendor/abseil-cpp/absl/base/BUILD.bazel +44 -5
- package/vendor/abseil-cpp/absl/base/CMakeLists.txt +42 -3
- package/vendor/abseil-cpp/absl/base/attributes.h +5 -1
- package/vendor/abseil-cpp/absl/base/call_once_test.cc +10 -10
- package/vendor/abseil-cpp/absl/base/casts.cc +61 -0
- package/vendor/abseil-cpp/absl/base/casts.h +128 -2
- package/vendor/abseil-cpp/absl/base/casts_test.cc +151 -0
- package/vendor/abseil-cpp/absl/base/config.h +13 -37
- package/vendor/abseil-cpp/absl/base/internal/dynamic_annotations.h +1 -1
- package/vendor/abseil-cpp/absl/base/internal/iterator_traits.h +4 -0
- package/vendor/abseil-cpp/absl/base/internal/nullability_traits.h +71 -0
- package/vendor/abseil-cpp/absl/base/internal/nullability_traits_test.cc +98 -0
- package/vendor/abseil-cpp/absl/base/internal/raw_logging.cc +3 -4
- package/vendor/abseil-cpp/absl/base/internal/spinlock.cc +13 -7
- package/vendor/abseil-cpp/absl/base/internal/spinlock.h +16 -11
- package/vendor/abseil-cpp/absl/base/internal/strerror_test.cc +2 -1
- package/vendor/abseil-cpp/absl/base/internal/sysinfo.cc +0 -9
- package/vendor/abseil-cpp/absl/base/internal/sysinfo_test.cc +0 -6
- package/vendor/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +1 -1
- package/vendor/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +1 -1
- package/vendor/abseil-cpp/absl/base/macros.h +40 -17
- package/vendor/abseil-cpp/absl/base/nullability.h +1 -1
- package/vendor/abseil-cpp/absl/base/optimization.h +1 -3
- package/vendor/abseil-cpp/absl/base/options.h +1 -27
- package/vendor/abseil-cpp/absl/base/spinlock_test_common.cc +5 -8
- package/vendor/abseil-cpp/absl/cleanup/cleanup.h +4 -0
- package/vendor/abseil-cpp/absl/container/BUILD.bazel +195 -2
- package/vendor/abseil-cpp/absl/container/CMakeLists.txt +136 -2
- package/vendor/abseil-cpp/absl/container/btree_map.h +56 -6
- package/vendor/abseil-cpp/absl/container/btree_set.h +52 -6
- package/vendor/abseil-cpp/absl/container/btree_test.cc +107 -1
- package/vendor/abseil-cpp/absl/container/chunked_queue.h +755 -0
- package/vendor/abseil-cpp/absl/container/chunked_queue_benchmark.cc +386 -0
- package/vendor/abseil-cpp/absl/container/chunked_queue_test.cc +768 -0
- package/vendor/abseil-cpp/absl/container/fixed_array.h +4 -6
- package/vendor/abseil-cpp/absl/container/flat_hash_map.h +16 -6
- package/vendor/abseil-cpp/absl/container/flat_hash_map_test.cc +1 -2
- package/vendor/abseil-cpp/absl/container/flat_hash_set.h +16 -6
- package/vendor/abseil-cpp/absl/container/flat_hash_set_test.cc +0 -2
- package/vendor/abseil-cpp/absl/container/inlined_vector.h +12 -4
- package/vendor/abseil-cpp/absl/container/inlined_vector_test.cc +21 -0
- package/vendor/abseil-cpp/absl/container/internal/btree_container.h +14 -5
- package/vendor/abseil-cpp/absl/container/internal/chunked_queue.h +173 -0
- package/vendor/abseil-cpp/absl/container/internal/common.h +51 -0
- package/vendor/abseil-cpp/absl/container/internal/container_memory.h +7 -1
- package/vendor/abseil-cpp/absl/container/internal/container_memory_test.cc +11 -0
- package/vendor/abseil-cpp/absl/container/internal/hash_generator_testing.cc +0 -2
- package/vendor/abseil-cpp/absl/container/internal/hash_generator_testing.h +1 -2
- package/vendor/abseil-cpp/absl/container/internal/hash_policy_testing.h +0 -14
- package/vendor/abseil-cpp/absl/container/internal/hashtable_control_bytes.h +11 -8
- package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +3 -4
- package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler.h +23 -6
- package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler_test.cc +31 -15
- package/vendor/abseil-cpp/absl/container/internal/heterogeneous_lookup_testing.h +80 -0
- package/vendor/abseil-cpp/absl/container/internal/inlined_vector.h +4 -12
- package/vendor/abseil-cpp/absl/container/internal/raw_hash_map.h +35 -10
- package/vendor/abseil-cpp/absl/container/internal/raw_hash_set.cc +149 -23
- package/vendor/abseil-cpp/absl/container/internal/raw_hash_set.h +120 -126
- package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_allocator_test.cc +4 -0
- package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc +8 -0
- package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_probe_benchmark.cc +14 -59
- package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_test.cc +111 -22
- package/vendor/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h +53 -112
- package/vendor/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h +10 -15
- package/vendor/abseil-cpp/absl/container/internal/unordered_map_members_test.h +3 -3
- package/vendor/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h +45 -61
- package/vendor/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h +53 -112
- package/vendor/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h +6 -9
- package/vendor/abseil-cpp/absl/container/internal/unordered_set_members_test.h +3 -3
- package/vendor/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h +25 -31
- package/vendor/abseil-cpp/absl/container/linked_hash_map.h +666 -0
- package/vendor/abseil-cpp/absl/container/linked_hash_map_benchmark.cc +140 -0
- package/vendor/abseil-cpp/absl/container/linked_hash_map_test.cc +987 -0
- package/vendor/abseil-cpp/absl/container/linked_hash_set.h +527 -0
- package/vendor/abseil-cpp/absl/container/linked_hash_set_benchmark.cc +84 -0
- package/vendor/abseil-cpp/absl/container/linked_hash_set_test.cc +947 -0
- package/vendor/abseil-cpp/absl/container/node_hash_map.h +17 -6
- package/vendor/abseil-cpp/absl/container/node_hash_set.h +16 -5
- package/vendor/abseil-cpp/absl/container/node_hash_set_test.cc +1 -2
- package/vendor/abseil-cpp/absl/copts/GENERATED_AbseilCopts.cmake +79 -0
- package/vendor/abseil-cpp/absl/copts/GENERATED_copts.bzl +79 -0
- package/vendor/abseil-cpp/absl/copts/copts.py +17 -4
- package/vendor/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +67 -13
- package/vendor/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +4 -2
- package/vendor/abseil-cpp/absl/debugging/BUILD.bazel +31 -0
- package/vendor/abseil-cpp/absl/debugging/CMakeLists.txt +34 -0
- package/vendor/abseil-cpp/absl/debugging/failure_signal_handler.cc +2 -2
- package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer.cc +118 -0
- package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer.h +71 -0
- package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer_test.cc +97 -0
- package/vendor/abseil-cpp/absl/debugging/internal/demangle.cc +2 -2
- package/vendor/abseil-cpp/absl/debugging/internal/elf_mem_image.h +4 -4
- package/vendor/abseil-cpp/absl/debugging/internal/examine_stack.cc +4 -0
- package/vendor/abseil-cpp/absl/debugging/internal/examine_stack.h +7 -0
- package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +1 -1
- package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +0 -7
- package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +3 -2
- package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +2 -1
- package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +8 -3
- package/vendor/abseil-cpp/absl/debugging/internal/symbolize.h +2 -2
- package/vendor/abseil-cpp/absl/debugging/stacktrace.cc +35 -67
- package/vendor/abseil-cpp/absl/debugging/stacktrace.h +3 -0
- package/vendor/abseil-cpp/absl/debugging/stacktrace_benchmark.cc +24 -1
- package/vendor/abseil-cpp/absl/debugging/stacktrace_test.cc +39 -15
- package/vendor/abseil-cpp/absl/debugging/symbolize_emscripten.inc +4 -17
- package/vendor/abseil-cpp/absl/debugging/symbolize_test.cc +25 -40
- package/vendor/abseil-cpp/absl/debugging/symbolize_win32.inc +2 -4
- package/vendor/abseil-cpp/absl/flags/BUILD.bazel +1 -0
- package/vendor/abseil-cpp/absl/flags/declare.h +9 -0
- package/vendor/abseil-cpp/absl/flags/flag.h +2 -1
- package/vendor/abseil-cpp/absl/flags/internal/commandlineflag.h +1 -1
- package/vendor/abseil-cpp/absl/flags/internal/flag.cc +3 -2
- package/vendor/abseil-cpp/absl/flags/marshalling.cc +1 -16
- package/vendor/abseil-cpp/absl/flags/parse.cc +4 -2
- package/vendor/abseil-cpp/absl/flags/parse_test.cc +1 -1
- package/vendor/abseil-cpp/absl/flags/reflection.cc +4 -3
- package/vendor/abseil-cpp/absl/functional/BUILD.bazel +4 -0
- package/vendor/abseil-cpp/absl/functional/CMakeLists.txt +4 -0
- package/vendor/abseil-cpp/absl/functional/any_invocable.h +3 -1
- package/vendor/abseil-cpp/absl/functional/function_ref.h +125 -20
- package/vendor/abseil-cpp/absl/functional/function_ref_test.cc +122 -9
- package/vendor/abseil-cpp/absl/functional/internal/any_invocable.h +13 -2
- package/vendor/abseil-cpp/absl/functional/internal/function_ref.h +42 -4
- package/vendor/abseil-cpp/absl/hash/hash_benchmark.cc +11 -0
- package/vendor/abseil-cpp/absl/hash/hash_test.cc +5 -2
- package/vendor/abseil-cpp/absl/hash/internal/hash.cc +184 -53
- package/vendor/abseil-cpp/absl/hash/internal/hash.h +116 -10
- package/vendor/abseil-cpp/absl/hash/internal/low_level_hash_test.cc +43 -4
- package/vendor/abseil-cpp/absl/log/BUILD.bazel +2 -0
- package/vendor/abseil-cpp/absl/log/CMakeLists.txt +35 -1
- package/vendor/abseil-cpp/absl/log/check_test_impl.inc +59 -4
- package/vendor/abseil-cpp/absl/log/die_if_null.cc +3 -1
- package/vendor/abseil-cpp/absl/log/die_if_null.h +24 -3
- package/vendor/abseil-cpp/absl/log/internal/BUILD.bazel +31 -1
- package/vendor/abseil-cpp/absl/log/internal/check_impl.h +2 -1
- package/vendor/abseil-cpp/absl/log/internal/check_op.cc +3 -1
- package/vendor/abseil-cpp/absl/log/internal/check_op.h +44 -18
- package/vendor/abseil-cpp/absl/log/internal/conditions.h +38 -35
- package/vendor/abseil-cpp/absl/log/internal/container.h +312 -0
- package/vendor/abseil-cpp/absl/log/internal/container_test.cc +254 -0
- package/vendor/abseil-cpp/absl/log/internal/log_impl.h +108 -110
- package/vendor/abseil-cpp/absl/log/internal/log_message.cc +5 -2
- package/vendor/abseil-cpp/absl/log/internal/log_message.h +5 -1
- package/vendor/abseil-cpp/absl/log/internal/strip.h +30 -31
- package/vendor/abseil-cpp/absl/log/internal/vlog_config.cc +19 -19
- package/vendor/abseil-cpp/absl/log/internal/vlog_config.h +0 -1
- package/vendor/abseil-cpp/absl/log/log.h +2 -2
- package/vendor/abseil-cpp/absl/meta/BUILD.bazel +51 -0
- package/vendor/abseil-cpp/absl/meta/CMakeLists.txt +46 -0
- package/vendor/abseil-cpp/absl/meta/internal/constexpr_testing.h +73 -0
- package/vendor/abseil-cpp/absl/meta/internal/constexpr_testing_test.cc +40 -0
- package/vendor/abseil-cpp/absl/meta/internal/requires.h +67 -0
- package/vendor/abseil-cpp/absl/meta/internal/requires_test.cc +66 -0
- package/vendor/abseil-cpp/absl/meta/type_traits.h +42 -1
- package/vendor/abseil-cpp/absl/meta/type_traits_test.cc +14 -0
- package/vendor/abseil-cpp/absl/numeric/int128.h +41 -21
- package/vendor/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +16 -22
- package/vendor/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +5 -7
- package/vendor/abseil-cpp/absl/numeric/int128_test.cc +52 -5
- package/vendor/abseil-cpp/absl/profiling/BUILD.bazel +1 -0
- package/vendor/abseil-cpp/absl/profiling/CMakeLists.txt +1 -0
- package/vendor/abseil-cpp/absl/profiling/hashtable.cc +18 -7
- package/vendor/abseil-cpp/absl/profiling/internal/profile_builder.cc +1 -0
- package/vendor/abseil-cpp/absl/random/internal/fastmath_test.cc +3 -5
- package/vendor/abseil-cpp/absl/random/internal/platform.h +0 -13
- package/vendor/abseil-cpp/absl/random/internal/randen_engine_test.cc +0 -1
- package/vendor/abseil-cpp/absl/random/internal/seed_material.cc +1 -27
- package/vendor/abseil-cpp/absl/status/BUILD.bazel +17 -0
- package/vendor/abseil-cpp/absl/status/CMakeLists.txt +16 -0
- package/vendor/abseil-cpp/absl/status/internal/status_internal.h +4 -2
- package/vendor/abseil-cpp/absl/status/internal/status_matchers.h +2 -2
- package/vendor/abseil-cpp/absl/status/internal/statusor_internal.h +2 -1
- package/vendor/abseil-cpp/absl/status/status.cc +4 -0
- package/vendor/abseil-cpp/absl/status/status.h +5 -0
- package/vendor/abseil-cpp/absl/status/status_matchers.h +48 -0
- package/vendor/abseil-cpp/absl/status/status_matchers_test.cc +27 -0
- package/vendor/abseil-cpp/absl/status/status_test.cc +1 -0
- package/vendor/abseil-cpp/absl/status/statusor.h +1 -1
- package/vendor/abseil-cpp/absl/strings/BUILD.bazel +101 -21
- package/vendor/abseil-cpp/absl/strings/CMakeLists.txt +99 -5
- package/vendor/abseil-cpp/absl/strings/ascii.h +9 -4
- package/vendor/abseil-cpp/absl/strings/cord.cc +15 -10
- package/vendor/abseil-cpp/absl/strings/cord.h +1 -1
- package/vendor/abseil-cpp/absl/strings/escaping.cc +126 -94
- package/vendor/abseil-cpp/absl/strings/internal/append_and_overwrite.h +93 -0
- package/vendor/abseil-cpp/absl/strings/internal/append_and_overwrite_test.cc +95 -0
- package/vendor/abseil-cpp/absl/strings/internal/cord_internal.h +2 -0
- package/vendor/abseil-cpp/absl/strings/internal/cord_rep_btree_test.cc +8 -8
- package/vendor/abseil-cpp/absl/strings/internal/cordz_info.cc +24 -18
- package/vendor/abseil-cpp/absl/strings/internal/cordz_info.h +10 -16
- package/vendor/abseil-cpp/absl/strings/internal/escaping.h +9 -7
- package/vendor/abseil-cpp/absl/strings/internal/generic_printer.cc +107 -0
- package/vendor/abseil-cpp/absl/strings/internal/generic_printer.h +115 -0
- package/vendor/abseil-cpp/absl/strings/internal/generic_printer_internal.h +423 -0
- package/vendor/abseil-cpp/absl/strings/internal/generic_printer_test.cc +685 -0
- package/vendor/abseil-cpp/absl/strings/internal/resize_uninitialized.h +0 -12
- package/vendor/abseil-cpp/absl/strings/internal/str_format/checker.h +2 -4
- package/vendor/abseil-cpp/absl/strings/internal/str_format/convert_test.cc +21 -7
- package/vendor/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +495 -8
- package/vendor/abseil-cpp/absl/strings/internal/str_join_internal.h +18 -15
- package/vendor/abseil-cpp/absl/strings/numbers.cc +71 -8
- package/vendor/abseil-cpp/absl/strings/numbers.h +25 -12
- package/vendor/abseil-cpp/absl/strings/numbers_test.cc +70 -0
- package/vendor/abseil-cpp/absl/strings/resize_and_overwrite.h +194 -0
- package/vendor/abseil-cpp/absl/strings/resize_and_overwrite_test.cc +154 -0
- package/vendor/abseil-cpp/absl/strings/str_cat.cc +96 -91
- package/vendor/abseil-cpp/absl/strings/str_cat.h +17 -12
- package/vendor/abseil-cpp/absl/strings/str_format_test.cc +4 -4
- package/vendor/abseil-cpp/absl/strings/str_split.h +1 -1
- package/vendor/abseil-cpp/absl/strings/str_split_test.cc +1 -1
- package/vendor/abseil-cpp/absl/strings/string_view.h +8 -718
- package/vendor/abseil-cpp/absl/strings/string_view_test.cc +1 -1265
- package/vendor/abseil-cpp/absl/strings/substitute.cc +24 -24
- package/vendor/abseil-cpp/absl/synchronization/BUILD.bazel +2 -3
- package/vendor/abseil-cpp/absl/synchronization/CMakeLists.txt +1 -0
- package/vendor/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +2 -2
- package/vendor/abseil-cpp/absl/synchronization/internal/kernel_timeout_test.cc +15 -5
- package/vendor/abseil-cpp/absl/synchronization/mutex.cc +2 -1
- package/vendor/abseil-cpp/absl/synchronization/mutex.h +47 -23
- package/vendor/abseil-cpp/absl/synchronization/notification.h +1 -1
- package/vendor/abseil-cpp/absl/time/CMakeLists.txt +2 -0
- package/vendor/abseil-cpp/absl/time/civil_time_benchmark.cc +1 -2
- package/vendor/abseil-cpp/absl/time/civil_time_test.cc +58 -103
- package/vendor/abseil-cpp/absl/time/clock.cc +18 -16
- package/vendor/abseil-cpp/absl/time/clock_test.cc +2 -2
- package/vendor/abseil-cpp/absl/time/duration_benchmark.cc +144 -0
- package/vendor/abseil-cpp/absl/time/duration_test.cc +26 -29
- package/vendor/abseil-cpp/absl/time/internal/cctz/BUILD.bazel +7 -1
- package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +4 -2
- package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +6 -103
- package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.cc +186 -0
- package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.h +37 -0
- package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/version +1 -1
- package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Ensenada +0 -0
- package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Santa_Isabel +0 -0
- package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Tijuana +0 -0
- package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Mexico/BajaNorte +0 -0
- package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/iso3166.tab +9 -9
- package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab +12 -12
- package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zonenow.tab +47 -47
- package/vendor/abseil-cpp/absl/time/time.cc +4 -4
- package/vendor/abseil-cpp/absl/time/time.h +10 -10
- package/vendor/abseil-cpp/absl/time/time_test.cc +1 -0
- package/vendor/abseil-cpp/absl/types/compare.h +62 -61
- package/vendor/abseil-cpp/absl/types/compare_test.cc +3 -3
- package/vendor/abseil-cpp/absl/types/internal/span.h +1 -0
- package/vendor/abseil-cpp/absl/types/optional.h +2 -2
- package/vendor/abseil-cpp/absl/types/span.h +10 -2
- package/vendor/abseil-cpp/absl/utility/utility.h +13 -0
- package/vendor/abseil-cpp/ci/absl_alternate_options.h +0 -1
- package/vendor/abseil-cpp/ci/cmake_common.sh +1 -1
- package/vendor/abseil-cpp/ci/cmake_install_test.sh +6 -0
- package/vendor/abseil-cpp/ci/linux_arm_clang-latest_libcxx_bazel.sh +1 -0
- package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_asan_bazel.sh +2 -0
- package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_bazel.sh +1 -0
- package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_tsan_bazel.sh +1 -0
- package/vendor/abseil-cpp/ci/linux_clang-latest_libstdcxx_bazel.sh +1 -0
- package/vendor/abseil-cpp/ci/linux_gcc-floor_libstdcxx_bazel.sh +1 -0
- package/vendor/abseil-cpp/ci/linux_gcc-latest_libstdcxx_bazel.sh +1 -0
- package/vendor/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh +6 -0
- package/vendor/abseil-cpp/ci/linux_gcc_alpine_cmake.sh +6 -0
- package/vendor/abseil-cpp/ci/macos_xcode_bazel.sh +3 -2
- package/vendor/abseil-cpp/ci/macos_xcode_cmake.sh +5 -0
- package/vendor/abseil-cpp/ci/windows_clangcl_bazel.bat +1 -0
- package/vendor/abseil-cpp/ci/windows_msvc_bazel.bat +1 -0
- package/vendor/abseil-cpp/ci/windows_msvc_cmake.bat +6 -1
- package/vendor/abseil-cpp/absl/base/internal/identity.h +0 -39
- package/vendor/abseil-cpp/absl/strings/string_view.cc +0 -257
- package/vendor/abseil-cpp/absl/strings/string_view_benchmark.cc +0 -380
|
@@ -47,12 +47,14 @@
|
|
|
47
47
|
#define ABSL_FUNCTIONAL_FUNCTION_REF_H_
|
|
48
48
|
|
|
49
49
|
#include <cassert>
|
|
50
|
-
#include <functional>
|
|
51
50
|
#include <type_traits>
|
|
51
|
+
#include <utility>
|
|
52
52
|
|
|
53
53
|
#include "absl/base/attributes.h"
|
|
54
|
+
#include "absl/base/config.h"
|
|
54
55
|
#include "absl/functional/internal/function_ref.h"
|
|
55
56
|
#include "absl/meta/type_traits.h"
|
|
57
|
+
#include "absl/utility/utility.h"
|
|
56
58
|
|
|
57
59
|
namespace absl {
|
|
58
60
|
ABSL_NAMESPACE_BEGIN
|
|
@@ -83,42 +85,80 @@ class FunctionRef;
|
|
|
83
85
|
// bool Visitor(absl::FunctionRef<void(my_proto&, absl::string_view)>
|
|
84
86
|
// callback);
|
|
85
87
|
template <typename R, typename... Args>
|
|
86
|
-
class FunctionRef<R(Args...)> {
|
|
87
|
-
|
|
88
|
+
class ABSL_ATTRIBUTE_VIEW FunctionRef<R(Args...)> {
|
|
89
|
+
protected:
|
|
88
90
|
// Used to disable constructors for objects that are not compatible with the
|
|
89
91
|
// signature of this FunctionRef.
|
|
90
|
-
template <typename F, typename
|
|
92
|
+
template <typename F, typename... U>
|
|
91
93
|
using EnableIfCompatible =
|
|
92
|
-
|
|
93
|
-
std::is_convertible<FR, R>::value>::type;
|
|
94
|
+
std::enable_if_t<std::is_invocable_r<R, F, U..., Args...>::value>;
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
: invoker_(&absl::functional_internal::InvokeObject<F, R, Args...>) {
|
|
96
|
+
// Internal constructor to supersede the copying constructor
|
|
97
|
+
template <typename F>
|
|
98
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
99
|
+
FunctionRef(std::in_place_t, F&& f ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept
|
|
100
|
+
: invoker_(&absl::functional_internal::InvokeObject<F&, R, Args...>) {
|
|
101
101
|
absl::functional_internal::AssertNonNull(f);
|
|
102
102
|
ptr_.obj = &f;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
public:
|
|
106
|
+
// Constructs a FunctionRef from any invocable type.
|
|
107
|
+
template <typename F,
|
|
108
|
+
typename = EnableIfCompatible<std::enable_if_t<
|
|
109
|
+
!std::is_same_v<FunctionRef, absl::remove_cvref_t<F>>, F&>>>
|
|
110
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
111
|
+
FunctionRef(F&& f ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept
|
|
112
|
+
: FunctionRef(std::in_place, std::forward<F>(f)) {}
|
|
113
|
+
|
|
105
114
|
// Overload for function pointers. This eliminates a level of indirection that
|
|
106
115
|
// would happen if the above overload was used (it lets us store the pointer
|
|
107
116
|
// instead of a pointer to a pointer).
|
|
108
117
|
//
|
|
109
118
|
// This overload is also used for references to functions, since references to
|
|
110
119
|
// functions can decay to function pointers implicitly.
|
|
111
|
-
template <
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
FunctionRef(F* f)
|
|
120
|
+
template <typename F, typename = EnableIfCompatible<F*>,
|
|
121
|
+
absl::functional_internal::EnableIf<std::is_function_v<F>> = 0>
|
|
122
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
123
|
+
FunctionRef(F* f ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept
|
|
115
124
|
: invoker_(&absl::functional_internal::InvokeFunction<F*, R, Args...>) {
|
|
116
125
|
assert(f != nullptr);
|
|
117
126
|
ptr_.fun = reinterpret_cast<decltype(ptr_.fun)>(f);
|
|
118
127
|
}
|
|
119
128
|
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
|
|
130
|
+
// Similar to the other overloads, but passes the address of a known callable
|
|
131
|
+
// `F` at compile time. This allows calling arbitrary functions while avoiding
|
|
132
|
+
// an indirection.
|
|
133
|
+
// Needs C++20 as `nontype_t` needs C++20 for `auto` template parameters.
|
|
134
|
+
template <auto F, typename = EnableIfCompatible<decltype(F)>>
|
|
135
|
+
FunctionRef(nontype_t<F>) noexcept // NOLINT(google-explicit-constructor)
|
|
136
|
+
: invoker_(&absl::functional_internal::InvokeFunction<decltype(F), F, R,
|
|
137
|
+
Args...>) {}
|
|
138
|
+
|
|
139
|
+
template <
|
|
140
|
+
auto F, typename Obj,
|
|
141
|
+
typename = EnableIfCompatible<decltype(F), std::remove_reference_t<Obj>&>,
|
|
142
|
+
absl::functional_internal::EnableIf<!std::is_rvalue_reference_v<Obj&&>> =
|
|
143
|
+
0>
|
|
144
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
145
|
+
FunctionRef(nontype_t<F>, Obj&& obj ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept
|
|
146
|
+
: invoker_(&absl::functional_internal::InvokeObject<Obj&, decltype(F), F,
|
|
147
|
+
R, Args...>) {
|
|
148
|
+
ptr_.obj = std::addressof(obj);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
template <auto F, typename Obj,
|
|
152
|
+
typename = EnableIfCompatible<decltype(F), Obj*>>
|
|
153
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
154
|
+
FunctionRef(nontype_t<F>, Obj* obj ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept
|
|
155
|
+
: invoker_(&absl::functional_internal::InvokePtr<Obj, decltype(F), F, R,
|
|
156
|
+
Args...>) {
|
|
157
|
+
ptr_.obj = obj;
|
|
158
|
+
}
|
|
159
|
+
#endif
|
|
160
|
+
|
|
161
|
+
using absl_internal_is_view = std::true_type;
|
|
122
162
|
|
|
123
163
|
// Call the underlying object.
|
|
124
164
|
R operator()(Args... args) const {
|
|
@@ -133,11 +173,76 @@ class FunctionRef<R(Args...)> {
|
|
|
133
173
|
// Allow const qualified function signatures. Since FunctionRef requires
|
|
134
174
|
// constness anyway we can just make this a no-op.
|
|
135
175
|
template <typename R, typename... Args>
|
|
136
|
-
class
|
|
176
|
+
class ABSL_ATTRIBUTE_VIEW
|
|
177
|
+
FunctionRef<R(Args...) const> : private FunctionRef<R(Args...)> {
|
|
178
|
+
using Base = FunctionRef<R(Args...)>;
|
|
179
|
+
|
|
180
|
+
template <typename F, typename... U>
|
|
181
|
+
using EnableIfCompatible =
|
|
182
|
+
typename Base::template EnableIfCompatible<F, U...>;
|
|
183
|
+
|
|
137
184
|
public:
|
|
138
|
-
|
|
185
|
+
template <
|
|
186
|
+
typename F,
|
|
187
|
+
typename = EnableIfCompatible<std::enable_if_t<
|
|
188
|
+
!std::is_same_v<FunctionRef, absl::remove_cvref_t<F>>, const F&>>>
|
|
189
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
190
|
+
FunctionRef(const F& f ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept
|
|
191
|
+
: Base(std::in_place_t(), f) {}
|
|
192
|
+
|
|
193
|
+
template <typename F, typename = EnableIfCompatible<F*>,
|
|
194
|
+
absl::functional_internal::EnableIf<std::is_function_v<F>> = 0>
|
|
195
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
196
|
+
FunctionRef(F* f ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept : Base(f) {}
|
|
197
|
+
|
|
198
|
+
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
|
|
199
|
+
template <auto F, typename = EnableIfCompatible<decltype(F)>>
|
|
200
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
201
|
+
FunctionRef(nontype_t<F> arg) noexcept : Base(arg) {}
|
|
202
|
+
|
|
203
|
+
template <auto F, typename Obj,
|
|
204
|
+
typename = EnableIfCompatible<decltype(F),
|
|
205
|
+
const std::remove_reference_t<Obj>&>,
|
|
206
|
+
absl::functional_internal::EnableIf<
|
|
207
|
+
!std::is_rvalue_reference_v<Obj&&>> = 0>
|
|
208
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
209
|
+
FunctionRef(nontype_t<F> arg,
|
|
210
|
+
Obj&& obj ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept
|
|
211
|
+
: Base(arg, std::forward<Obj>(obj)) {}
|
|
212
|
+
|
|
213
|
+
template <auto F, typename Obj,
|
|
214
|
+
typename = EnableIfCompatible<decltype(F), const Obj*>>
|
|
215
|
+
// NOLINTNEXTLINE(google-explicit-constructor)
|
|
216
|
+
FunctionRef(nontype_t<F> arg,
|
|
217
|
+
const Obj* obj ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept
|
|
218
|
+
: Base(arg, obj) {}
|
|
219
|
+
#endif
|
|
220
|
+
|
|
221
|
+
using absl_internal_is_view = std::true_type;
|
|
222
|
+
|
|
223
|
+
using Base::operator();
|
|
139
224
|
};
|
|
140
225
|
|
|
226
|
+
template <class F>
|
|
227
|
+
FunctionRef(F*) -> FunctionRef<F>;
|
|
228
|
+
|
|
229
|
+
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
|
|
230
|
+
template <auto Func>
|
|
231
|
+
FunctionRef(nontype_t<Func>)
|
|
232
|
+
-> FunctionRef<std::remove_pointer_t<decltype(Func)>>;
|
|
233
|
+
|
|
234
|
+
template <class M, class T, M T::* Func, class U>
|
|
235
|
+
FunctionRef(nontype_t<Func>, U&&)
|
|
236
|
+
-> FunctionRef<std::enable_if_t<std::is_member_pointer_v<M T::*>, M>>;
|
|
237
|
+
|
|
238
|
+
template <class M, class T, M T::* Func, class U>
|
|
239
|
+
FunctionRef(nontype_t<Func>, U&&) -> FunctionRef<std::enable_if_t<
|
|
240
|
+
std::is_object_v<M>, std::invoke_result_t<decltype(Func), U&>()>>;
|
|
241
|
+
|
|
242
|
+
template <class R, class T, class... Args, R (*Func)(T, Args...), class U>
|
|
243
|
+
FunctionRef(nontype_t<Func>, U&&) -> FunctionRef<R(Args...)>;
|
|
244
|
+
#endif
|
|
245
|
+
|
|
141
246
|
ABSL_NAMESPACE_END
|
|
142
247
|
} // namespace absl
|
|
143
248
|
|
|
@@ -16,26 +16,36 @@
|
|
|
16
16
|
|
|
17
17
|
#include <functional>
|
|
18
18
|
#include <memory>
|
|
19
|
+
#include <type_traits>
|
|
20
|
+
#include <utility>
|
|
19
21
|
|
|
20
22
|
#include "gmock/gmock.h"
|
|
21
23
|
#include "gtest/gtest.h"
|
|
22
24
|
#include "absl/container/internal/test_instance_tracker.h"
|
|
23
25
|
#include "absl/functional/any_invocable.h"
|
|
24
26
|
#include "absl/memory/memory.h"
|
|
27
|
+
#include "absl/utility/utility.h"
|
|
25
28
|
|
|
26
29
|
namespace absl {
|
|
27
30
|
ABSL_NAMESPACE_BEGIN
|
|
28
31
|
namespace {
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
struct Class {
|
|
34
|
+
int Func() { return 42; }
|
|
35
|
+
int CFunc() const { return 43; }
|
|
36
|
+
};
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
int Function() { return 1337; }
|
|
39
|
+
|
|
40
|
+
template <typename T>
|
|
41
|
+
T Dereference(const T* v) {
|
|
42
|
+
return *v;
|
|
36
43
|
}
|
|
37
44
|
|
|
38
|
-
|
|
45
|
+
template <typename T>
|
|
46
|
+
T Copy(const T& v) {
|
|
47
|
+
return v;
|
|
48
|
+
}
|
|
39
49
|
|
|
40
50
|
TEST(FunctionRefTest, Function1) {
|
|
41
51
|
FunctionRef<int()> ref(&Function);
|
|
@@ -251,11 +261,11 @@ TEST(FunctionRef, PassByValueTypes) {
|
|
|
251
261
|
std::is_same<Invoker<void, Trivial>, void (*)(VoidPtr, Trivial)>::value,
|
|
252
262
|
"Small trivial types should be passed by value");
|
|
253
263
|
static_assert(std::is_same<Invoker<void, LargeTrivial>,
|
|
254
|
-
void (*)(VoidPtr, LargeTrivial
|
|
264
|
+
void (*)(VoidPtr, LargeTrivial&&)>::value,
|
|
255
265
|
"Large trivial types should be passed by rvalue reference");
|
|
256
266
|
static_assert(
|
|
257
267
|
std::is_same<Invoker<void, CopyableMovableInstance>,
|
|
258
|
-
void (*)(VoidPtr, CopyableMovableInstance
|
|
268
|
+
void (*)(VoidPtr, CopyableMovableInstance&&)>::value,
|
|
259
269
|
"Types with copy/move ctor should be passed by rvalue reference");
|
|
260
270
|
|
|
261
271
|
// References are passed as references.
|
|
@@ -268,7 +278,7 @@ TEST(FunctionRef, PassByValueTypes) {
|
|
|
268
278
|
"Reference types should be preserved");
|
|
269
279
|
static_assert(
|
|
270
280
|
std::is_same<Invoker<void, CopyableMovableInstance&&>,
|
|
271
|
-
void (*)(VoidPtr, CopyableMovableInstance
|
|
281
|
+
void (*)(VoidPtr, CopyableMovableInstance&&)>::value,
|
|
272
282
|
"Reference types should be preserved");
|
|
273
283
|
|
|
274
284
|
// Make sure the address of an object received by reference is the same as the
|
|
@@ -298,6 +308,109 @@ TEST(FunctionRef, ReferenceToIncompleteType) {
|
|
|
298
308
|
ref(obj);
|
|
299
309
|
}
|
|
300
310
|
|
|
311
|
+
TEST(FunctionRefTest, CorrectConstQualifiers) {
|
|
312
|
+
struct S {
|
|
313
|
+
int operator()() { return 42; }
|
|
314
|
+
int operator()() const { return 1337; }
|
|
315
|
+
};
|
|
316
|
+
S s;
|
|
317
|
+
EXPECT_EQ(42, FunctionRef<int()>(s)());
|
|
318
|
+
EXPECT_EQ(1337, FunctionRef<int() const>(s)());
|
|
319
|
+
EXPECT_EQ(1337, FunctionRef<int()>(std::as_const(s))());
|
|
320
|
+
EXPECT_EQ(1337, FunctionRef<int() const>(std::as_const(s))());
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
TEST(FunctionRefTest, Lambdas) {
|
|
324
|
+
// Stateless lambdas implicitly convert to function pointers, so their
|
|
325
|
+
// mutability is irrelevant.
|
|
326
|
+
EXPECT_TRUE(FunctionRef<bool()>([]() /*const*/ { return true; })());
|
|
327
|
+
EXPECT_TRUE(FunctionRef<bool()>([]() mutable { return true; })());
|
|
328
|
+
EXPECT_TRUE(FunctionRef<bool() const>([]() /*const*/ { return true; })());
|
|
329
|
+
#if defined(__clang__) || (ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L && \
|
|
330
|
+
defined(_MSC_VER) && !defined(__EDG__))
|
|
331
|
+
// MSVC has problems compiling the following code pre-C++20:
|
|
332
|
+
// const auto f = []() mutable {};
|
|
333
|
+
// f();
|
|
334
|
+
// EDG's MSVC-compatible mode (which Visual C++ uses for Intellisense)
|
|
335
|
+
// exhibits the bug in C++20 as well. So we don't support them.
|
|
336
|
+
EXPECT_TRUE(FunctionRef<bool() const>([]() mutable { return true; })());
|
|
337
|
+
#endif
|
|
338
|
+
|
|
339
|
+
// Stateful lambdas are not implicitly convertible to function pointers, so
|
|
340
|
+
// a const stateful lambda is not mutably callable.
|
|
341
|
+
EXPECT_TRUE(FunctionRef<bool()>([v = true]() /*const*/ { return v; })());
|
|
342
|
+
EXPECT_TRUE(FunctionRef<bool()>([v = true]() mutable { return v; })());
|
|
343
|
+
EXPECT_TRUE(
|
|
344
|
+
FunctionRef<bool() const>([v = true]() /*const*/ { return v; })());
|
|
345
|
+
const auto func = [v = true]() mutable { return v; };
|
|
346
|
+
static_assert(
|
|
347
|
+
!std::is_convertible_v<decltype(func), FunctionRef<bool() const>>);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
|
|
351
|
+
static_assert(std::is_same_v<decltype(FunctionRef(nontype<&Class::Func>,
|
|
352
|
+
std::declval<Class&>())),
|
|
353
|
+
FunctionRef<int()>>);
|
|
354
|
+
static_assert(std::is_same_v<decltype(FunctionRef(nontype<&Class::CFunc>,
|
|
355
|
+
std::declval<Class&>())),
|
|
356
|
+
FunctionRef<int() const>>);
|
|
357
|
+
|
|
358
|
+
static_assert(std::is_same_v<decltype(FunctionRef(nontype<&Class::Func>,
|
|
359
|
+
std::declval<Class*>())),
|
|
360
|
+
FunctionRef<int()>>);
|
|
361
|
+
static_assert(std::is_same_v<decltype(FunctionRef(nontype<&Class::CFunc>,
|
|
362
|
+
std::declval<Class*>())),
|
|
363
|
+
FunctionRef<int() const>>);
|
|
364
|
+
|
|
365
|
+
TEST(FunctionRefTest, NonTypeParameterWithTemporaries) {
|
|
366
|
+
static_assert(!std::is_constructible_v<FunctionRef<int()>,
|
|
367
|
+
nontype_t<&Class::Func>, Class&&>);
|
|
368
|
+
static_assert(
|
|
369
|
+
!std::is_constructible_v<FunctionRef<int()>, nontype_t<&Class::Func>,
|
|
370
|
+
const Class&&>);
|
|
371
|
+
static_assert(!std::is_constructible_v<FunctionRef<int() const>,
|
|
372
|
+
nontype_t<&Class::CFunc>, Class&&>);
|
|
373
|
+
static_assert(
|
|
374
|
+
!std::is_constructible_v<FunctionRef<int() const>,
|
|
375
|
+
nontype_t<&Class::CFunc>, const Class&&>);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
TEST(FunctionRefTest, NonTypeParameterWithDeductionGuides) {
|
|
379
|
+
EXPECT_EQ(1337, FunctionRef(nontype<&Function>)());
|
|
380
|
+
EXPECT_EQ(42, FunctionRef(nontype<&Copy<int>>,
|
|
381
|
+
std::integral_constant<int, 42>::value)());
|
|
382
|
+
EXPECT_EQ(42, FunctionRef(nontype<&Dereference<int>>,
|
|
383
|
+
&std::integral_constant<int, 42>::value)());
|
|
384
|
+
|
|
385
|
+
Class c;
|
|
386
|
+
EXPECT_EQ(42, FunctionRef<int()>(nontype<&Class::Func>, c)());
|
|
387
|
+
EXPECT_EQ(43, FunctionRef<int() const>(nontype<&Class::CFunc>, c)());
|
|
388
|
+
|
|
389
|
+
EXPECT_EQ(42, FunctionRef<int()>(nontype<&Class::Func>, &c)());
|
|
390
|
+
EXPECT_EQ(43, FunctionRef<int() const>(nontype<&Class::CFunc>, &c)());
|
|
391
|
+
}
|
|
392
|
+
#endif
|
|
393
|
+
|
|
394
|
+
TEST(FunctionRefTest, OptionalArguments) {
|
|
395
|
+
struct S {
|
|
396
|
+
int operator()(int = 0) const { return 1337; }
|
|
397
|
+
};
|
|
398
|
+
S s;
|
|
399
|
+
EXPECT_EQ(1337, FunctionRef<int()>(s)());
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
TEST(FunctionRefTest, NonConstToConstConversion) {
|
|
403
|
+
// The const-qualified version might inherit from the non-const version.
|
|
404
|
+
// We want to make sure that this doesn't introduce a bug when an instance of
|
|
405
|
+
// the base (non-const) class is forwarded through the derived (const) class.
|
|
406
|
+
// This has the potential to trigger the copy constructor, thus incorrectly
|
|
407
|
+
// producing a copy rather than another indirection.
|
|
408
|
+
absl::FunctionRef<int()> a = +[]() { return 1; };
|
|
409
|
+
absl::FunctionRef<int() const> b = a;
|
|
410
|
+
a = +[]() { return 2; };
|
|
411
|
+
EXPECT_EQ(b(), 2);
|
|
412
|
+
}
|
|
413
|
+
|
|
301
414
|
} // namespace
|
|
302
415
|
ABSL_NAMESPACE_END
|
|
303
416
|
} // namespace absl
|
|
@@ -159,10 +159,18 @@ using ForwardedParameterType = typename ForwardedParameter<T>::type;
|
|
|
159
159
|
// A discriminator when calling the "manager" function that describes operation
|
|
160
160
|
// type-erased operation should be invoked.
|
|
161
161
|
//
|
|
162
|
+
// "dispose" specifies that the manager should perform a destroy.
|
|
163
|
+
//
|
|
162
164
|
// "relocate_from_to" specifies that the manager should perform a move.
|
|
163
165
|
//
|
|
164
|
-
// "
|
|
165
|
-
|
|
166
|
+
// "relocate_from_to_and_query_rust" is identical to "relocate_from_to" for C++
|
|
167
|
+
// managers, but instructs Rust managers to perform a special operation that
|
|
168
|
+
// can be detected by the caller.
|
|
169
|
+
enum class FunctionToCall : unsigned char {
|
|
170
|
+
dispose,
|
|
171
|
+
relocate_from_to,
|
|
172
|
+
relocate_from_to_and_query_rust,
|
|
173
|
+
};
|
|
166
174
|
|
|
167
175
|
// The portion of `AnyInvocable` state that contains either a pointer to the
|
|
168
176
|
// target object or the object itself in local storage
|
|
@@ -243,6 +251,7 @@ void LocalManagerNontrivial(FunctionToCall operation,
|
|
|
243
251
|
|
|
244
252
|
switch (operation) {
|
|
245
253
|
case FunctionToCall::relocate_from_to:
|
|
254
|
+
case FunctionToCall::relocate_from_to_and_query_rust:
|
|
246
255
|
// NOTE: Requires that the left-hand operand is already empty.
|
|
247
256
|
::new (static_cast<void*>(&to->storage)) T(std::move(from_object));
|
|
248
257
|
ABSL_FALLTHROUGH_INTENDED;
|
|
@@ -277,6 +286,7 @@ inline void RemoteManagerTrivial(FunctionToCall operation,
|
|
|
277
286
|
TypeErasedState* const to) noexcept {
|
|
278
287
|
switch (operation) {
|
|
279
288
|
case FunctionToCall::relocate_from_to:
|
|
289
|
+
case FunctionToCall::relocate_from_to_and_query_rust:
|
|
280
290
|
// NOTE: Requires that the left-hand operand is already empty.
|
|
281
291
|
to->remote = from->remote;
|
|
282
292
|
return;
|
|
@@ -303,6 +313,7 @@ void RemoteManagerNontrivial(FunctionToCall operation,
|
|
|
303
313
|
|
|
304
314
|
switch (operation) {
|
|
305
315
|
case FunctionToCall::relocate_from_to:
|
|
316
|
+
case FunctionToCall::relocate_from_to_and_query_rust:
|
|
306
317
|
// NOTE: Requires that the left-hand operand is already empty.
|
|
307
318
|
to->remote.target = from->remote.target;
|
|
308
319
|
return;
|
|
@@ -72,14 +72,52 @@ using Invoker = R (*)(VoidPtr, typename ForwardT<Args>::type...);
|
|
|
72
72
|
// static_cast<R> handles the case the return type is void.
|
|
73
73
|
template <typename Obj, typename R, typename... Args>
|
|
74
74
|
R InvokeObject(VoidPtr ptr, typename ForwardT<Args>::type... args) {
|
|
75
|
-
|
|
76
|
-
return static_cast<R>(std::invoke(
|
|
75
|
+
using T = std::remove_reference_t<Obj>;
|
|
76
|
+
return static_cast<R>(std::invoke(
|
|
77
|
+
std::forward<Obj>(*const_cast<T*>(static_cast<const T*>(ptr.obj))),
|
|
78
|
+
std::forward<typename ForwardT<Args>::type>(args)...));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
template <typename Obj, typename Fun, Fun F, typename R, typename... Args>
|
|
82
|
+
R InvokeObject(VoidPtr ptr, typename ForwardT<Args>::type... args) {
|
|
83
|
+
using T = std::remove_reference_t<Obj>;
|
|
84
|
+
Obj&& obj =
|
|
85
|
+
std::forward<Obj>(*const_cast<T*>(static_cast<const T*>(ptr.obj)));
|
|
86
|
+
// Avoid std::invoke() since the callee is a known function at compile time
|
|
87
|
+
if constexpr (std::is_member_function_pointer_v<Fun>) {
|
|
88
|
+
return static_cast<R>((std::forward<Obj>(obj).*F)(
|
|
89
|
+
std::forward<typename ForwardT<Args>::type>(args)...));
|
|
90
|
+
} else {
|
|
91
|
+
return static_cast<R>(
|
|
92
|
+
F(std::forward<Obj>(obj),
|
|
93
|
+
std::forward<typename ForwardT<Args>::type>(args)...));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
template <typename T, typename Fun, Fun F, typename R, typename... Args>
|
|
98
|
+
R InvokePtr(VoidPtr ptr, typename ForwardT<Args>::type... args) {
|
|
99
|
+
T* obj = const_cast<T*>(static_cast<const T*>(ptr.obj));
|
|
100
|
+
// Avoid std::invoke() since the callee is a known function at compile time
|
|
101
|
+
if constexpr (std::is_member_function_pointer_v<Fun>) {
|
|
102
|
+
return static_cast<R>(
|
|
103
|
+
(obj->*F)(std::forward<typename ForwardT<Args>::type>(args)...));
|
|
104
|
+
} else {
|
|
105
|
+
return static_cast<R>(
|
|
106
|
+
F(obj, std::forward<typename ForwardT<Args>::type>(args)...));
|
|
107
|
+
}
|
|
77
108
|
}
|
|
78
109
|
|
|
79
110
|
template <typename Fun, typename R, typename... Args>
|
|
80
111
|
R InvokeFunction(VoidPtr ptr, typename ForwardT<Args>::type... args) {
|
|
81
112
|
auto f = reinterpret_cast<Fun>(ptr.fun);
|
|
82
|
-
return static_cast<R>(
|
|
113
|
+
return static_cast<R>(
|
|
114
|
+
std::invoke(f, std::forward<typename ForwardT<Args>::type>(args)...));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
template <typename Fun, Fun F, typename R, typename... Args>
|
|
118
|
+
R InvokeFunction(VoidPtr, typename ForwardT<Args>::type... args) {
|
|
119
|
+
return static_cast<R>(
|
|
120
|
+
F(std::forward<typename ForwardT<Args>::type>(args)...));
|
|
83
121
|
}
|
|
84
122
|
|
|
85
123
|
template <typename Sig>
|
|
@@ -98,7 +136,7 @@ template <typename F>
|
|
|
98
136
|
void AssertNonNull(const F&) {}
|
|
99
137
|
|
|
100
138
|
template <typename F, typename C>
|
|
101
|
-
void AssertNonNull(F C::*f) {
|
|
139
|
+
void AssertNonNull(F C::* f) {
|
|
102
140
|
assert(f != nullptr);
|
|
103
141
|
(void)f;
|
|
104
142
|
}
|
|
@@ -338,6 +338,16 @@ ABSL_ATTRIBUTE_UNUSED static const bool kInitialized = [] {
|
|
|
338
338
|
}();
|
|
339
339
|
} // namespace
|
|
340
340
|
|
|
341
|
+
struct PodPairInt64 {
|
|
342
|
+
int64_t a;
|
|
343
|
+
int64_t b;
|
|
344
|
+
|
|
345
|
+
template <typename H>
|
|
346
|
+
friend H AbslHashValue(H h, const PodPairInt64& p) {
|
|
347
|
+
return H::combine(std::move(h), p.a, p.b);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
341
351
|
template <class T>
|
|
342
352
|
struct PodRand {
|
|
343
353
|
static_assert(std::is_pod<T>::value, "");
|
|
@@ -378,6 +388,7 @@ struct StringRand {
|
|
|
378
388
|
|
|
379
389
|
MAKE_LATENCY_BENCHMARK(AbslHash, Int32, PodRand<int32_t>)
|
|
380
390
|
MAKE_LATENCY_BENCHMARK(AbslHash, Int64, PodRand<int64_t>)
|
|
391
|
+
MAKE_LATENCY_BENCHMARK(AbslHash, PairInt64, PodRand<PodPairInt64>)
|
|
381
392
|
MAKE_LATENCY_BENCHMARK(AbslHash, String3, StringRand<3>)
|
|
382
393
|
MAKE_LATENCY_BENCHMARK(AbslHash, String5, StringRand<5>)
|
|
383
394
|
MAKE_LATENCY_BENCHMARK(AbslHash, String9, StringRand<9>)
|
|
@@ -1242,6 +1242,9 @@ TEST(HashOf, DoubleSignCollision) {
|
|
|
1242
1242
|
|
|
1243
1243
|
// Test for collisions in short strings if PrecombineLengthMix is low quality.
|
|
1244
1244
|
TEST(PrecombineLengthMix, ShortStringCollision) {
|
|
1245
|
+
#if defined(__wasm__)
|
|
1246
|
+
GTEST_SKIP() << "Fails flakily on wasm due to no ASLR and 32-bit size_t.";
|
|
1247
|
+
#endif
|
|
1245
1248
|
std::string s1 = "00";
|
|
1246
1249
|
std::string s2 = "000";
|
|
1247
1250
|
constexpr char kMinChar = 0;
|
|
@@ -1281,7 +1284,7 @@ TEST(SwisstableCollisions, LowEntropyStrings) {
|
|
|
1281
1284
|
constexpr char kMinChar = 0;
|
|
1282
1285
|
constexpr char kMaxChar = 64;
|
|
1283
1286
|
// These sizes cover the different hashing cases.
|
|
1284
|
-
for (size_t size : {8u, 16u, 32u, 64u}) {
|
|
1287
|
+
for (size_t size : {8u, 16u, 32u, 64u, 128u}) {
|
|
1285
1288
|
for (size_t b = 0; b < size - 1; ++b) {
|
|
1286
1289
|
absl::flat_hash_set<std::string> set;
|
|
1287
1290
|
std::string s(size, '\0');
|
|
@@ -1308,7 +1311,7 @@ TEST(SwisstableCollisions, LowEntropyInts) {
|
|
|
1308
1311
|
for (size_t i = 0; i < 128 * 1024; ++i) {
|
|
1309
1312
|
size_t v = absl::rotl(i, bit);
|
|
1310
1313
|
set.insert(v);
|
|
1311
|
-
ASSERT_LT(HashtableDebugAccess<decltype(set)>::GetNumProbes(set, v),
|
|
1314
|
+
ASSERT_LT(HashtableDebugAccess<decltype(set)>::GetNumProbes(set, v), 48)
|
|
1312
1315
|
<< bit << " " << i;
|
|
1313
1316
|
}
|
|
1314
1317
|
}
|