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.
Files changed (280) hide show
  1. package/README.md +2 -0
  2. package/binding.gyp +3 -2
  3. package/package.json +5 -5
  4. package/vendor/abseil-cpp/CMake/AbseilDll.cmake +25 -4
  5. package/vendor/abseil-cpp/CMake/AbseilHelpers.cmake +6 -1
  6. package/vendor/abseil-cpp/CMakeLists.txt +2 -2
  7. package/vendor/abseil-cpp/MODULE.bazel +2 -2
  8. package/vendor/abseil-cpp/absl/algorithm/BUILD.bazel +0 -1
  9. package/vendor/abseil-cpp/absl/algorithm/CMakeLists.txt +0 -2
  10. package/vendor/abseil-cpp/absl/algorithm/container.h +191 -140
  11. package/vendor/abseil-cpp/absl/algorithm/container_test.cc +818 -0
  12. package/vendor/abseil-cpp/absl/base/BUILD.bazel +44 -5
  13. package/vendor/abseil-cpp/absl/base/CMakeLists.txt +42 -3
  14. package/vendor/abseil-cpp/absl/base/attributes.h +5 -1
  15. package/vendor/abseil-cpp/absl/base/call_once_test.cc +10 -10
  16. package/vendor/abseil-cpp/absl/base/casts.cc +61 -0
  17. package/vendor/abseil-cpp/absl/base/casts.h +128 -2
  18. package/vendor/abseil-cpp/absl/base/casts_test.cc +151 -0
  19. package/vendor/abseil-cpp/absl/base/config.h +13 -37
  20. package/vendor/abseil-cpp/absl/base/internal/dynamic_annotations.h +1 -1
  21. package/vendor/abseil-cpp/absl/base/internal/iterator_traits.h +4 -0
  22. package/vendor/abseil-cpp/absl/base/internal/nullability_traits.h +71 -0
  23. package/vendor/abseil-cpp/absl/base/internal/nullability_traits_test.cc +98 -0
  24. package/vendor/abseil-cpp/absl/base/internal/raw_logging.cc +3 -4
  25. package/vendor/abseil-cpp/absl/base/internal/spinlock.cc +13 -7
  26. package/vendor/abseil-cpp/absl/base/internal/spinlock.h +16 -11
  27. package/vendor/abseil-cpp/absl/base/internal/strerror_test.cc +2 -1
  28. package/vendor/abseil-cpp/absl/base/internal/sysinfo.cc +0 -9
  29. package/vendor/abseil-cpp/absl/base/internal/sysinfo_test.cc +0 -6
  30. package/vendor/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +1 -1
  31. package/vendor/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +1 -1
  32. package/vendor/abseil-cpp/absl/base/macros.h +40 -17
  33. package/vendor/abseil-cpp/absl/base/nullability.h +1 -1
  34. package/vendor/abseil-cpp/absl/base/optimization.h +1 -3
  35. package/vendor/abseil-cpp/absl/base/options.h +1 -27
  36. package/vendor/abseil-cpp/absl/base/spinlock_test_common.cc +5 -8
  37. package/vendor/abseil-cpp/absl/cleanup/cleanup.h +4 -0
  38. package/vendor/abseil-cpp/absl/container/BUILD.bazel +195 -2
  39. package/vendor/abseil-cpp/absl/container/CMakeLists.txt +136 -2
  40. package/vendor/abseil-cpp/absl/container/btree_map.h +56 -6
  41. package/vendor/abseil-cpp/absl/container/btree_set.h +52 -6
  42. package/vendor/abseil-cpp/absl/container/btree_test.cc +107 -1
  43. package/vendor/abseil-cpp/absl/container/chunked_queue.h +755 -0
  44. package/vendor/abseil-cpp/absl/container/chunked_queue_benchmark.cc +386 -0
  45. package/vendor/abseil-cpp/absl/container/chunked_queue_test.cc +768 -0
  46. package/vendor/abseil-cpp/absl/container/fixed_array.h +4 -6
  47. package/vendor/abseil-cpp/absl/container/flat_hash_map.h +16 -6
  48. package/vendor/abseil-cpp/absl/container/flat_hash_map_test.cc +1 -2
  49. package/vendor/abseil-cpp/absl/container/flat_hash_set.h +16 -6
  50. package/vendor/abseil-cpp/absl/container/flat_hash_set_test.cc +0 -2
  51. package/vendor/abseil-cpp/absl/container/inlined_vector.h +12 -4
  52. package/vendor/abseil-cpp/absl/container/inlined_vector_test.cc +21 -0
  53. package/vendor/abseil-cpp/absl/container/internal/btree_container.h +14 -5
  54. package/vendor/abseil-cpp/absl/container/internal/chunked_queue.h +173 -0
  55. package/vendor/abseil-cpp/absl/container/internal/common.h +51 -0
  56. package/vendor/abseil-cpp/absl/container/internal/container_memory.h +7 -1
  57. package/vendor/abseil-cpp/absl/container/internal/container_memory_test.cc +11 -0
  58. package/vendor/abseil-cpp/absl/container/internal/hash_generator_testing.cc +0 -2
  59. package/vendor/abseil-cpp/absl/container/internal/hash_generator_testing.h +1 -2
  60. package/vendor/abseil-cpp/absl/container/internal/hash_policy_testing.h +0 -14
  61. package/vendor/abseil-cpp/absl/container/internal/hashtable_control_bytes.h +11 -8
  62. package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +3 -4
  63. package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler.h +23 -6
  64. package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler_test.cc +31 -15
  65. package/vendor/abseil-cpp/absl/container/internal/heterogeneous_lookup_testing.h +80 -0
  66. package/vendor/abseil-cpp/absl/container/internal/inlined_vector.h +4 -12
  67. package/vendor/abseil-cpp/absl/container/internal/raw_hash_map.h +35 -10
  68. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set.cc +149 -23
  69. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set.h +120 -126
  70. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_allocator_test.cc +4 -0
  71. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc +8 -0
  72. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_probe_benchmark.cc +14 -59
  73. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_test.cc +111 -22
  74. package/vendor/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h +53 -112
  75. package/vendor/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h +10 -15
  76. package/vendor/abseil-cpp/absl/container/internal/unordered_map_members_test.h +3 -3
  77. package/vendor/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h +45 -61
  78. package/vendor/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h +53 -112
  79. package/vendor/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h +6 -9
  80. package/vendor/abseil-cpp/absl/container/internal/unordered_set_members_test.h +3 -3
  81. package/vendor/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h +25 -31
  82. package/vendor/abseil-cpp/absl/container/linked_hash_map.h +666 -0
  83. package/vendor/abseil-cpp/absl/container/linked_hash_map_benchmark.cc +140 -0
  84. package/vendor/abseil-cpp/absl/container/linked_hash_map_test.cc +987 -0
  85. package/vendor/abseil-cpp/absl/container/linked_hash_set.h +527 -0
  86. package/vendor/abseil-cpp/absl/container/linked_hash_set_benchmark.cc +84 -0
  87. package/vendor/abseil-cpp/absl/container/linked_hash_set_test.cc +947 -0
  88. package/vendor/abseil-cpp/absl/container/node_hash_map.h +17 -6
  89. package/vendor/abseil-cpp/absl/container/node_hash_set.h +16 -5
  90. package/vendor/abseil-cpp/absl/container/node_hash_set_test.cc +1 -2
  91. package/vendor/abseil-cpp/absl/copts/GENERATED_AbseilCopts.cmake +79 -0
  92. package/vendor/abseil-cpp/absl/copts/GENERATED_copts.bzl +79 -0
  93. package/vendor/abseil-cpp/absl/copts/copts.py +17 -4
  94. package/vendor/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +67 -13
  95. package/vendor/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +4 -2
  96. package/vendor/abseil-cpp/absl/debugging/BUILD.bazel +31 -0
  97. package/vendor/abseil-cpp/absl/debugging/CMakeLists.txt +34 -0
  98. package/vendor/abseil-cpp/absl/debugging/failure_signal_handler.cc +2 -2
  99. package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer.cc +118 -0
  100. package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer.h +71 -0
  101. package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer_test.cc +97 -0
  102. package/vendor/abseil-cpp/absl/debugging/internal/demangle.cc +2 -2
  103. package/vendor/abseil-cpp/absl/debugging/internal/elf_mem_image.h +4 -4
  104. package/vendor/abseil-cpp/absl/debugging/internal/examine_stack.cc +4 -0
  105. package/vendor/abseil-cpp/absl/debugging/internal/examine_stack.h +7 -0
  106. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +1 -1
  107. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +0 -7
  108. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +3 -2
  109. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +2 -1
  110. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +8 -3
  111. package/vendor/abseil-cpp/absl/debugging/internal/symbolize.h +2 -2
  112. package/vendor/abseil-cpp/absl/debugging/stacktrace.cc +35 -67
  113. package/vendor/abseil-cpp/absl/debugging/stacktrace.h +3 -0
  114. package/vendor/abseil-cpp/absl/debugging/stacktrace_benchmark.cc +24 -1
  115. package/vendor/abseil-cpp/absl/debugging/stacktrace_test.cc +39 -15
  116. package/vendor/abseil-cpp/absl/debugging/symbolize_emscripten.inc +4 -17
  117. package/vendor/abseil-cpp/absl/debugging/symbolize_test.cc +25 -40
  118. package/vendor/abseil-cpp/absl/debugging/symbolize_win32.inc +2 -4
  119. package/vendor/abseil-cpp/absl/flags/BUILD.bazel +1 -0
  120. package/vendor/abseil-cpp/absl/flags/declare.h +9 -0
  121. package/vendor/abseil-cpp/absl/flags/flag.h +2 -1
  122. package/vendor/abseil-cpp/absl/flags/internal/commandlineflag.h +1 -1
  123. package/vendor/abseil-cpp/absl/flags/internal/flag.cc +3 -2
  124. package/vendor/abseil-cpp/absl/flags/marshalling.cc +1 -16
  125. package/vendor/abseil-cpp/absl/flags/parse.cc +4 -2
  126. package/vendor/abseil-cpp/absl/flags/parse_test.cc +1 -1
  127. package/vendor/abseil-cpp/absl/flags/reflection.cc +4 -3
  128. package/vendor/abseil-cpp/absl/functional/BUILD.bazel +4 -0
  129. package/vendor/abseil-cpp/absl/functional/CMakeLists.txt +4 -0
  130. package/vendor/abseil-cpp/absl/functional/any_invocable.h +3 -1
  131. package/vendor/abseil-cpp/absl/functional/function_ref.h +125 -20
  132. package/vendor/abseil-cpp/absl/functional/function_ref_test.cc +122 -9
  133. package/vendor/abseil-cpp/absl/functional/internal/any_invocable.h +13 -2
  134. package/vendor/abseil-cpp/absl/functional/internal/function_ref.h +42 -4
  135. package/vendor/abseil-cpp/absl/hash/hash_benchmark.cc +11 -0
  136. package/vendor/abseil-cpp/absl/hash/hash_test.cc +5 -2
  137. package/vendor/abseil-cpp/absl/hash/internal/hash.cc +184 -53
  138. package/vendor/abseil-cpp/absl/hash/internal/hash.h +116 -10
  139. package/vendor/abseil-cpp/absl/hash/internal/low_level_hash_test.cc +43 -4
  140. package/vendor/abseil-cpp/absl/log/BUILD.bazel +2 -0
  141. package/vendor/abseil-cpp/absl/log/CMakeLists.txt +35 -1
  142. package/vendor/abseil-cpp/absl/log/check_test_impl.inc +59 -4
  143. package/vendor/abseil-cpp/absl/log/die_if_null.cc +3 -1
  144. package/vendor/abseil-cpp/absl/log/die_if_null.h +24 -3
  145. package/vendor/abseil-cpp/absl/log/internal/BUILD.bazel +31 -1
  146. package/vendor/abseil-cpp/absl/log/internal/check_impl.h +2 -1
  147. package/vendor/abseil-cpp/absl/log/internal/check_op.cc +3 -1
  148. package/vendor/abseil-cpp/absl/log/internal/check_op.h +44 -18
  149. package/vendor/abseil-cpp/absl/log/internal/conditions.h +38 -35
  150. package/vendor/abseil-cpp/absl/log/internal/container.h +312 -0
  151. package/vendor/abseil-cpp/absl/log/internal/container_test.cc +254 -0
  152. package/vendor/abseil-cpp/absl/log/internal/log_impl.h +108 -110
  153. package/vendor/abseil-cpp/absl/log/internal/log_message.cc +5 -2
  154. package/vendor/abseil-cpp/absl/log/internal/log_message.h +5 -1
  155. package/vendor/abseil-cpp/absl/log/internal/strip.h +30 -31
  156. package/vendor/abseil-cpp/absl/log/internal/vlog_config.cc +19 -19
  157. package/vendor/abseil-cpp/absl/log/internal/vlog_config.h +0 -1
  158. package/vendor/abseil-cpp/absl/log/log.h +2 -2
  159. package/vendor/abseil-cpp/absl/meta/BUILD.bazel +51 -0
  160. package/vendor/abseil-cpp/absl/meta/CMakeLists.txt +46 -0
  161. package/vendor/abseil-cpp/absl/meta/internal/constexpr_testing.h +73 -0
  162. package/vendor/abseil-cpp/absl/meta/internal/constexpr_testing_test.cc +40 -0
  163. package/vendor/abseil-cpp/absl/meta/internal/requires.h +67 -0
  164. package/vendor/abseil-cpp/absl/meta/internal/requires_test.cc +66 -0
  165. package/vendor/abseil-cpp/absl/meta/type_traits.h +42 -1
  166. package/vendor/abseil-cpp/absl/meta/type_traits_test.cc +14 -0
  167. package/vendor/abseil-cpp/absl/numeric/int128.h +41 -21
  168. package/vendor/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +16 -22
  169. package/vendor/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +5 -7
  170. package/vendor/abseil-cpp/absl/numeric/int128_test.cc +52 -5
  171. package/vendor/abseil-cpp/absl/profiling/BUILD.bazel +1 -0
  172. package/vendor/abseil-cpp/absl/profiling/CMakeLists.txt +1 -0
  173. package/vendor/abseil-cpp/absl/profiling/hashtable.cc +18 -7
  174. package/vendor/abseil-cpp/absl/profiling/internal/profile_builder.cc +1 -0
  175. package/vendor/abseil-cpp/absl/random/internal/fastmath_test.cc +3 -5
  176. package/vendor/abseil-cpp/absl/random/internal/platform.h +0 -13
  177. package/vendor/abseil-cpp/absl/random/internal/randen_engine_test.cc +0 -1
  178. package/vendor/abseil-cpp/absl/random/internal/seed_material.cc +1 -27
  179. package/vendor/abseil-cpp/absl/status/BUILD.bazel +17 -0
  180. package/vendor/abseil-cpp/absl/status/CMakeLists.txt +16 -0
  181. package/vendor/abseil-cpp/absl/status/internal/status_internal.h +4 -2
  182. package/vendor/abseil-cpp/absl/status/internal/status_matchers.h +2 -2
  183. package/vendor/abseil-cpp/absl/status/internal/statusor_internal.h +2 -1
  184. package/vendor/abseil-cpp/absl/status/status.cc +4 -0
  185. package/vendor/abseil-cpp/absl/status/status.h +5 -0
  186. package/vendor/abseil-cpp/absl/status/status_matchers.h +48 -0
  187. package/vendor/abseil-cpp/absl/status/status_matchers_test.cc +27 -0
  188. package/vendor/abseil-cpp/absl/status/status_test.cc +1 -0
  189. package/vendor/abseil-cpp/absl/status/statusor.h +1 -1
  190. package/vendor/abseil-cpp/absl/strings/BUILD.bazel +101 -21
  191. package/vendor/abseil-cpp/absl/strings/CMakeLists.txt +99 -5
  192. package/vendor/abseil-cpp/absl/strings/ascii.h +9 -4
  193. package/vendor/abseil-cpp/absl/strings/cord.cc +15 -10
  194. package/vendor/abseil-cpp/absl/strings/cord.h +1 -1
  195. package/vendor/abseil-cpp/absl/strings/escaping.cc +126 -94
  196. package/vendor/abseil-cpp/absl/strings/internal/append_and_overwrite.h +93 -0
  197. package/vendor/abseil-cpp/absl/strings/internal/append_and_overwrite_test.cc +95 -0
  198. package/vendor/abseil-cpp/absl/strings/internal/cord_internal.h +2 -0
  199. package/vendor/abseil-cpp/absl/strings/internal/cord_rep_btree_test.cc +8 -8
  200. package/vendor/abseil-cpp/absl/strings/internal/cordz_info.cc +24 -18
  201. package/vendor/abseil-cpp/absl/strings/internal/cordz_info.h +10 -16
  202. package/vendor/abseil-cpp/absl/strings/internal/escaping.h +9 -7
  203. package/vendor/abseil-cpp/absl/strings/internal/generic_printer.cc +107 -0
  204. package/vendor/abseil-cpp/absl/strings/internal/generic_printer.h +115 -0
  205. package/vendor/abseil-cpp/absl/strings/internal/generic_printer_internal.h +423 -0
  206. package/vendor/abseil-cpp/absl/strings/internal/generic_printer_test.cc +685 -0
  207. package/vendor/abseil-cpp/absl/strings/internal/resize_uninitialized.h +0 -12
  208. package/vendor/abseil-cpp/absl/strings/internal/str_format/checker.h +2 -4
  209. package/vendor/abseil-cpp/absl/strings/internal/str_format/convert_test.cc +21 -7
  210. package/vendor/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +495 -8
  211. package/vendor/abseil-cpp/absl/strings/internal/str_join_internal.h +18 -15
  212. package/vendor/abseil-cpp/absl/strings/numbers.cc +71 -8
  213. package/vendor/abseil-cpp/absl/strings/numbers.h +25 -12
  214. package/vendor/abseil-cpp/absl/strings/numbers_test.cc +70 -0
  215. package/vendor/abseil-cpp/absl/strings/resize_and_overwrite.h +194 -0
  216. package/vendor/abseil-cpp/absl/strings/resize_and_overwrite_test.cc +154 -0
  217. package/vendor/abseil-cpp/absl/strings/str_cat.cc +96 -91
  218. package/vendor/abseil-cpp/absl/strings/str_cat.h +17 -12
  219. package/vendor/abseil-cpp/absl/strings/str_format_test.cc +4 -4
  220. package/vendor/abseil-cpp/absl/strings/str_split.h +1 -1
  221. package/vendor/abseil-cpp/absl/strings/str_split_test.cc +1 -1
  222. package/vendor/abseil-cpp/absl/strings/string_view.h +8 -718
  223. package/vendor/abseil-cpp/absl/strings/string_view_test.cc +1 -1265
  224. package/vendor/abseil-cpp/absl/strings/substitute.cc +24 -24
  225. package/vendor/abseil-cpp/absl/synchronization/BUILD.bazel +2 -3
  226. package/vendor/abseil-cpp/absl/synchronization/CMakeLists.txt +1 -0
  227. package/vendor/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +2 -2
  228. package/vendor/abseil-cpp/absl/synchronization/internal/kernel_timeout_test.cc +15 -5
  229. package/vendor/abseil-cpp/absl/synchronization/mutex.cc +2 -1
  230. package/vendor/abseil-cpp/absl/synchronization/mutex.h +47 -23
  231. package/vendor/abseil-cpp/absl/synchronization/notification.h +1 -1
  232. package/vendor/abseil-cpp/absl/time/CMakeLists.txt +2 -0
  233. package/vendor/abseil-cpp/absl/time/civil_time_benchmark.cc +1 -2
  234. package/vendor/abseil-cpp/absl/time/civil_time_test.cc +58 -103
  235. package/vendor/abseil-cpp/absl/time/clock.cc +18 -16
  236. package/vendor/abseil-cpp/absl/time/clock_test.cc +2 -2
  237. package/vendor/abseil-cpp/absl/time/duration_benchmark.cc +144 -0
  238. package/vendor/abseil-cpp/absl/time/duration_test.cc +26 -29
  239. package/vendor/abseil-cpp/absl/time/internal/cctz/BUILD.bazel +7 -1
  240. package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +4 -2
  241. package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +6 -103
  242. package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.cc +186 -0
  243. package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.h +37 -0
  244. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/version +1 -1
  245. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Ensenada +0 -0
  246. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Santa_Isabel +0 -0
  247. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Tijuana +0 -0
  248. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Mexico/BajaNorte +0 -0
  249. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/iso3166.tab +9 -9
  250. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab +12 -12
  251. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zonenow.tab +47 -47
  252. package/vendor/abseil-cpp/absl/time/time.cc +4 -4
  253. package/vendor/abseil-cpp/absl/time/time.h +10 -10
  254. package/vendor/abseil-cpp/absl/time/time_test.cc +1 -0
  255. package/vendor/abseil-cpp/absl/types/compare.h +62 -61
  256. package/vendor/abseil-cpp/absl/types/compare_test.cc +3 -3
  257. package/vendor/abseil-cpp/absl/types/internal/span.h +1 -0
  258. package/vendor/abseil-cpp/absl/types/optional.h +2 -2
  259. package/vendor/abseil-cpp/absl/types/span.h +10 -2
  260. package/vendor/abseil-cpp/absl/utility/utility.h +13 -0
  261. package/vendor/abseil-cpp/ci/absl_alternate_options.h +0 -1
  262. package/vendor/abseil-cpp/ci/cmake_common.sh +1 -1
  263. package/vendor/abseil-cpp/ci/cmake_install_test.sh +6 -0
  264. package/vendor/abseil-cpp/ci/linux_arm_clang-latest_libcxx_bazel.sh +1 -0
  265. package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_asan_bazel.sh +2 -0
  266. package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_bazel.sh +1 -0
  267. package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_tsan_bazel.sh +1 -0
  268. package/vendor/abseil-cpp/ci/linux_clang-latest_libstdcxx_bazel.sh +1 -0
  269. package/vendor/abseil-cpp/ci/linux_gcc-floor_libstdcxx_bazel.sh +1 -0
  270. package/vendor/abseil-cpp/ci/linux_gcc-latest_libstdcxx_bazel.sh +1 -0
  271. package/vendor/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh +6 -0
  272. package/vendor/abseil-cpp/ci/linux_gcc_alpine_cmake.sh +6 -0
  273. package/vendor/abseil-cpp/ci/macos_xcode_bazel.sh +3 -2
  274. package/vendor/abseil-cpp/ci/macos_xcode_cmake.sh +5 -0
  275. package/vendor/abseil-cpp/ci/windows_clangcl_bazel.bat +1 -0
  276. package/vendor/abseil-cpp/ci/windows_msvc_bazel.bat +1 -0
  277. package/vendor/abseil-cpp/ci/windows_msvc_cmake.bat +6 -1
  278. package/vendor/abseil-cpp/absl/base/internal/identity.h +0 -39
  279. package/vendor/abseil-cpp/absl/strings/string_view.cc +0 -257
  280. package/vendor/abseil-cpp/absl/strings/string_view_benchmark.cc +0 -380
@@ -88,9 +88,20 @@ cc_library(
88
88
  hdrs = ["nullability.h"],
89
89
  copts = ABSL_DEFAULT_COPTS,
90
90
  linkopts = ABSL_DEFAULT_LINKOPTS,
91
+ deps = [":config"],
92
+ )
93
+
94
+ cc_library(
95
+ name = "nullability_traits_internal",
96
+ hdrs = ["internal/nullability_traits.h"],
97
+ copts = ABSL_DEFAULT_COPTS,
98
+ linkopts = ABSL_DEFAULT_LINKOPTS,
99
+ visibility = [
100
+ "//absl:__subpackages__",
101
+ ],
91
102
  deps = [
92
103
  ":config",
93
- ":core_headers",
104
+ ":nullability",
94
105
  ],
95
106
  )
96
107
 
@@ -230,7 +241,6 @@ cc_library(
230
241
  name = "base_internal",
231
242
  hdrs = [
232
243
  "internal/hide_ptr.h",
233
- "internal/identity.h",
234
244
  "internal/scheduling_mode.h",
235
245
  ],
236
246
  copts = ABSL_DEFAULT_COPTS,
@@ -247,6 +257,7 @@ cc_library(
247
257
  cc_library(
248
258
  name = "base",
249
259
  srcs = [
260
+ "casts.cc",
250
261
  "internal/cycleclock.cc",
251
262
  "internal/spinlock.cc",
252
263
  "internal/sysinfo.cc",
@@ -286,8 +297,6 @@ cc_library(
286
297
  ":config",
287
298
  ":core_headers",
288
299
  ":cycleclock_internal",
289
- ":dynamic_annotations",
290
- ":log_severity",
291
300
  ":nullability",
292
301
  ":raw_logging_internal",
293
302
  ":spinlock_wait",
@@ -592,6 +601,22 @@ cc_test(
592
601
  ],
593
602
  )
594
603
 
604
+ cc_test(
605
+ name = "casts_test",
606
+ size = "small",
607
+ srcs = [
608
+ "casts_test.cc",
609
+ ],
610
+ copts = ABSL_TEST_COPTS,
611
+ linkopts = ABSL_DEFAULT_LINKOPTS,
612
+ deps = [
613
+ ":base",
614
+ ":config",
615
+ "@googletest//:gtest",
616
+ "@googletest//:gtest_main",
617
+ ],
618
+ )
619
+
595
620
  cc_test(
596
621
  name = "no_destructor_test",
597
622
  srcs = ["no_destructor_test.cc"],
@@ -625,7 +650,6 @@ cc_test(
625
650
  name = "nullability_test",
626
651
  srcs = ["nullability_test.cc"],
627
652
  deps = [
628
- ":core_headers",
629
653
  ":nullability",
630
654
  "@googletest//:gtest",
631
655
  "@googletest//:gtest_main",
@@ -642,6 +666,18 @@ cc_test(
642
666
  ],
643
667
  )
644
668
 
669
+ cc_test(
670
+ name = "nullability_traits_test",
671
+ srcs = ["internal/nullability_traits_test.cc"],
672
+ deps = [
673
+ ":config",
674
+ ":nullability",
675
+ ":nullability_traits_internal",
676
+ "@googletest//:gtest",
677
+ "@googletest//:gtest_main",
678
+ ],
679
+ )
680
+
645
681
  cc_test(
646
682
  name = "raw_logging_test",
647
683
  srcs = ["raw_logging_test.cc"],
@@ -927,6 +963,9 @@ cc_library(
927
963
  hdrs = ["internal/iterator_traits.h"],
928
964
  copts = ABSL_DEFAULT_COPTS,
929
965
  linkopts = ABSL_DEFAULT_LINKOPTS,
966
+ visibility = [
967
+ "//absl:__subpackages__",
968
+ ],
930
969
  deps = [
931
970
  ":config",
932
971
  "//absl/meta:type_traits",
@@ -74,7 +74,6 @@ absl_cc_library(
74
74
  "nullability.h"
75
75
  DEPS
76
76
  absl::config
77
- absl::core_headers
78
77
  COPTS
79
78
  ${ABSL_DEFAULT_COPTS}
80
79
  )
@@ -87,7 +86,6 @@ absl_cc_test(
87
86
  COPTS
88
87
  ${ABSL_TEST_COPTS}
89
88
  DEPS
90
- absl::core_headers
91
89
  absl::nullability
92
90
  GTest::gtest_main
93
91
  )
@@ -104,6 +102,34 @@ absl_cc_test(
104
102
  GTest::gtest_main
105
103
  )
106
104
 
105
+ # Internal-only target, do not depend on directly.
106
+ absl_cc_library(
107
+ NAME
108
+ nullability_traits_internal
109
+ HDRS
110
+ "internal/nullability_traits.h"
111
+ COPTS
112
+ ${ABSL_DEFAULT_COPTS}
113
+ DEPS
114
+ absl::config
115
+ absl::nullability
116
+ PUBLIC
117
+ )
118
+
119
+ absl_cc_test(
120
+ NAME
121
+ nullability_traits_test
122
+ SRCS
123
+ "internal/nullability_traits_test.cc"
124
+ COPTS
125
+ ${ABSL_TEST_COPTS}
126
+ DEPS
127
+ absl::config
128
+ absl::nullability
129
+ absl::nullability_traits_internal
130
+ GTest::gtest_main
131
+ )
132
+
107
133
  # Internal-only target, do not depend on directly.
108
134
  absl_cc_library(
109
135
  NAME
@@ -212,7 +238,6 @@ absl_cc_library(
212
238
  base_internal
213
239
  HDRS
214
240
  "internal/hide_ptr.h"
215
- "internal/identity.h"
216
241
  "internal/scheduling_mode.h"
217
242
  COPTS
218
243
  ${ABSL_DEFAULT_COPTS}
@@ -238,6 +263,7 @@ absl_cc_library(
238
263
  "internal/unscaledcycleclock.h"
239
264
  "internal/unscaledcycleclock_config.h"
240
265
  SRCS
266
+ "casts.cc"
241
267
  "internal/cycleclock.cc"
242
268
  "internal/spinlock.cc"
243
269
  "internal/sysinfo.cc"
@@ -392,6 +418,19 @@ absl_cc_test(
392
418
  GTest::gtest_main
393
419
  )
394
420
 
421
+ absl_cc_test(
422
+ NAME
423
+ casts_test
424
+ SRCS
425
+ "casts_test.cc"
426
+ COPTS
427
+ ${ABSL_TEST_COPTS}
428
+ DEPS
429
+ absl::base
430
+ absl::core_headers
431
+ GTest::gtest_main
432
+ )
433
+
395
434
  absl_cc_test(
396
435
  NAME
397
436
  errno_saver_test
@@ -580,7 +580,11 @@
580
580
  // Instructs the compiler not to use natural alignment for a tagged data
581
581
  // structure, but instead to reduce its alignment to 1.
582
582
  //
583
- // Therefore, DO NOT APPLY THIS ATTRIBUTE TO STRUCTS CONTAINING ATOMICS. Doing
583
+ // Use of this attribute is HIGHLY DISCOURAGED. Taking the address of or
584
+ // binding a reference to any unaligned member is UB, and it is very easy to
585
+ // do so unintentionally when passing such members as function arguments.
586
+ //
587
+ // DO NOT APPLY THIS ATTRIBUTE TO STRUCTS CONTAINING ATOMICS. Doing
584
588
  // so can cause atomic variables to be mis-aligned and silently violate
585
589
  // atomicity on x86.
586
590
  //
@@ -39,25 +39,25 @@ bool done_blocking ABSL_GUARDED_BY(counters_mu) = false;
39
39
 
40
40
  // Function to be called from absl::call_once. Waits for a notification.
41
41
  void WaitAndIncrement() {
42
- counters_mu.Lock();
42
+ counters_mu.lock();
43
43
  ++call_once_invoke_count;
44
- counters_mu.Unlock();
44
+ counters_mu.unlock();
45
45
 
46
46
  counters_mu.LockWhen(Condition(&done_blocking));
47
47
  ++call_once_finished_count;
48
- counters_mu.Unlock();
48
+ counters_mu.unlock();
49
49
  }
50
50
 
51
51
  void ThreadBody() {
52
- counters_mu.Lock();
52
+ counters_mu.lock();
53
53
  ++running_thread_count;
54
- counters_mu.Unlock();
54
+ counters_mu.unlock();
55
55
 
56
56
  absl::call_once(once, WaitAndIncrement);
57
57
 
58
- counters_mu.Lock();
58
+ counters_mu.lock();
59
59
  ++call_once_return_count;
60
- counters_mu.Unlock();
60
+ counters_mu.unlock();
61
61
  }
62
62
 
63
63
  // Returns true if all threads are set up for the test.
@@ -89,17 +89,17 @@ TEST(CallOnceTest, ExecutionCount) {
89
89
  // Allow WaitAndIncrement to finish executing. Once it does, the other
90
90
  // call_once waiters will be unblocked.
91
91
  done_blocking = true;
92
- counters_mu.Unlock();
92
+ counters_mu.unlock();
93
93
 
94
94
  for (std::thread& thread : threads) {
95
95
  thread.join();
96
96
  }
97
97
 
98
- counters_mu.Lock();
98
+ counters_mu.lock();
99
99
  EXPECT_EQ(call_once_invoke_count, 1);
100
100
  EXPECT_EQ(call_once_finished_count, 1);
101
101
  EXPECT_EQ(call_once_return_count, 10);
102
- counters_mu.Unlock();
102
+ counters_mu.unlock();
103
103
  }
104
104
 
105
105
  } // namespace
@@ -0,0 +1,61 @@
1
+ // Copyright 2025 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/base/casts.h"
16
+
17
+ #include <cstdlib>
18
+ #include <string>
19
+
20
+ #include "absl/base/config.h"
21
+ #include "absl/base/internal/raw_logging.h"
22
+
23
+ #ifdef ABSL_INTERNAL_HAS_CXA_DEMANGLE
24
+ #include <cxxabi.h>
25
+ #endif
26
+
27
+ namespace absl {
28
+ ABSL_NAMESPACE_BEGIN
29
+
30
+ namespace base_internal {
31
+
32
+ namespace {
33
+
34
+ std::string DemangleCppString(const char* mangled) {
35
+ std::string out;
36
+ int status = 0;
37
+ char* demangled = nullptr;
38
+ #ifdef ABSL_INTERNAL_HAS_CXA_DEMANGLE
39
+ demangled = abi::__cxa_demangle(mangled, nullptr, nullptr, &status);
40
+ #endif
41
+ if (status == 0 && demangled != nullptr) {
42
+ out.append(demangled);
43
+ free(demangled);
44
+ } else {
45
+ out.append(mangled);
46
+ }
47
+ return out;
48
+ }
49
+
50
+ } // namespace
51
+
52
+ void BadDownCastCrash(const char* source_type, const char* target_type) {
53
+ ABSL_RAW_LOG(FATAL, "down cast from %s to %s failed",
54
+ DemangleCppString(source_type).c_str(),
55
+ DemangleCppString(target_type).c_str());
56
+ }
57
+
58
+ } // namespace base_internal
59
+
60
+ ABSL_NAMESPACE_END
61
+ } // namespace absl
@@ -33,8 +33,11 @@
33
33
  #include <bit> // For std::bit_cast.
34
34
  #endif // defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
35
35
 
36
- #include "absl/base/internal/identity.h"
36
+ #include "absl/base/attributes.h"
37
+ #include "absl/base/config.h"
37
38
  #include "absl/base/macros.h"
39
+ #include "absl/base/optimization.h"
40
+ #include "absl/base/options.h"
38
41
  #include "absl/meta/type_traits.h"
39
42
 
40
43
  namespace absl {
@@ -90,9 +93,26 @@ ABSL_NAMESPACE_BEGIN
90
93
  //
91
94
  // Such implicit cast chaining may be useful within template logic.
92
95
  template <typename To>
93
- constexpr To implicit_cast(typename absl::internal::type_identity_t<To> to) {
96
+ constexpr std::enable_if_t<
97
+ !type_traits_internal::IsView<std::enable_if_t<
98
+ !std::is_reference_v<To>, std::remove_cv_t<To>>>::value,
99
+ To>
100
+ implicit_cast(absl::type_identity_t<To> to) {
94
101
  return to;
95
102
  }
103
+ template <typename To>
104
+ constexpr std::enable_if_t<
105
+ type_traits_internal::IsView<std::enable_if_t<!std::is_reference_v<To>,
106
+ std::remove_cv_t<To>>>::value,
107
+ To>
108
+ implicit_cast(absl::type_identity_t<To> to ABSL_ATTRIBUTE_LIFETIME_BOUND) {
109
+ return to;
110
+ }
111
+ template <typename To>
112
+ constexpr std::enable_if_t<std::is_reference_v<To>, To> implicit_cast(
113
+ absl::type_identity_t<To> to ABSL_ATTRIBUTE_LIFETIME_BOUND) {
114
+ return std::forward<absl::type_identity_t<To>>(to);
115
+ }
96
116
 
97
117
  // bit_cast()
98
118
  //
@@ -174,6 +194,112 @@ inline Dest bit_cast(const Source& source) {
174
194
 
175
195
  #endif // defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
176
196
 
197
+ namespace base_internal {
198
+
199
+ [[noreturn]] ABSL_ATTRIBUTE_NOINLINE void BadDownCastCrash(
200
+ const char* source_type, const char* target_type);
201
+
202
+ template <typename To, typename From>
203
+ inline void ValidateDownCast(From* f ABSL_ATTRIBUTE_UNUSED) {
204
+ // Assert only if RTTI is enabled and in debug mode or hardened asserts are
205
+ // enabled.
206
+ #ifdef ABSL_INTERNAL_HAS_RTTI
207
+ #if !defined(NDEBUG) || (ABSL_OPTION_HARDENED == 1 || ABSL_OPTION_HARDENED == 2)
208
+ // Suppress erroneous nonnull comparison warning on older GCC.
209
+ #if defined(__GNUC__) && !defined(__clang__)
210
+ #pragma GCC diagnostic push
211
+ #pragma GCC diagnostic ignored "-Wnonnull-compare"
212
+ #endif
213
+ if (ABSL_PREDICT_FALSE(f != nullptr && dynamic_cast<To>(f) == nullptr)) {
214
+ #if defined(__GNUC__) && !defined(__clang__)
215
+ #pragma GCC diagnostic pop
216
+ #endif
217
+ absl::base_internal::BadDownCastCrash(
218
+ typeid(*f).name(), typeid(std::remove_pointer_t<To>).name());
219
+ }
220
+ #endif
221
+ #endif
222
+ }
223
+
224
+ } // namespace base_internal
225
+
226
+ // An "upcast", i.e. a conversion from a pointer to an object to a pointer to a
227
+ // base subobject, always succeeds if the base is unambiguous and accessible,
228
+ // and so it's fine to use implicit_cast.
229
+ //
230
+ // A "downcast", i.e. a conversion from a pointer to an object to a pointer
231
+ // to a more-derived object that may contain the original object as a base
232
+ // subobject, cannot safely be done using static_cast, because you do not
233
+ // generally know whether the source object is really the base subobject of
234
+ // a containing, more-derived object of the target type. Thus, when you
235
+ // downcast in a polymorphic type hierarchy, you should use the following
236
+ // function template.
237
+ //
238
+ // This function only returns null when the input is null. In debug mode, we
239
+ // use dynamic_cast to double-check whether the downcast is legal (we die if
240
+ // it's not). In normal mode, we do the efficient static_cast instead. Because
241
+ // the process will die in debug mode, it's important to test to make sure the
242
+ // cast is legal before calling this function!
243
+ //
244
+ // dynamic_cast should be avoided except as allowed by the style guide
245
+ // (https://google.github.io/styleguide/cppguide.html#Run-Time_Type_Information__RTTI_).
246
+
247
+ template <typename To, typename From> // use like this: down_cast<T*>(foo);
248
+ [[nodiscard]]
249
+ inline To down_cast(From* f) { // so we only accept pointers
250
+ static_assert(std::is_pointer<To>::value, "target type not a pointer");
251
+ // dynamic_cast allows casting to the same type or a more cv-qualified
252
+ // version of the same type without them being polymorphic.
253
+ if constexpr (!std::is_same<std::remove_cv_t<std::remove_pointer_t<To>>,
254
+ std::remove_cv_t<From>>::value) {
255
+ static_assert(std::is_polymorphic<From>::value,
256
+ "source type must be polymorphic");
257
+ static_assert(std::is_polymorphic<std::remove_pointer_t<To>>::value,
258
+ "target type must be polymorphic");
259
+ }
260
+ static_assert(
261
+ std::is_convertible<std::remove_cv_t<std::remove_pointer_t<To>>*,
262
+ std::remove_cv_t<From>*>::value,
263
+ "target type not derived from source type");
264
+
265
+ absl::base_internal::ValidateDownCast<To>(f);
266
+
267
+ return static_cast<To>(f);
268
+ }
269
+
270
+ // Overload of down_cast for references. Use like this:
271
+ // absl::down_cast<T&>(foo). The code is slightly convoluted because we're still
272
+ // using the pointer form of dynamic cast. (The reference form throws an
273
+ // exception if it fails.)
274
+ //
275
+ // There's no need for a special const overload either for the pointer
276
+ // or the reference form. If you call down_cast with a const T&, the
277
+ // compiler will just bind From to const T.
278
+ template <typename To, typename From>
279
+ [[nodiscard]]
280
+ inline To down_cast(From& f) {
281
+ static_assert(std::is_lvalue_reference<To>::value,
282
+ "target type not a reference");
283
+ // dynamic_cast allows casting to the same type or a more cv-qualified
284
+ // version of the same type without them being polymorphic.
285
+ if constexpr (!std::is_same<std::remove_cv_t<std::remove_reference_t<To>>,
286
+ std::remove_cv_t<From>>::value) {
287
+ static_assert(std::is_polymorphic<From>::value,
288
+ "source type must be polymorphic");
289
+ static_assert(std::is_polymorphic<std::remove_reference_t<To>>::value,
290
+ "target type must be polymorphic");
291
+ }
292
+ static_assert(
293
+ std::is_convertible<std::remove_cv_t<std::remove_reference_t<To>>*,
294
+ std::remove_cv_t<From>*>::value,
295
+ "target type not derived from source type");
296
+
297
+ absl::base_internal::ValidateDownCast<std::remove_reference_t<To>*>(
298
+ std::addressof(f));
299
+
300
+ return static_cast<To>(f);
301
+ }
302
+
177
303
  ABSL_NAMESPACE_END
178
304
  } // namespace absl
179
305
 
@@ -0,0 +1,151 @@
1
+ // Copyright 2025 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/base/casts.h"
16
+
17
+ #include <type_traits>
18
+ #include <utility>
19
+
20
+ #include "gtest/gtest.h"
21
+ #include "absl/base/options.h"
22
+
23
+ namespace {
24
+
25
+ struct BaseForImplicitCast {
26
+ explicit BaseForImplicitCast(int value) : x(value) {}
27
+ BaseForImplicitCast(const BaseForImplicitCast& other) = delete;
28
+ BaseForImplicitCast& operator=(const BaseForImplicitCast& other) = delete;
29
+ int x;
30
+ };
31
+ struct DerivedForImplicitCast : BaseForImplicitCast {
32
+ explicit DerivedForImplicitCast(int value) : BaseForImplicitCast(value) {}
33
+ };
34
+
35
+ static_assert(std::is_same_v<decltype(absl::implicit_cast<BaseForImplicitCast&>(
36
+ std::declval<DerivedForImplicitCast&>())),
37
+ BaseForImplicitCast&>);
38
+ static_assert(
39
+ std::is_same_v<decltype(absl::implicit_cast<const BaseForImplicitCast&>(
40
+ std::declval<DerivedForImplicitCast>())),
41
+ const BaseForImplicitCast&>);
42
+
43
+ TEST(ImplicitCastTest, LValueReference) {
44
+ DerivedForImplicitCast derived(5);
45
+ EXPECT_EQ(&absl::implicit_cast<BaseForImplicitCast&>(derived), &derived);
46
+ EXPECT_EQ(&absl::implicit_cast<const BaseForImplicitCast&>(derived),
47
+ &derived);
48
+ }
49
+
50
+ TEST(ImplicitCastTest, RValueReference) {
51
+ DerivedForImplicitCast derived(5);
52
+ BaseForImplicitCast&& base =
53
+ absl::implicit_cast<BaseForImplicitCast&&>(std::move(derived));
54
+ EXPECT_EQ(&base, &derived);
55
+
56
+ const DerivedForImplicitCast cderived(6);
57
+ const BaseForImplicitCast&& cbase =
58
+ absl::implicit_cast<const BaseForImplicitCast&&>(std::move(cderived));
59
+ EXPECT_EQ(&cbase, &cderived);
60
+ }
61
+
62
+ class BaseForDownCast {
63
+ public:
64
+ virtual ~BaseForDownCast() = default;
65
+ };
66
+
67
+ class DerivedForDownCast : public BaseForDownCast {};
68
+ class Derived2ForDownCast : public BaseForDownCast {};
69
+
70
+ TEST(DownCastTest, Pointer) {
71
+ DerivedForDownCast derived;
72
+ BaseForDownCast* const base_ptr = &derived;
73
+
74
+ // Tests casting a BaseForDownCast* to a DerivedForDownCast*.
75
+ EXPECT_EQ(&derived, absl::down_cast<DerivedForDownCast*>(base_ptr));
76
+
77
+ // Tests casting a const BaseForDownCast* to a const DerivedForDownCast*.
78
+ const BaseForDownCast* const_base_ptr = base_ptr;
79
+ EXPECT_EQ(&derived,
80
+ absl::down_cast<const DerivedForDownCast*>(const_base_ptr));
81
+
82
+ // Tests casting a BaseForDownCast* to a const DerivedForDownCast*.
83
+ EXPECT_EQ(&derived, absl::down_cast<const DerivedForDownCast*>(base_ptr));
84
+
85
+ // Tests casting a BaseForDownCast* to a BaseForDownCast* (an identity cast).
86
+ EXPECT_EQ(base_ptr, absl::down_cast<BaseForDownCast*>(base_ptr));
87
+
88
+ // Tests down casting NULL.
89
+ EXPECT_EQ(nullptr,
90
+ (absl::down_cast<DerivedForDownCast*, BaseForDownCast>(nullptr)));
91
+
92
+ // Tests a bad downcast. We have to disguise the badness just enough
93
+ // that the compiler doesn't warn about it at compile time.
94
+ BaseForDownCast* base2 = new BaseForDownCast();
95
+ #if GTEST_HAS_DEATH_TEST && (!defined(NDEBUG) || (ABSL_OPTION_HARDENED == 1 || \
96
+ ABSL_OPTION_HARDENED == 2))
97
+ EXPECT_DEATH(static_cast<void>(absl::down_cast<DerivedForDownCast*>(base2)),
98
+ ".*down cast from .*BaseForDownCast.* to "
99
+ ".*DerivedForDownCast.* failed.*");
100
+ #endif
101
+ delete base2;
102
+ }
103
+
104
+ TEST(DownCastTest, Reference) {
105
+ DerivedForDownCast derived;
106
+ BaseForDownCast& base_ref = derived;
107
+
108
+ // Tests casting a BaseForDownCast& to a DerivedForDownCast&.
109
+ // NOLINTNEXTLINE(runtime/casting)
110
+ EXPECT_EQ(&derived, &absl::down_cast<DerivedForDownCast&>(base_ref));
111
+
112
+ // Tests casting a const BaseForDownCast& to a const DerivedForDownCast&.
113
+ const BaseForDownCast& const_base_ref = base_ref;
114
+ // NOLINTNEXTLINE(runtime/casting)
115
+ EXPECT_EQ(&derived,
116
+ &absl::down_cast<const DerivedForDownCast&>(const_base_ref));
117
+
118
+ // Tests casting a BaseForDownCast& to a const DerivedForDownCast&.
119
+ // NOLINTNEXTLINE(runtime/casting)
120
+ EXPECT_EQ(&derived, &absl::down_cast<const DerivedForDownCast&>(base_ref));
121
+
122
+ // Tests casting a BaseForDownCast& to a BaseForDownCast& (an identity cast).
123
+ // NOLINTNEXTLINE(runtime/casting)
124
+ EXPECT_EQ(&base_ref, &absl::down_cast<BaseForDownCast&>(base_ref));
125
+
126
+ // Tests a bad downcast. We have to disguise the badness just enough
127
+ // that the compiler doesn't warn about it at compile time.
128
+ BaseForDownCast& base2 = *new BaseForDownCast();
129
+ #if GTEST_HAS_DEATH_TEST && (!defined(NDEBUG) || (ABSL_OPTION_HARDENED == 1 || \
130
+ ABSL_OPTION_HARDENED == 2))
131
+ EXPECT_DEATH(static_cast<void>(absl::down_cast<DerivedForDownCast&>(base2)),
132
+ ".*down cast from .*BaseForDownCast.* to "
133
+ ".*DerivedForDownCast.* failed.*");
134
+ #endif
135
+ delete &base2;
136
+ }
137
+
138
+ TEST(DownCastTest, ErrorMessage) {
139
+ DerivedForDownCast derived;
140
+ BaseForDownCast& base = derived;
141
+ (void)base;
142
+
143
+ #if GTEST_HAS_DEATH_TEST && (!defined(NDEBUG) || (ABSL_OPTION_HARDENED == 1 || \
144
+ ABSL_OPTION_HARDENED == 2))
145
+ EXPECT_DEATH(static_cast<void>(absl::down_cast<Derived2ForDownCast&>(base)),
146
+ ".*down cast from .*DerivedForDownCast.* to "
147
+ ".*Derived2ForDownCast.* failed.*");
148
+ #endif
149
+ }
150
+
151
+ } // namespace