Details
- Reviewers
ldionne - Group Reviewers
Restricted Project - Commits
- rG2619ce8b7e78: [libc++] Test the size of basic_string
rG147f74b6ee90: [libc++] Test the size of basic_string
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM but I'd like to add a test for alignment too, since that would be so easy.
libcxx/test/libcxx/strings/basic.string/string_abi.compile.pass.cpp | ||
---|---|---|
9 ↗ | (On Diff #436468) | While we're at it, I think it would be trivial to add a test for the alignment. WDYT? |
18 ↗ | (On Diff #436468) | Space between > > here and below should help pass in C++03. |
25 ↗ | (On Diff #436468) | You need a dummy , ""); message in your static_assert for C++11. |
- Address comments
libcxx/test/libcxx/strings/basic.string/string_abi.compile.pass.cpp | ||
---|---|---|
9 ↗ | (On Diff #436468) | Sounds like a good idea. |
libcxx/test/libcxx/strings/basic.string/sizeof.compile.pass.cpp | ||
---|---|---|
60 | At least historically, the value is 12. |
libcxx/test/libcxx/strings/basic.string/sizeof.compile.pass.cpp | ||
---|---|---|
58 |
libcxx/test/libcxx/strings/basic.string/alignof.compile.pass.cpp | ||
---|---|---|
100 | This used to pass on AIX, but changes to use bitfields (without applying _LIBCPP_PACKED_BYTE_FOR_AIX) has broken this. | |
112 | Same comment as above. | |
libcxx/test/libcxx/strings/basic.string/sizeof.compile.pass.cpp | ||
110 | This used to pass on AIX, but changes to use bitfields (without applying _LIBCPP_PACKED_BYTE_FOR_AIX) has broken this. | |
122 | Same comment as above. | |
142 | Same comment as above. |
libcxx/test/libcxx/strings/basic.string/alignof.compile.pass.cpp | ||
---|---|---|
100 | However, using the above also causes other members to be less aligned if padding is not explicitly added. |
libcxx/test/libcxx/strings/basic.string/alignof.compile.pass.cpp | ||
---|---|---|
100 | Or rather it causes the string type to be less aligned. |
libcxx/test/libcxx/strings/basic.string/alignof.compile.pass.cpp | ||
---|---|---|
100 | --- string_20220520 2022-05-20 11:48:54.326820970 -0400 +++ string 2022-06-16 19:30:22.238194020 -0400 @@ -724,3 +724,4 @@ - struct __long +_LIBCPP_PACKED_BYTE_FOR_AIX + struct __long_impl { @@ -729,2 +730,6 @@ size_type __size_; + char + __padding_[sizeof(pointer) * + ((2 * sizeof(size_type) - 1) / sizeof(pointer) + 1) - + 2 * sizeof(size_type)]; pointer __data_; @@ -731,2 +736,4 @@ }; +_LIBCPP_PACKED_BYTE_FOR_AIX_END + struct alignas(size_type) alignas(pointer) __long : __long_impl {}; @@ -735,3 +742,4 @@ - struct __short +_LIBCPP_PACKED_BYTE_FOR_AIX + struct __short_impl { @@ -742,2 +750,4 @@ }; +_LIBCPP_PACKED_BYTE_FOR_AIX_END + struct alignas(value_type) __short : __short_impl {}; |
Change back to the old diff. D128285 fixed the basic_string layout, so the test should pass now.
@hubert.reinterpretcast Do you know what the correct values for AIX are? If that's the case, could you tell me? Or how about I land this with XFAIL: AIX any you fix it in a follow-up patch?
As far as I can tell, the values are correct. I will need to see if the failures show up when using the LIT harness.
These pass for me with the LIT harness. Perhaps the precommit CI does make use of the "Parents" metadata?
The metadata shows that your patch is a commit on top of rGaf41955a49725c8ddc69d94b1874bbbbd608729e.
Xing's fix in rG60f7bdfd0317cb38eda54637cdab9baed8ae2f57 occurs after that.
My guess is that the CI will pass if you rebase.
This used to pass on AIX, but changes to use bitfields (without applying _LIBCPP_PACKED_BYTE_FOR_AIX) has broken this.