-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb][test] Synchronize __compressed_pair_padding
with libc++
#142516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[lldb][test] Synchronize __compressed_pair_padding
with libc++
#142516
Conversation
@llvm/pr-subscribers-lldb Author: A. Jiang (frederick-vs-ja) ChangesThis PR mirrors changes of Related PR for libc++:
Full diff: https://github.com/llvm/llvm-project/pull/142516.diff 1 Files Affected:
diff --git a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h
index 6dc53a4e88ffd..3f305bdcb4d54 100644
--- a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h
+++ b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h
@@ -72,14 +72,24 @@ inline const size_t __datasizeof_v =
template <class _Tp>
struct __lldb_is_final : public integral_constant<bool, __is_final(_Tp)> {};
-template <class _ToPad> class __compressed_pair_padding {
- char __padding_[((is_empty<_ToPad>::value &&
- !__lldb_is_final<_ToPad>::value) ||
- is_reference<_ToPad>::value)
- ? 0
- : sizeof(_ToPad) - __datasizeof_v<_ToPad>];
+template <class _ToPad>
+inline const bool __is_reference_or_unpadded_object =
+ (std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) ||
+ sizeof(_ToPad) == __datasizeof_v<_ToPad>;
+
+template <class _Tp>
+inline const bool __is_reference_or_unpadded_object<_Tp &> = true;
+
+template <class _Tp>
+inline const bool __is_reference_or_unpadded_object<_Tp &&> = true;
+
+template <class _ToPad, bool _Empty = __is_reference_or_unpadded_object<_ToPad>>
+class __compressed_pair_padding {
+ char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>] = {};
};
+template <class _ToPad> class __compressed_pair_padding<_ToPad, true> {};
+
#define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \
[[__gnu__::__aligned__( \
alignof(T2))]] _LLDB_NO_UNIQUE_ADDRESS T1 Initializer1; \
|
}; | ||
|
||
template <class _ToPad> class __compressed_pair_padding<_ToPad, true> {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for keeping this in sync! What we would usually do with these simulators is to add the new implementation behind a ifdef COMPRESSED_PAIR_REV == <new version>
. To make sure we don't regress users still on the older layout. Do you mind doing that? If it's too finicky I'm happy to give it a shot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for late replying. I'll do this soon I've done this, although this seems unnecessary as there doesn't seem any case where the layout will change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adjusting! I know it's quite gnarly with all these ifdefs
This PR mirrors changes of
__compressed_pair_padding
in libc++ into lldb test suite.Related PR for libc++: