From 686aae12d4766631cb2e0f9da0895f4df6db8c30 Mon Sep 17 00:00:00 2001 From: Evan Brown Date: Tue, 12 Mar 2024 12:20:46 -0700 Subject: Make swisstable SOO support GDB pretty printing and still compile in OSS. PiperOrigin-RevId: 615131303 Change-Id: I68fcbdd943594983c67f8e07810b05d5fa9a6f2e --- absl/container/internal/raw_hash_set.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'absl/container') diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 750f51ef..258458b0 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h @@ -2195,11 +2195,6 @@ class raw_hash_set { sizeof(slot_type) <= sizeof(HeapOrSoo) && alignof(slot_type) <= alignof(HeapOrSoo); } - // TODO(b/289225379): this is used for pretty printing in GDB/LLDB, but if we - // use this instead of SooEnabled(), then we get compile errors in some OSS - // compilers due to incomplete mapped_type in flat_hash_map. We need to - // resolve this before launching SOO. - // constexpr static bool kSooEnabled = SooEnabled(); // Whether `size` fits in the SOO capacity of this table. bool fits_in_soo(size_t size) const { @@ -2689,9 +2684,9 @@ class raw_hash_set { const size_t cap = common().capacity(); // Use local variables because compiler complains about using functions in // assume. - ABSL_ATTRIBUTE_UNUSED static constexpr bool kSooEnabled = SooEnabled(); - ABSL_ATTRIBUTE_UNUSED static constexpr size_t kSooCapacity = SooCapacity(); - ABSL_ASSUME(!kSooEnabled || cap >= kSooCapacity); + ABSL_ATTRIBUTE_UNUSED static constexpr bool kEnabled = SooEnabled(); + ABSL_ATTRIBUTE_UNUSED static constexpr size_t kCapacity = SooCapacity(); + ABSL_ASSUME(!kEnabled || cap >= kCapacity); return cap; } size_t max_size() const { return (std::numeric_limits::max)(); } -- cgit v1.2.3