Skip to content

[libc++] Refactor node creation and destruction in list and forward_list #65614

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

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Sep 7, 2023

This removes a lot of code duplication, makes the code simpler and prepares the terrain for https://reviews.llvm.org/D101206, which will fix some UB in the node-based containers.

This also allows removing the dependency of list and forward_list on unique_ptr by using __allocation_guard instead.

@ldionne ldionne requested a review from a team as a code owner September 7, 2023 14:54
@github-actions github-actions bot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Sep 7, 2023
Copy link
Member

@EricWF EricWF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I would like to have a better understanding of the UB fixes coming up.

@ldionne
Copy link
Member Author

ldionne commented Sep 12, 2023

LGTM.

I would like to have a better understanding of the UB fixes coming up.

The UB fixes are the ones I am picking up in https://reviews.llvm.org/D101206. These fixes are about ensuring that we begin and end the lifetime of node classes, which are currently never created. We allocate the nodes and then we construct their various members individually, but we never actually call their constructor or destructor.

@ldionne ldionne force-pushed the review/refactor-list-nodes branch 2 times, most recently from 86063a0 to 16c3d05 Compare September 14, 2023 12:28
This removes a lot of code duplication, makes the code simpler and
prepares the terrain for https://reviews.llvm.org/D101206, which will
fix some UB in the node-based containers.

This also allows removing the dependency of list and forward_list on
unique_ptr by using __allocation_guard instead.
@ldionne ldionne force-pushed the review/refactor-list-nodes branch from 16c3d05 to 95b2e16 Compare September 14, 2023 18:45
@ldionne ldionne merged commit 69875d5 into llvm:main Sep 15, 2023
@ldionne ldionne deleted the review/refactor-list-nodes branch September 15, 2023 14:10
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
…ist (llvm#65614)

This removes a lot of code duplication, makes the code simpler and
prepares the terrain for https://reviews.llvm.org/D101206, which will
fix some UB in the node-based containers.

This also allows removing the dependency of list and forward_list on
unique_ptr by using __allocation_guard instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants