Page MenuHomePhabricator

[libc++] Make sure std::allocator<void> is always trivial
ClosedPublic

Authored by ldionne on Jun 17 2021, 1:19 PM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Summary

When we removed the allocator<void> specialization, the triviality of
std::allocator<void> changed because the primary template had a
non-trivial default constructor and the specialization didn't
(so std::allocator<void> went from trivial to non-trivial).

This commit fixes that oversight by giving a trivial constructor to
the primary template when instantiated on cv-void.

This was reported in https://llvm.org/PR50299.

(cherry picked from commit 71e4d434dc83b02a853712a5cb026ee2fa9ba67f)

Diff Detail

Unit TestsFailed

TimeTest
1,430 mslibcxx CI C++2b > libc++.std/numerics/rand/rand_dis/rand_dist_bern/rand_dist_bern_bin::eval.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++-tot /home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp -v --target=x86_64-unknown-linux-gnu -include /home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/projects/libcxx/__config_site -include /home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/libcxx/include -I/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++2b -Werror -Wall -Wextra -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fmodules-cache-path=/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/projects/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/Output/eval.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -L/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/./lib -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic…
1,450 mslibcxx CI C++2b > libc++.std/numerics/rand/rand_dis/rand_dist_bern/rand_dist_bern_negbin::eval.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++-tot /home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp -v --target=x86_64-unknown-linux-gnu -include /home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/projects/libcxx/__config_site -include /home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/libcxx/include -I/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++2b -Werror -Wall -Wextra -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fmodules-cache-path=/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/projects/libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/Output/eval.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -L/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/7dfcae6e75af-1/llvm-project/libcxx-ci/build/generic-cxx2b/./lib -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc…

Event Timeline

ldionne requested review of this revision.Jun 17 2021, 1:19 PM
ldionne created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2021, 1:19 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Jun 22 2021, 9:05 AM
This revision is now accepted and ready to land.Jun 22 2021, 9:05 AM
ldionne closed this revision.Jun 22 2021, 9:05 AM
commit 275ffa580880f6e18bf9742cad8e5dcab67b1f1d
Author: Louis Dionne <ldionne.2@gmail.com>
Date:   Wed Jun 16 12:35:00 2021 -0400

    [libc++] Make sure std::allocator<void> is always trivial

    When we removed the allocator<void> specialization, the triviality of
    std::allocator<void> changed because the primary template had a
    non-trivial default constructor and the specialization didn't
    (so std::allocator<void> went from trivial to non-trivial).

    This commit fixes that oversight by giving a trivial constructor to
    the primary template when instantiated on cv-void.

    This was reported in https://llvm.org/PR50299.

    (cherry picked from commit 71e4d434dc83b02a853712a5cb026ee2fa9ba67f)

    Differential Revision: https://reviews.llvm.org/D104486