[libc++] Add _LIBCPP_NO_UNIQUE_ADDRESS to flat_{,multi}map::value_compare#137594
[libc++] Add _LIBCPP_NO_UNIQUE_ADDRESS to flat_{,multi}map::value_compare#137594
Conversation
|
@llvm/pr-subscribers-libcxx Author: Nikolas Klauser (philnik777) ChangesThis breaks the ABI of Full diff: https://github.com/llvm/llvm-project/pull/137594.diff 2 Files Affected:
diff --git a/libcxx/include/__flat_map/flat_map.h b/libcxx/include/__flat_map/flat_map.h
index f5abfd0985280..f5e9756ff6a60 100644
--- a/libcxx/include/__flat_map/flat_map.h
+++ b/libcxx/include/__flat_map/flat_map.h
@@ -114,7 +114,7 @@ class flat_map {
class value_compare {
private:
- key_compare __comp_;
+ _LIBCPP_NO_UNIQUE_ADDRESS key_compare __comp_;
_LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : __comp_(__c) {}
friend flat_map;
diff --git a/libcxx/include/__flat_map/flat_multimap.h b/libcxx/include/__flat_map/flat_multimap.h
index ea77fb5d79bd2..15fcd7995ad0a 100644
--- a/libcxx/include/__flat_map/flat_multimap.h
+++ b/libcxx/include/__flat_map/flat_multimap.h
@@ -115,7 +115,7 @@ class flat_multimap {
class value_compare {
private:
- key_compare __comp_;
+ _LIBCPP_NO_UNIQUE_ADDRESS key_compare __comp_;
_LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : __comp_(__c) {}
friend flat_multimap;
|
huixie90
left a comment
There was a problem hiding this comment.
I agree this is very unlikely to break anything, because value_compare is not stored in flat_map. The only situation this can break anything is when user do m.value_compare() and then store the results in a struct.
Could we add a unittest in libcxx folder?
Otherwise LGTM
ldionne
left a comment
There was a problem hiding this comment.
I think this is very low risk if we do it right now and backport it. I also don't see what test we'd add for this in order to really add value. LGTM as is.
|
/cherry-pick ed0aa99 |
|
/pull-request #138880 |
…pare (llvm#137594) This breaks the ABI of `flat_{,multi}map::value_compare`, but this type has only been introduced in LLVM 20, so it should be very unlikely that we break anybody if we back-port this now. (cherry picked from commit ed0aa99)
This breaks the ABI of
flat_{,multi}map::value_compare, but this type has only been introduced in LLVM 20, so it should be very unlikely that we break anybody if we back-port this now.