Skip to content

[libc++][modules] Move __noexcept_move_assign_container out of __type_traits #107140

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

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Sep 3, 2024

That header depends on allocator traits, which is fundamentally tied to <memory>, not to <type_traits>. This breaks a cycle betweeen __type_traits and __memory.

…_traits

That header depends on allocator traits, which is fundamentally tied
to <memory>, not to <type_traits>. This breaks a cycle betweeen
__type_traits and __memory.
@ldionne ldionne requested a review from a team as a code owner September 3, 2024 18:42
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Sep 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 3, 2024

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

That header depends on allocator traits, which is fundamentally tied to <memory>, not to <type_traits>. This breaks a cycle betweeen __type_traits and __memory.


Full diff: https://github.com/llvm/llvm-project/pull/107140.diff

5 Files Affected:

  • (modified) libcxx/include/CMakeLists.txt (+1-1)
  • (renamed) libcxx/include/__memory/noexcept_move_assign_container.h (+3-3)
  • (modified) libcxx/include/module.modulemap (+1-1)
  • (modified) libcxx/include/string (+1-1)
  • (modified) libcxx/include/vector (+1-1)
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 32579272858a8e..210beaf5a33642 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -536,6 +536,7 @@ set(files
   __memory/construct_at.h
   __memory/destruct_n.h
   __memory/inout_ptr.h
+  __memory/noexcept_move_assign_container.h
   __memory/out_ptr.h
   __memory/pointer_traits.h
   __memory/ranges_construct_at.h
@@ -824,7 +825,6 @@ set(files
   __type_traits/maybe_const.h
   __type_traits/nat.h
   __type_traits/negation.h
-  __type_traits/noexcept_move_assign_container.h
   __type_traits/promote.h
   __type_traits/rank.h
   __type_traits/remove_all_extents.h
diff --git a/libcxx/include/__type_traits/noexcept_move_assign_container.h b/libcxx/include/__memory/noexcept_move_assign_container.h
similarity index 85%
rename from libcxx/include/__type_traits/noexcept_move_assign_container.h
rename to libcxx/include/__memory/noexcept_move_assign_container.h
index baaf36d9980e94..b0063516aaafc8 100644
--- a/libcxx/include/__type_traits/noexcept_move_assign_container.h
+++ b/libcxx/include/__memory/noexcept_move_assign_container.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef _LIBCPP___TYPE_TRAITS_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H
-#define _LIBCPP___TYPE_TRAITS_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H
+#ifndef _LIBCPP___MEMORY_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H
+#define _LIBCPP___MEMORY_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H
 
 #include <__config>
 #include <__memory/allocator_traits.h>
@@ -34,4 +34,4 @@ struct __noexcept_move_assign_container
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // _LIBCPP___TYPE_TRAITS_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H
+#endif // _LIBCPP___MEMORY_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index f193b5d95f49f5..297d155cb55946 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -1531,6 +1531,7 @@ module std_private_memory_construct_at                    [system] { header "__m
 module std_private_memory_destruct_n                      [system] { header "__memory/destruct_n.h" }
 module std_private_memory_fwd                             [system] { header "__fwd/memory.h" }
 module std_private_memory_inout_ptr                       [system] { header "__memory/inout_ptr.h" }
+module std_private_memory_noexcept_move_assign_container  [system] { header "__memory/noexcept_move_assign_container.h" }
 module std_private_memory_out_ptr                         [system] { header "__memory/out_ptr.h" }
 module std_private_memory_pointer_traits                  [system] { header "__memory/pointer_traits.h" }
 module std_private_memory_ranges_construct_at             [system] { header "__memory/ranges_construct_at.h" }
@@ -2023,7 +2024,6 @@ module std_private_type_traits_make_unsigned                             [system
 module std_private_type_traits_maybe_const                               [system] { header "__type_traits/maybe_const.h" }
 module std_private_type_traits_nat                                       [system] { header "__type_traits/nat.h" }
 module std_private_type_traits_negation                                  [system] { header "__type_traits/negation.h" }
-module std_private_type_traits_noexcept_move_assign_container            [system] { header "__type_traits/noexcept_move_assign_container.h" }
 module std_private_type_traits_promote                                   [system] { header "__type_traits/promote.h" }
 module std_private_type_traits_rank                                      [system] { header "__type_traits/rank.h" }
 module std_private_type_traits_remove_all_extents                        [system] { header "__type_traits/remove_all_extents.h" }
diff --git a/libcxx/include/string b/libcxx/include/string
index 15c7a2f6b988b4..5cb0693ad10bc3 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -609,6 +609,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
 #include <__memory/allocator_traits.h>
 #include <__memory/compressed_pair.h>
 #include <__memory/construct_at.h>
+#include <__memory/noexcept_move_assign_container.h>
 #include <__memory/pointer_traits.h>
 #include <__memory/swap_allocator.h>
 #include <__memory_resource/polymorphic_allocator.h>
@@ -629,7 +630,6 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
 #include <__type_traits/is_standard_layout.h>
 #include <__type_traits/is_trivial.h>
 #include <__type_traits/is_trivially_relocatable.h>
-#include <__type_traits/noexcept_move_assign_container.h>
 #include <__type_traits/remove_cvref.h>
 #include <__type_traits/void_t.h>
 #include <__utility/auto_cast.h>
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 0f852e7f36c29c..2442852c764a63 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -334,6 +334,7 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
 #include <__memory/addressof.h>
 #include <__memory/allocate_at_least.h>
 #include <__memory/allocator_traits.h>
+#include <__memory/noexcept_move_assign_container.h>
 #include <__memory/pointer_traits.h>
 #include <__memory/swap_allocator.h>
 #include <__memory/temp_value.h>
@@ -348,7 +349,6 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
 #include <__type_traits/is_allocator.h>
 #include <__type_traits/is_constructible.h>
 #include <__type_traits/is_nothrow_assignable.h>
-#include <__type_traits/noexcept_move_assign_container.h>
 #include <__type_traits/type_identity.h>
 #include <__utility/exception_guard.h>
 #include <__utility/forward.h>

@ldionne ldionne merged commit c1a8283 into llvm:main Sep 4, 2024
62 checks passed
@ldionne ldionne deleted the review/modularization-noexcept-move-assign-container branch September 4, 2024 15:18
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 4, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux running on sanitizer-buildbot2 while building libcxx at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/3475

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
[379/384] Generating MSAN_INST_GTEST.gtest-all.cc.x86_64-with-call.o
[380/384] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64-with-call.o
[381/384] Generating Msan-x86_64-with-call-Test
[382/384] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
[383/384] Generating Msan-x86_64-Test
[383/384] Running compiler_rt regression tests
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10229 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
TIMEOUT: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c (10229 of 10229)
******************** TEST 'SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c' FAILED ********************
Exit Code: -9
Timeout: Reached timeout of 900 seconds

Command Output (stderr):
--
RUN: at line 1: /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang  -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing  -m64 -funwind-tables  -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp && env HWASAN_OPTIONS=die_after_fork=0  /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing -m64 -funwind-tables -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ env HWASAN_OPTIONS=die_after_fork=0 /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
==3508501==ERROR: HWAddressSanitizer: requested allocation size 0x7be2e4dbf040 exceeds maximum supported size of 0x10000000000
==3506625==ERROR: HWAddressSanitizer: requested allocation size 0x7be2e4dbf040 exceeds maximum supported size of 0x10000000000

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
900.04s: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c
241.76s: libFuzzer-x86_64-default-Linux :: out-of-process-fuzz.test
234.91s: libFuzzer-x86_64-libcxx-Linux :: out-of-process-fuzz.test
227.90s: libFuzzer-x86_64-static-libcxx-Linux :: out-of-process-fuzz.test
52.63s: libFuzzer-i386-default-Linux :: value-profile-switch.test
48.95s: libFuzzer-i386-libcxx-Linux :: value-profile-switch.test
48.58s: ThreadSanitizer-x86_64 :: bench_threads.cpp
45.83s: libFuzzer-i386-static-libcxx-Linux :: value-profile-switch.test
44.75s: libFuzzer-i386-static-libcxx-Linux :: fork.test
42.46s: libFuzzer-i386-libcxx-Linux :: fork.test
41.97s: libFuzzer-i386-default-Linux :: fork.test
41.74s: libFuzzer-x86_64-libcxx-Linux :: fork_corpus_groups.test
41.61s: libFuzzer-x86_64-default-Linux :: fork.test
41.53s: libFuzzer-i386-libcxx-Linux :: fork_corpus_groups.test
41.49s: libFuzzer-i386-static-libcxx-Linux :: fork_corpus_groups.test
41.35s: libFuzzer-x86_64-static-libcxx-Linux :: fork.test
41.13s: libFuzzer-x86_64-default-Linux :: fork_corpus_groups.test
41.11s: libFuzzer-i386-default-Linux :: fork_corpus_groups.test
41.11s: libFuzzer-x86_64-libcxx-Linux :: fork.test
40.53s: libFuzzer-x86_64-static-libcxx-Linux :: fork_corpus_groups.test

Step 9 (test compiler-rt symbolizer) failure: test compiler-rt symbolizer (failure)
...
[379/384] Generating MSAN_INST_GTEST.gtest-all.cc.x86_64-with-call.o
[380/384] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64-with-call.o
[381/384] Generating Msan-x86_64-with-call-Test
[382/384] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
[383/384] Generating Msan-x86_64-Test
[383/384] Running compiler_rt regression tests
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10229 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
TIMEOUT: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c (10229 of 10229)
******************** TEST 'SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c' FAILED ********************
Exit Code: -9
Timeout: Reached timeout of 900 seconds

Command Output (stderr):
--
RUN: at line 1: /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang  -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing  -m64 -funwind-tables  -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp && env HWASAN_OPTIONS=die_after_fork=0  /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing -m64 -funwind-tables -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ env HWASAN_OPTIONS=die_after_fork=0 /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
==3508501==ERROR: HWAddressSanitizer: requested allocation size 0x7be2e4dbf040 exceeds maximum supported size of 0x10000000000
==3506625==ERROR: HWAddressSanitizer: requested allocation size 0x7be2e4dbf040 exceeds maximum supported size of 0x10000000000

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
900.04s: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c
241.76s: libFuzzer-x86_64-default-Linux :: out-of-process-fuzz.test
234.91s: libFuzzer-x86_64-libcxx-Linux :: out-of-process-fuzz.test
227.90s: libFuzzer-x86_64-static-libcxx-Linux :: out-of-process-fuzz.test
52.63s: libFuzzer-i386-default-Linux :: value-profile-switch.test
48.95s: libFuzzer-i386-libcxx-Linux :: value-profile-switch.test
48.58s: ThreadSanitizer-x86_64 :: bench_threads.cpp
45.83s: libFuzzer-i386-static-libcxx-Linux :: value-profile-switch.test
44.75s: libFuzzer-i386-static-libcxx-Linux :: fork.test
42.46s: libFuzzer-i386-libcxx-Linux :: fork.test
41.97s: libFuzzer-i386-default-Linux :: fork.test
41.74s: libFuzzer-x86_64-libcxx-Linux :: fork_corpus_groups.test
41.61s: libFuzzer-x86_64-default-Linux :: fork.test
41.53s: libFuzzer-i386-libcxx-Linux :: fork_corpus_groups.test
41.49s: libFuzzer-i386-static-libcxx-Linux :: fork_corpus_groups.test
41.35s: libFuzzer-x86_64-static-libcxx-Linux :: fork.test
41.13s: libFuzzer-x86_64-default-Linux :: fork_corpus_groups.test
41.11s: libFuzzer-i386-default-Linux :: fork_corpus_groups.test
41.11s: libFuzzer-x86_64-libcxx-Linux :: fork.test
40.53s: libFuzzer-x86_64-static-libcxx-Linux :: fork_corpus_groups.test


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.

4 participants