Adds a new __config macro _LIBCPP_USE_NO_UNIQUE_ADDRESS that specifies when to
use [[no_unique_address]] (instead of __compressed_pair or similar layout
hacks). This macro is defined only when the unstable ABI is enabled and
[[no_unique_address]] is available.
This reduces the number of template instantiations, compile-time cost, size of
debug information, and number of copies performed when using various parts of
libc++. In one source file, we saw a 4% decrease in object file size from
switching std::function to use [[no_unique_address]] instead of
__compressed_pair stemming primarily from reduced debug info size.
This patch does not intend to provide any ABI compatibility between the new
mode and old modes (or between two different compilers with the unstable ABI
enabled, where one supports [[no_unique_address]] and the other does not).
If we want a hard guarantee that even the unstable ABI provides stability
between compilers, we'll need to provide user control over whether we apply
this optimization rather than doing it whenever possible in the unstable ABI.
Can we make this defined(_LIBCPP_ABI_UNSTABLE) && !defined(_LIBCPP_ABI_USE_NO_UNIQUE_ADDRESS?
We have a natviz file to tell msvc's debugger how to display libc++ types, and I don't know how well codeview can describe no_unique_address. Furthermore, the natviz files currently explicitly mention the compressed pairs.
So it'd be good if we could opt out of this for a while on windows after it lands, to prepare the visualizers.