[libcxx-commits] [libcxx] [libc++] Replace `__compressed_pair` with `[[no_unique_address]]` (PR #76756)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 25 09:23:50 PST 2024


================
@@ -179,6 +179,8 @@
 // pointer from 16 to 8. This changes the output of std::string::max_size,
 // which makes it ABI breaking
 #    define _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT
+// Don't add padding from __compressed_pair
----------------
ldionne wrote:

```suggestion
// Historically, libc++ used a type called __compressed_pair to reduce storage
// needs in cases of empty types (e.g. an empty allocator in std::vector). We switched
// to using [[no_unique_address]], however for ABI compatibility reasons we had to
// add artificial padding in a few places.
//
// This setting disables the addition of such artificial padding, leading to a more
// optimal representation for several types.
```

https://github.com/llvm/llvm-project/pull/76756


More information about the libcxx-commits mailing list