[libcxx-commits] [libcxx] e37bbfe - [libcxx][modules] protects users from relying on libc++ detail headers (1/n)

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 16 15:39:50 PDT 2021


Author: Christopher Di Bella
Date: 2021-07-16T22:39:18Z
New Revision: e37bbfe59ccd4ea0da95c02e9f36172239f4f0c3

URL: https://github.com/llvm/llvm-project/commit/e37bbfe59ccd4ea0da95c02e9f36172239f4f0c3
DIFF: https://github.com/llvm/llvm-project/commit/e37bbfe59ccd4ea0da95c02e9f36172239f4f0c3.diff

LOG: [libcxx][modules] protects users from relying on libc++ detail headers (1/n)

libc++ has started splicing standard library headers into much more
fine-grained content for maintainability. It's very likely that outdated
and naive tooling (some of which is outside of LLVM's scope) will
suggest users include things such as `<__algorithm/find.h>` instead of
`<algorithm>`, and Hyrum's law suggests that users will eventually begin
to rely on this without the help of tooling. As such, this commit
intends to protect users from themselves, by making it a hard error for
anyone outside of the standard library to include libc++ detail headers.

This is the first of four patches. Patch #2 will solve the problem for
pre-processor `#include`s; patches #3 and #4 will solve the problem for
`<__tree>` and `<__hash_table>` (since I've never touched the test cases
that are failing for these two, I want to split them out into their own
commits to be extra careful). Patch #5 will concern itself with
`<__threading_support>`, which intersects with libcxxabi (which I know
even less about).

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

Added: 
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/adjacent_find.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/all_of.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/any_of.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/binary_search.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/clamp.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/comp.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/comp_ref_type.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_backward.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_if.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_n.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/count.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/count_if.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/equal.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/equal_range.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/fill.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/fill_n.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_end.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_first_of.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_if.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_if_not.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/for_each.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/for_each_n.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/generate.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/generate_n.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/half_positive.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/includes.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/inplace_merge.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_heap.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_heap_until.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_partitioned.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_permutation.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_sorted.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_sorted_until.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/iter_swap.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/lexicographical_compare.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/lower_bound.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/make_heap.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/max.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/max_element.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/merge.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/min.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/min_element.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/minmax.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/minmax_element.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/mismatch.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/move.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/move_backward.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/next_permutation.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/none_of.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/nth_element.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partial_sort.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partial_sort_copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition_copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition_point.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/pop_heap.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/prev_permutation.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/push_heap.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_copy_if.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_if.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_copy_if.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_if.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/reverse.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/reverse_copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/rotate.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/rotate_copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sample.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/search.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/search_n.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_difference.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_intersection.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_symmetric_difference.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_union.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shift_left.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shift_right.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shuffle.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sift_down.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sort.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sort_heap.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/stable_partition.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/stable_sort.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/swap_ranges.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/transform.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unique.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unique_copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unwrap_iter.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/algorithm/upper_bound.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/availability.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/bit_reference.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/bits.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/errc.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/format/format_error.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/format/format_parse_context.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/function_like.h.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/binary_function.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/binary_negate.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/bind.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/bind_front.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/binder1st.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/binder2nd.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/default_searcher.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/function.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/hash.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/identity.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/invoke.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/is_transparent.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/mem_fn.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/mem_fun_ref.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/not_fn.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/operations.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/perfect_forward.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/pointer_to_binary_function.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/pointer_to_unary_function.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/ranges_operations.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/reference_wrapper.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/unary_function.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/unary_negate.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/unwrap_ref.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/functional/weak_result_type.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/access.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/advance.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/back_insert_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/concepts.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/data.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/default_sentinel.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/distance.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/empty.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/erase_if_container.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/front_insert_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/incrementable_traits.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/insert_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/istream_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/istreambuf_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/iter_move.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/iter_swap.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/iterator_traits.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/move_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/next.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/ostream_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/ostreambuf_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/prev.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/projected.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/readable_traits.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/reverse_access.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/reverse_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/size.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/iterator/wrap_iter.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/locale.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/addressof.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/allocation_guard.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator_arg_t.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator_traits.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/auto_ptr.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/compressed_pair.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/construct_at.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/pointer_safety.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/pointer_traits.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/raw_storage_iterator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/shared_ptr.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/temporary_buffer.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/uninitialized_algorithms.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/unique_ptr.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/memory/uses_allocator.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/mutex_base.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/node_handle.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/random/uniform_int_distribution.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/access.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/all.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/concepts.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/copyable_box.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/data.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/drop_view.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/empty.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/empty_view.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/enable_borrowed_range.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/enable_view.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/ref_view.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/size.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/subrange.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/transform_view.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/ranges/view_interface.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/split_buffer.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/std_stream.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/string.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/tuple.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/__decay_copy.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/as_const.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/cmp.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/declval.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/exchange.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/forward.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/in_place.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/integer_sequence.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/move.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/pair.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/piecewise_construct.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/rel_ops.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/swap.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/utility/to_underlying.module.verify.cpp
    libcxx/test/libcxx/diagnostics/detail.headers/variant/monostate.module.verify.cpp
    libcxx/utils/generate_private_header_tests.py

Modified: 
    libcxx/include/module.modulemap
    libcxx/include/span
    libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/types.h
    libcxx/utils/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 07665937de1b5..1d22f866dea79 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -219,99 +219,99 @@ module std [system] {
     export *
 
     module __algorithm {
-      module adjacent_find            { header "__algorithm/adjacent_find.h" }
-      module all_of                   { header "__algorithm/all_of.h" }
-      module any_of                   { header "__algorithm/any_of.h" }
-      module binary_search            { header "__algorithm/binary_search.h" }
-      module clamp                    { header "__algorithm/clamp.h" }
-      module comp                     { header "__algorithm/comp.h" }
-      module comp_ref_type            { header "__algorithm/comp_ref_type.h" }
-      module copy                     { header "__algorithm/copy.h" }
-      module copy_backward            { header "__algorithm/copy_backward.h" }
-      module copy_if                  { header "__algorithm/copy_if.h" }
-      module copy_n                   { header "__algorithm/copy_n.h" }
-      module count                    { header "__algorithm/count.h" }
-      module count_if                 { header "__algorithm/count_if.h" }
-      module equal                    { header "__algorithm/equal.h" }
-      module equal_range              { header "__algorithm/equal_range.h" }
-      module fill                     { header "__algorithm/fill.h" }
-      module fill_n                   { header "__algorithm/fill_n.h" }
-      module find                     { header "__algorithm/find.h" }
-      module find_end                 { header "__algorithm/find_end.h" }
-      module find_first_of            { header "__algorithm/find_first_of.h" }
-      module find_if                  { header "__algorithm/find_if.h" }
-      module find_if_not              { header "__algorithm/find_if_not.h" }
-      module for_each                 { header "__algorithm/for_each.h" }
-      module for_each_n               { header "__algorithm/for_each_n.h" }
-      module generate                 { header "__algorithm/generate.h" }
-      module generate_n               { header "__algorithm/generate_n.h" }
-      module half_positive            { header "__algorithm/half_positive.h" }
-      module includes                 { header "__algorithm/includes.h" }
-      module inplace_merge            { header "__algorithm/inplace_merge.h" }
-      module is_heap                  { header "__algorithm/is_heap.h" }
-      module is_heap_until            { header "__algorithm/is_heap_until.h" }
-      module is_partitioned           { header "__algorithm/is_partitioned.h" }
-      module is_permutation           { header "__algorithm/is_permutation.h" }
-      module is_sorted                { header "__algorithm/is_sorted.h" }
-      module is_sorted_until          { header "__algorithm/is_sorted_until.h" }
-      module iter_swap                { header "__algorithm/iter_swap.h" }
-      module lexicographical_compare  { header "__algorithm/lexicographical_compare.h" }
-      module lower_bound              { header "__algorithm/lower_bound.h" }
-      module make_heap                { header "__algorithm/make_heap.h" }
-      module max                      { header "__algorithm/max.h" }
-      module max_element              { header "__algorithm/max_element.h" }
-      module merge                    { header "__algorithm/merge.h" }
-      module min                      { header "__algorithm/min.h" }
-      module min_element              { header "__algorithm/min_element.h" }
-      module minmax                   { header "__algorithm/minmax.h" }
-      module minmax_element           { header "__algorithm/minmax_element.h" }
-      module mismatch                 { header "__algorithm/mismatch.h" }
-      module move                     { header "__algorithm/move.h" }
-      module move_backward            { header "__algorithm/move_backward.h" }
-      module next_permutation         { header "__algorithm/next_permutation.h" }
-      module none_of                  { header "__algorithm/none_of.h" }
-      module nth_element              { header "__algorithm/nth_element.h" }
-      module partial_sort             { header "__algorithm/partial_sort.h" }
-      module partial_sort_copy        { header "__algorithm/partial_sort_copy.h" }
-      module partition                { header "__algorithm/partition.h" }
-      module partition_copy           { header "__algorithm/partition_copy.h" }
-      module partition_point          { header "__algorithm/partition_point.h" }
-      module pop_heap                 { header "__algorithm/pop_heap.h" }
-      module prev_permutation         { header "__algorithm/prev_permutation.h" }
-      module push_heap                { header "__algorithm/push_heap.h" }
-      module remove                   { header "__algorithm/remove.h" }
-      module remove_copy              { header "__algorithm/remove_copy.h" }
-      module remove_copy_if           { header "__algorithm/remove_copy_if.h" }
-      module remove_if                { header "__algorithm/remove_if.h" }
-      module replace                  { header "__algorithm/replace.h" }
-      module replace_copy             { header "__algorithm/replace_copy.h" }
-      module replace_copy_if          { header "__algorithm/replace_copy_if.h" }
-      module replace_if               { header "__algorithm/replace_if.h" }
-      module reverse                  { header "__algorithm/reverse.h" }
-      module reverse_copy             { header "__algorithm/reverse_copy.h" }
-      module rotate                   { header "__algorithm/rotate.h" }
-      module rotate_copy              { header "__algorithm/rotate_copy.h" }
-      module sample                   { header "__algorithm/sample.h" }
-      module search                   { header "__algorithm/search.h" }
-      module search_n                 { header "__algorithm/search_n.h" }
-      module set_
diff erence           { header "__algorithm/set_
diff erence.h" }
-      module set_intersection         { header "__algorithm/set_intersection.h" }
-      module set_symmetric_
diff erence { header "__algorithm/set_symmetric_
diff erence.h" }
-      module set_union                { header "__algorithm/set_union.h" }
-      module shift_left               { header "__algorithm/shift_left.h" }
-      module shift_right              { header "__algorithm/shift_right.h" }
-      module shuffle                  { header "__algorithm/shuffle.h" }
-      module sift_down                { header "__algorithm/sift_down.h" }
-      module sort                     { header "__algorithm/sort.h" }
-      module sort_heap                { header "__algorithm/sort_heap.h" }
-      module stable_partition         { header "__algorithm/stable_partition.h" }
-      module stable_sort              { header "__algorithm/stable_sort.h" }
-      module swap_ranges              { header "__algorithm/swap_ranges.h" }
-      module transform                { header "__algorithm/transform.h" }
-      module unique                   { header "__algorithm/unique.h" }
-      module unique_copy              { header "__algorithm/unique_copy.h" }
-      module unwrap_iter              { header "__algorithm/unwrap_iter.h" }
-      module upper_bound              { header "__algorithm/upper_bound.h" }
+      module adjacent_find            { private header "__algorithm/adjacent_find.h" }
+      module all_of                   { private header "__algorithm/all_of.h" }
+      module any_of                   { private header "__algorithm/any_of.h" }
+      module binary_search            { private header "__algorithm/binary_search.h" }
+      module clamp                    { private header "__algorithm/clamp.h" }
+      module comp                     { private header "__algorithm/comp.h" }
+      module comp_ref_type            { private header "__algorithm/comp_ref_type.h" }
+      module copy                     { private header "__algorithm/copy.h" }
+      module copy_backward            { private header "__algorithm/copy_backward.h" }
+      module copy_if                  { private header "__algorithm/copy_if.h" }
+      module copy_n                   { private header "__algorithm/copy_n.h" }
+      module count                    { private header "__algorithm/count.h" }
+      module count_if                 { private header "__algorithm/count_if.h" }
+      module equal                    { private header "__algorithm/equal.h" }
+      module equal_range              { private header "__algorithm/equal_range.h" }
+      module fill                     { private header "__algorithm/fill.h" }
+      module fill_n                   { private header "__algorithm/fill_n.h" }
+      module find                     { private header "__algorithm/find.h" }
+      module find_end                 { private header "__algorithm/find_end.h" }
+      module find_first_of            { private header "__algorithm/find_first_of.h" }
+      module find_if                  { private header "__algorithm/find_if.h" }
+      module find_if_not              { private header "__algorithm/find_if_not.h" }
+      module for_each                 { private header "__algorithm/for_each.h" }
+      module for_each_n               { private header "__algorithm/for_each_n.h" }
+      module generate                 { private header "__algorithm/generate.h" }
+      module generate_n               { private header "__algorithm/generate_n.h" }
+      module half_positive            { private header "__algorithm/half_positive.h" }
+      module includes                 { private header "__algorithm/includes.h" }
+      module inplace_merge            { private header "__algorithm/inplace_merge.h" }
+      module is_heap                  { private header "__algorithm/is_heap.h" }
+      module is_heap_until            { private header "__algorithm/is_heap_until.h" }
+      module is_partitioned           { private header "__algorithm/is_partitioned.h" }
+      module is_permutation           { private header "__algorithm/is_permutation.h" }
+      module is_sorted                { private header "__algorithm/is_sorted.h" }
+      module is_sorted_until          { private header "__algorithm/is_sorted_until.h" }
+      module iter_swap                { private header "__algorithm/iter_swap.h" }
+      module lexicographical_compare  { private header "__algorithm/lexicographical_compare.h" }
+      module lower_bound              { private header "__algorithm/lower_bound.h" }
+      module make_heap                { private header "__algorithm/make_heap.h" }
+      module max                      { private header "__algorithm/max.h" }
+      module max_element              { private header "__algorithm/max_element.h" }
+      module merge                    { private header "__algorithm/merge.h" }
+      module min                      { private header "__algorithm/min.h" }
+      module min_element              { private header "__algorithm/min_element.h" }
+      module minmax                   { private header "__algorithm/minmax.h" }
+      module minmax_element           { private header "__algorithm/minmax_element.h" }
+      module mismatch                 { private header "__algorithm/mismatch.h" }
+      module move                     { private header "__algorithm/move.h" }
+      module move_backward            { private header "__algorithm/move_backward.h" }
+      module next_permutation         { private header "__algorithm/next_permutation.h" }
+      module none_of                  { private header "__algorithm/none_of.h" }
+      module nth_element              { private header "__algorithm/nth_element.h" }
+      module partial_sort             { private header "__algorithm/partial_sort.h" }
+      module partial_sort_copy        { private header "__algorithm/partial_sort_copy.h" }
+      module partition                { private header "__algorithm/partition.h" }
+      module partition_copy           { private header "__algorithm/partition_copy.h" }
+      module partition_point          { private header "__algorithm/partition_point.h" }
+      module pop_heap                 { private header "__algorithm/pop_heap.h" }
+      module prev_permutation         { private header "__algorithm/prev_permutation.h" }
+      module push_heap                { private header "__algorithm/push_heap.h" }
+      module remove                   { private header "__algorithm/remove.h" }
+      module remove_copy              { private header "__algorithm/remove_copy.h" }
+      module remove_copy_if           { private header "__algorithm/remove_copy_if.h" }
+      module remove_if                { private header "__algorithm/remove_if.h" }
+      module replace                  { private header "__algorithm/replace.h" }
+      module replace_copy             { private header "__algorithm/replace_copy.h" }
+      module replace_copy_if          { private header "__algorithm/replace_copy_if.h" }
+      module replace_if               { private header "__algorithm/replace_if.h" }
+      module reverse                  { private header "__algorithm/reverse.h" }
+      module reverse_copy             { private header "__algorithm/reverse_copy.h" }
+      module rotate                   { private header "__algorithm/rotate.h" }
+      module rotate_copy              { private header "__algorithm/rotate_copy.h" }
+      module sample                   { private header "__algorithm/sample.h" }
+      module search                   { private header "__algorithm/search.h" }
+      module search_n                 { private header "__algorithm/search_n.h" }
+      module set_
diff erence           { private header "__algorithm/set_
diff erence.h" }
+      module set_intersection         { private header "__algorithm/set_intersection.h" }
+      module set_symmetric_
diff erence { private header "__algorithm/set_symmetric_
diff erence.h" }
+      module set_union                { private header "__algorithm/set_union.h" }
+      module shift_left               { private header "__algorithm/shift_left.h" }
+      module shift_right              { private header "__algorithm/shift_right.h" }
+      module shuffle                  { private header "__algorithm/shuffle.h" }
+      module sift_down                { private header "__algorithm/sift_down.h" }
+      module sort                     { private header "__algorithm/sort.h" }
+      module sort_heap                { private header "__algorithm/sort_heap.h" }
+      module stable_partition         { private header "__algorithm/stable_partition.h" }
+      module stable_sort              { private header "__algorithm/stable_sort.h" }
+      module swap_ranges              { private header "__algorithm/swap_ranges.h" }
+      module transform                { private header "__algorithm/transform.h" }
+      module unique                   { private header "__algorithm/unique.h" }
+      module unique_copy              { private header "__algorithm/unique_copy.h" }
+      module unwrap_iter              { private header "__algorithm/unwrap_iter.h" }
+      module upper_bound              { private header "__algorithm/upper_bound.h" }
     }
   }
   module any {
@@ -393,8 +393,8 @@ module std [system] {
     export *
 
     module __format {
-      module format_error         { header "__format/format_error.h"         }
-      module format_parse_context { header "__format/format_parse_context.h" }
+      module format_error         { private header "__format/format_error.h"         }
+      module format_parse_context { private header "__format/format_parse_context.h" }
     }
   }
   module forward_list {
@@ -411,31 +411,31 @@ module std [system] {
     export *
 
     module __functional {
-      module binary_function            { header "__functional/binary_function.h" }
-      module binary_negate              { header "__functional/binary_negate.h" }
-      module bind                       { header "__functional/bind.h" }
-      module bind_front                 { header "__functional/bind_front.h" }
-      module binder1st                  { header "__functional/binder1st.h" }
-      module binder2nd                  { header "__functional/binder2nd.h" }
-      module default_searcher           { header "__functional/default_searcher.h" }
-      module function                   { header "__functional/function.h" }
-      module hash                       { header "__functional/hash.h" }
-      module identity                   { header "__functional/identity.h" }
-      module is_transparent             { header "__functional/is_transparent.h" }
-      module invoke                     { header "__functional/invoke.h" }
-      module mem_fn                     { header "__functional/mem_fn.h"  }
-      module mem_fun_ref                { header "__functional/mem_fun_ref.h"  }
-      module not_fn                     { header "__functional/not_fn.h" }
-      module operations                 { header "__functional/operations.h" }
-      module perfect_forward            { header "__functional/perfect_forward.h" }
-      module pointer_to_binary_function { header "__functional/pointer_to_binary_function.h" }
-      module pointer_to_unary_function  { header "__functional/pointer_to_unary_function.h" }
-      module ranges_operations          { header "__functional/ranges_operations.h" }
-      module reference_wrapper          { header "__functional/reference_wrapper.h" }
-      module unary_function             { header "__functional/unary_function.h" }
-      module unary_negate               { header "__functional/unary_negate.h" }
-      module unwrap_ref                 { header "__functional/unwrap_ref.h" }
-      module weak_result_type           { header "__functional/weak_result_type.h" }
+      module binary_function            { private header "__functional/binary_function.h" }
+      module binary_negate              { private header "__functional/binary_negate.h" }
+      module bind                       { private header "__functional/bind.h" }
+      module bind_front                 { private header "__functional/bind_front.h" }
+      module binder1st                  { private header "__functional/binder1st.h" }
+      module binder2nd                  { private header "__functional/binder2nd.h" }
+      module default_searcher           { private header "__functional/default_searcher.h" }
+      module function                   { private header "__functional/function.h" }
+      module hash                       { private header "__functional/hash.h" }
+      module identity                   { private header "__functional/identity.h" }
+      module is_transparent             { private header "__functional/is_transparent.h" }
+      module invoke                     { private header "__functional/invoke.h" }
+      module mem_fn                     { private header "__functional/mem_fn.h"  }
+      module mem_fun_ref                { private header "__functional/mem_fun_ref.h"  }
+      module not_fn                     { private header "__functional/not_fn.h" }
+      module operations                 { private header "__functional/operations.h" }
+      module perfect_forward            { private header "__functional/perfect_forward.h" }
+      module pointer_to_binary_function { private header "__functional/pointer_to_binary_function.h" }
+      module pointer_to_unary_function  { private header "__functional/pointer_to_unary_function.h" }
+      module ranges_operations          { private header "__functional/ranges_operations.h" }
+      module reference_wrapper          { private header "__functional/reference_wrapper.h" }
+      module unary_function             { private header "__functional/unary_function.h" }
+      module unary_negate               { private header "__functional/unary_negate.h" }
+      module unwrap_ref                 { private header "__functional/unwrap_ref.h" }
+      module weak_result_type           { private header "__functional/weak_result_type.h" }
     }
   }
   module future {
@@ -477,35 +477,35 @@ module std [system] {
     export *
 
     module __iterator {
-      module access                { header "__iterator/access.h" }
-      module advance               { header "__iterator/advance.h" }
-      module back_insert_iterator  { header "__iterator/back_insert_iterator.h" }
-      module concepts              { header "__iterator/concepts.h" }
-      module data                  { header "__iterator/data.h" }
-      module default_sentinel      { header "__iterator/default_sentinel.h" }
-      module distance              { header "__iterator/distance.h" }
-      module empty                 { header "__iterator/empty.h" }
-      module erase_if_container    { header "__iterator/erase_if_container.h" }
-      module front_insert_iterator { header "__iterator/front_insert_iterator.h" }
-      module incrementable_traits  { header "__iterator/incrementable_traits.h" }
-      module insert_iterator       { header "__iterator/insert_iterator.h" }
-      module istream_iterator      { header "__iterator/istream_iterator.h" }
-      module istreambuf_iterator   { header "__iterator/istreambuf_iterator.h" }
-      module iter_move             { header "__iterator/iter_move.h" }
-      module iter_swap             { header "__iterator/iter_swap.h" }
-      module iterator              { header "__iterator/iterator.h" }
-      module iterator_traits       { header "__iterator/iterator_traits.h" }
-      module move_iterator         { header "__iterator/move_iterator.h" }
-      module next                  { header "__iterator/next.h" }
-      module ostream_iterator      { header "__iterator/ostream_iterator.h" }
-      module ostreambuf_iterator   { header "__iterator/ostreambuf_iterator.h" }
-      module prev                  { header "__iterator/prev.h" }
-      module projected             { header "__iterator/projected.h" }
-      module readable_traits       { header "__iterator/readable_traits.h" }
-      module reverse_access        { header "__iterator/reverse_access.h" }
-      module reverse_iterator      { header "__iterator/reverse_iterator.h" }
-      module size                  { header "__iterator/size.h" }
-      module wrap_iter             { header "__iterator/wrap_iter.h" }
+      module access                { private header "__iterator/access.h" }
+      module advance               { private header "__iterator/advance.h" }
+      module back_insert_iterator  { private header "__iterator/back_insert_iterator.h" }
+      module concepts              { private header "__iterator/concepts.h" }
+      module data                  { private header "__iterator/data.h" }
+      module default_sentinel      { private header "__iterator/default_sentinel.h" }
+      module distance              { private header "__iterator/distance.h" }
+      module empty                 { private header "__iterator/empty.h" }
+      module erase_if_container    { private header "__iterator/erase_if_container.h" }
+      module front_insert_iterator { private header "__iterator/front_insert_iterator.h" }
+      module incrementable_traits  { private header "__iterator/incrementable_traits.h" }
+      module insert_iterator       { private header "__iterator/insert_iterator.h" }
+      module istream_iterator      { private header "__iterator/istream_iterator.h" }
+      module istreambuf_iterator   { private header "__iterator/istreambuf_iterator.h" }
+      module iter_move             { private header "__iterator/iter_move.h" }
+      module iter_swap             { private header "__iterator/iter_swap.h" }
+      module iterator              { private header "__iterator/iterator.h" }
+      module iterator_traits       { private header "__iterator/iterator_traits.h" }
+      module move_iterator         { private header "__iterator/move_iterator.h" }
+      module next                  { private header "__iterator/next.h" }
+      module ostream_iterator      { private header "__iterator/ostream_iterator.h" }
+      module ostreambuf_iterator   { private header "__iterator/ostreambuf_iterator.h" }
+      module prev                  { private header "__iterator/prev.h" }
+      module projected             { private header "__iterator/projected.h" }
+      module readable_traits       { private header "__iterator/readable_traits.h" }
+      module reverse_access        { private header "__iterator/reverse_access.h" }
+      module reverse_iterator      { private header "__iterator/reverse_iterator.h" }
+      module size                  { private header "__iterator/size.h" }
+      module wrap_iter             { private header "__iterator/wrap_iter.h" }
     }
   }
   module latch {
@@ -536,22 +536,22 @@ module std [system] {
     export *
 
     module __memory {
-      module addressof                { header "__memory/addressof.h"                }
-      module allocation_guard         { header "__memory/allocation_guard.h"         }
-      module allocator                { header "__memory/allocator.h"                }
-      module allocator_arg_t          { header "__memory/allocator_arg_t.h"          }
-      module allocator_traits         { header "__memory/allocator_traits.h"         }
-      module auto_ptr                 { header "__memory/auto_ptr.h"                 }
-      module compressed_pair          { header "__memory/compressed_pair.h"          }
-      module construct_at             { header "__memory/construct_at.h"             }
-      module pointer_safety           { header "__memory/pointer_safety.h"           }
-      module pointer_traits           { header "__memory/pointer_traits.h"           }
-      module raw_storage_iterator     { header "__memory/raw_storage_iterator.h"     }
-      module shared_ptr               { header "__memory/shared_ptr.h"               }
-      module temporary_buffer         { header "__memory/temporary_buffer.h"         }
-      module uninitialized_algorithms { header "__memory/uninitialized_algorithms.h" }
-      module unique_ptr               { header "__memory/unique_ptr.h"               }
-      module uses_allocator           { header "__memory/uses_allocator.h"           }
+      module addressof                { private header "__memory/addressof.h"                }
+      module allocation_guard         { private header "__memory/allocation_guard.h"         }
+      module allocator                { private header "__memory/allocator.h"                }
+      module allocator_arg_t          { private header "__memory/allocator_arg_t.h"          }
+      module allocator_traits         { private header "__memory/allocator_traits.h"         }
+      module auto_ptr                 { private header "__memory/auto_ptr.h"                 }
+      module compressed_pair          { private header "__memory/compressed_pair.h"          }
+      module construct_at             { private header "__memory/construct_at.h"             }
+      module pointer_safety           { private header "__memory/pointer_safety.h"           }
+      module pointer_traits           { private header "__memory/pointer_traits.h"           }
+      module raw_storage_iterator     { private header "__memory/raw_storage_iterator.h"     }
+      module shared_ptr               { private header "__memory/shared_ptr.h"               }
+      module temporary_buffer         { private header "__memory/temporary_buffer.h"         }
+      module uninitialized_algorithms { private header "__memory/uninitialized_algorithms.h" }
+      module unique_ptr               { private header "__memory/unique_ptr.h"               }
+      module uses_allocator           { private header "__memory/uses_allocator.h"           }
     }
   }
   module mutex {
@@ -590,7 +590,7 @@ module std [system] {
     export *
 
     module __random {
-      module uniform_int_distribution { header "__random/uniform_int_distribution.h" }
+      module uniform_int_distribution { private header "__random/uniform_int_distribution.h" }
     }
   }
   module ranges {
@@ -601,21 +601,21 @@ module std [system] {
     export *
 
     module __ranges {
-      module access                 { header "__ranges/access.h"                }
-      module all                    { header "__ranges/all.h"                   }
-      module concepts               { header "__ranges/concepts.h"              }
-      module copyable_box           { header "__ranges/copyable_box.h"          }
-      module data                   { header "__ranges/data.h"                  }
-      module drop_view              { header "__ranges/drop_view.h"             }
-      module empty                  { header "__ranges/empty.h"                 }
-      module empty_view             { header "__ranges/empty_view.h"            }
-      module enable_borrowed_range  { header "__ranges/enable_borrowed_range.h" }
-      module enable_view            { header "__ranges/enable_view.h"           }
-      module ref_view               { header "__ranges/ref_view.h"              }
-      module size                   { header "__ranges/size.h"                  }
-      module subrange               { header "__ranges/subrange.h"              }
-      module transform_view         { header "__ranges/transform_view.h"        }
-      module view_interface         { header "__ranges/view_interface.h"        }
+      module access                 { private header "__ranges/access.h"                }
+      module all                    { private header "__ranges/all.h"                   }
+      module concepts               { private header "__ranges/concepts.h"              }
+      module copyable_box           { private header "__ranges/copyable_box.h"          }
+      module data                   { private header "__ranges/data.h"                  }
+      module drop_view              { private header "__ranges/drop_view.h"             }
+      module empty                  { private header "__ranges/empty.h"                 }
+      module empty_view             { private header "__ranges/empty_view.h"            }
+      module enable_borrowed_range  { private header "__ranges/enable_borrowed_range.h" }
+      module enable_view            { private header "__ranges/enable_view.h"           }
+      module ref_view               { private header "__ranges/ref_view.h"              }
+      module size                   { private header "__ranges/size.h"                  }
+      module subrange               { private header "__ranges/subrange.h"              }
+      module transform_view         { private header "__ranges/transform_view.h"        }
+      module view_interface         { private header "__ranges/view_interface.h"        }
     }
   }
   module ratio {
@@ -726,20 +726,20 @@ module std [system] {
     export *
 
     module __utility {
-      module __decay_copy        { header "__utility/__decay_copy.h"        }
-      module as_const            { header "__utility/as_const.h"            }
-      module cmp                 { header "__utility/cmp.h"                 }
-      module declval             { header "__utility/declval.h"             }
-      module exchange            { header "__utility/exchange.h"            }
-      module forward             { header "__utility/forward.h"             }
-      module in_place            { header "__utility/in_place.h"            }
-      module integer_sequence    { header "__utility/integer_sequence.h"    }
-      module move                { header "__utility/move.h"                }
-      module pair                { header "__utility/pair.h"                }
-      module piecewise_construct { header "__utility/piecewise_construct.h" }
-      module rel_ops             { header "__utility/rel_ops.h"             }
-      module swap                { header "__utility/swap.h"                }
-      module to_underlying       { header "__utility/to_underlying.h"       }
+      module __decay_copy        { private header "__utility/__decay_copy.h"        }
+      module as_const            { private header "__utility/as_const.h"            }
+      module cmp                 { private header "__utility/cmp.h"                 }
+      module declval             { private header "__utility/declval.h"             }
+      module exchange            { private header "__utility/exchange.h"            }
+      module forward             { private header "__utility/forward.h"             }
+      module in_place            { private header "__utility/in_place.h"            }
+      module integer_sequence    { private header "__utility/integer_sequence.h"    }
+      module move                { private header "__utility/move.h"                }
+      module pair                { private header "__utility/pair.h"                }
+      module piecewise_construct { private header "__utility/piecewise_construct.h" }
+      module rel_ops             { private header "__utility/rel_ops.h"             }
+      module swap                { private header "__utility/swap.h"                }
+      module to_underlying       { private header "__utility/to_underlying.h"       }
     }
   }
   module valarray {
@@ -752,7 +752,7 @@ module std [system] {
     export *
 
     module __variant {
-      module monostate { header "__variant/monostate.h" }
+      module monostate { private header "__variant/monostate.h" }
     }
   }
   module vector {
@@ -767,23 +767,23 @@ module std [system] {
 
   // __config not modularised due to a bug in Clang
   // FIXME: These should be private.
-  module __availability      { header "__availability"      export * }
-  module __bit_reference     { header "__bit_reference"     export * }
-  module __bits              { header "__bits"              export * }
+  module __availability      { private header "__availability"      export * }
+  module __bit_reference     { private header "__bit_reference"     export * }
+  module __bits              { private header "__bits"              export * }
   module __debug             { header "__debug"             export * }
-  module __errc              { header "__errc"              export * }
-  module __function_like     { header "__function_like.h"   export * }
+  module __errc              { private header "__errc"              export * }
+  module __function_like     { private header "__function_like.h"   export * }
   module __hash_table        { header "__hash_table"        export * }
-  module __locale            { header "__locale"            export * }
-  module __mutex_base        { header "__mutex_base"        export * }
-  module __node_handle       { header "__node_handle"       export * }
+  module __locale            { private header "__locale"            export * }
+  module __mutex_base        { private header "__mutex_base"        export * }
+  module __node_handle       { private header "__node_handle"       export * }
   module __nullptr           { header "__nullptr"           export * }
-  module __split_buffer      { header "__split_buffer"      export * }
-  module __std_stream        { header "__std_stream"        export * }
-  module __string            { header "__string"            export * }
+  module __split_buffer      { private header "__split_buffer"      export * }
+  module __std_stream        { private header "__std_stream"        export * }
+  module __string            { private header "__string"            export * }
   module __threading_support { header "__threading_support" export * }
   module __tree              { header "__tree"              export * }
-  module __tuple             { header "__tuple"             export * }
+  module __tuple             { private header "__tuple"             export * }
   module __undef_macros      { header "__undef_macros"      export * }
 
   module experimental {

diff  --git a/libcxx/include/span b/libcxx/include/span
index 0892e25a59bc2..260a74404fe58 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -137,6 +137,7 @@ template<class Container>
 #include <iterator>     // for iterators
 #include <limits>
 #include <type_traits>  // for remove_cv, etc
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/adjacent_find.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/adjacent_find.module.verify.cpp
new file mode 100644
index 0000000000000..e445eca753817
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/adjacent_find.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/adjacent_find.h'}}
+#include <__algorithm/adjacent_find.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/all_of.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/all_of.module.verify.cpp
new file mode 100644
index 0000000000000..94cbcd38d2399
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/all_of.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/all_of.h'}}
+#include <__algorithm/all_of.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/any_of.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/any_of.module.verify.cpp
new file mode 100644
index 0000000000000..6a7f3066657a0
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/any_of.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/any_of.h'}}
+#include <__algorithm/any_of.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/binary_search.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/binary_search.module.verify.cpp
new file mode 100644
index 0000000000000..c5dc84ca6cad3
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/binary_search.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/binary_search.h'}}
+#include <__algorithm/binary_search.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/clamp.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/clamp.module.verify.cpp
new file mode 100644
index 0000000000000..85b7ba3e5c06b
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/clamp.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/clamp.h'}}
+#include <__algorithm/clamp.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/comp.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/comp.module.verify.cpp
new file mode 100644
index 0000000000000..16127b5d37e2f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/comp.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/comp.h'}}
+#include <__algorithm/comp.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/comp_ref_type.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/comp_ref_type.module.verify.cpp
new file mode 100644
index 0000000000000..3bcfe37a9df4f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/comp_ref_type.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/comp_ref_type.h'}}
+#include <__algorithm/comp_ref_type.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy.module.verify.cpp
new file mode 100644
index 0000000000000..9dc3406388f0b
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/copy.h'}}
+#include <__algorithm/copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_backward.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_backward.module.verify.cpp
new file mode 100644
index 0000000000000..22cd8cd653e57
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_backward.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/copy_backward.h'}}
+#include <__algorithm/copy_backward.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_if.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_if.module.verify.cpp
new file mode 100644
index 0000000000000..91fff8139151d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_if.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/copy_if.h'}}
+#include <__algorithm/copy_if.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_n.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_n.module.verify.cpp
new file mode 100644
index 0000000000000..88100beac424d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/copy_n.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/copy_n.h'}}
+#include <__algorithm/copy_n.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/count.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/count.module.verify.cpp
new file mode 100644
index 0000000000000..40583e7870bcb
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/count.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/count.h'}}
+#include <__algorithm/count.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/count_if.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/count_if.module.verify.cpp
new file mode 100644
index 0000000000000..4465c91ec41f1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/count_if.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/count_if.h'}}
+#include <__algorithm/count_if.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/equal.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/equal.module.verify.cpp
new file mode 100644
index 0000000000000..877b70a7ec25b
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/equal.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/equal.h'}}
+#include <__algorithm/equal.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/equal_range.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/equal_range.module.verify.cpp
new file mode 100644
index 0000000000000..e8217712d8dc3
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/equal_range.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/equal_range.h'}}
+#include <__algorithm/equal_range.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/fill.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/fill.module.verify.cpp
new file mode 100644
index 0000000000000..c5d95121fd740
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/fill.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/fill.h'}}
+#include <__algorithm/fill.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/fill_n.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/fill_n.module.verify.cpp
new file mode 100644
index 0000000000000..b0075472caba8
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/fill_n.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/fill_n.h'}}
+#include <__algorithm/fill_n.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find.module.verify.cpp
new file mode 100644
index 0000000000000..5e464846ffb88
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/find.h'}}
+#include <__algorithm/find.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_end.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_end.module.verify.cpp
new file mode 100644
index 0000000000000..0f8788ca0aac3
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_end.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/find_end.h'}}
+#include <__algorithm/find_end.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_first_of.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_first_of.module.verify.cpp
new file mode 100644
index 0000000000000..0d92c1fc655e8
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_first_of.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/find_first_of.h'}}
+#include <__algorithm/find_first_of.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_if.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_if.module.verify.cpp
new file mode 100644
index 0000000000000..123ed3f24e4fd
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_if.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/find_if.h'}}
+#include <__algorithm/find_if.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_if_not.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_if_not.module.verify.cpp
new file mode 100644
index 0000000000000..af941eede4ff0
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/find_if_not.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/find_if_not.h'}}
+#include <__algorithm/find_if_not.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/for_each.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/for_each.module.verify.cpp
new file mode 100644
index 0000000000000..d7d37fb341755
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/for_each.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/for_each.h'}}
+#include <__algorithm/for_each.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/for_each_n.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/for_each_n.module.verify.cpp
new file mode 100644
index 0000000000000..bb777bb97de57
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/for_each_n.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/for_each_n.h'}}
+#include <__algorithm/for_each_n.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/generate.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/generate.module.verify.cpp
new file mode 100644
index 0000000000000..1d22acb51cefb
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/generate.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/generate.h'}}
+#include <__algorithm/generate.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/generate_n.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/generate_n.module.verify.cpp
new file mode 100644
index 0000000000000..67984f067113b
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/generate_n.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/generate_n.h'}}
+#include <__algorithm/generate_n.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/half_positive.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/half_positive.module.verify.cpp
new file mode 100644
index 0000000000000..1e69336f7cd55
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/half_positive.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/half_positive.h'}}
+#include <__algorithm/half_positive.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/includes.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/includes.module.verify.cpp
new file mode 100644
index 0000000000000..16e2b911d8a88
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/includes.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/includes.h'}}
+#include <__algorithm/includes.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/inplace_merge.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/inplace_merge.module.verify.cpp
new file mode 100644
index 0000000000000..2e8ea0a2fbdd3
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/inplace_merge.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/inplace_merge.h'}}
+#include <__algorithm/inplace_merge.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_heap.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_heap.module.verify.cpp
new file mode 100644
index 0000000000000..3bdf3c982e0af
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_heap.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/is_heap.h'}}
+#include <__algorithm/is_heap.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_heap_until.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_heap_until.module.verify.cpp
new file mode 100644
index 0000000000000..9545b2d98166f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_heap_until.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/is_heap_until.h'}}
+#include <__algorithm/is_heap_until.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_partitioned.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_partitioned.module.verify.cpp
new file mode 100644
index 0000000000000..685e9c5bcb27e
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_partitioned.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/is_partitioned.h'}}
+#include <__algorithm/is_partitioned.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_permutation.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_permutation.module.verify.cpp
new file mode 100644
index 0000000000000..5b3d1ca92ccae
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_permutation.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/is_permutation.h'}}
+#include <__algorithm/is_permutation.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_sorted.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_sorted.module.verify.cpp
new file mode 100644
index 0000000000000..6bdf25d3cbbe9
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_sorted.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/is_sorted.h'}}
+#include <__algorithm/is_sorted.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_sorted_until.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_sorted_until.module.verify.cpp
new file mode 100644
index 0000000000000..6f4f12c6f87d8
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/is_sorted_until.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/is_sorted_until.h'}}
+#include <__algorithm/is_sorted_until.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/iter_swap.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/iter_swap.module.verify.cpp
new file mode 100644
index 0000000000000..7db68792f9456
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/iter_swap.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/iter_swap.h'}}
+#include <__algorithm/iter_swap.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/lexicographical_compare.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/lexicographical_compare.module.verify.cpp
new file mode 100644
index 0000000000000..7c417f6123877
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/lexicographical_compare.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/lexicographical_compare.h'}}
+#include <__algorithm/lexicographical_compare.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/lower_bound.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/lower_bound.module.verify.cpp
new file mode 100644
index 0000000000000..5d2347b3acadf
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/lower_bound.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/lower_bound.h'}}
+#include <__algorithm/lower_bound.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/make_heap.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/make_heap.module.verify.cpp
new file mode 100644
index 0000000000000..2ac533eac94fb
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/make_heap.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/make_heap.h'}}
+#include <__algorithm/make_heap.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/max.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/max.module.verify.cpp
new file mode 100644
index 0000000000000..51f0e90adc1f7
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/max.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/max.h'}}
+#include <__algorithm/max.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/max_element.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/max_element.module.verify.cpp
new file mode 100644
index 0000000000000..e25d1927efb0b
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/max_element.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/max_element.h'}}
+#include <__algorithm/max_element.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/merge.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/merge.module.verify.cpp
new file mode 100644
index 0000000000000..5f4ca30aa2163
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/merge.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/merge.h'}}
+#include <__algorithm/merge.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/min.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/min.module.verify.cpp
new file mode 100644
index 0000000000000..26f265b0efc69
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/min.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/min.h'}}
+#include <__algorithm/min.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/min_element.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/min_element.module.verify.cpp
new file mode 100644
index 0000000000000..1e4174abd6952
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/min_element.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/min_element.h'}}
+#include <__algorithm/min_element.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/minmax.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/minmax.module.verify.cpp
new file mode 100644
index 0000000000000..a595d38c9a84b
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/minmax.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/minmax.h'}}
+#include <__algorithm/minmax.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/minmax_element.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/minmax_element.module.verify.cpp
new file mode 100644
index 0000000000000..18d7f7d410134
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/minmax_element.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/minmax_element.h'}}
+#include <__algorithm/minmax_element.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/mismatch.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/mismatch.module.verify.cpp
new file mode 100644
index 0000000000000..b5645a27b3b6d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/mismatch.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/mismatch.h'}}
+#include <__algorithm/mismatch.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/move.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/move.module.verify.cpp
new file mode 100644
index 0000000000000..80030e2746d69
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/move.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/move.h'}}
+#include <__algorithm/move.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/move_backward.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/move_backward.module.verify.cpp
new file mode 100644
index 0000000000000..ef738d00aeee0
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/move_backward.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/move_backward.h'}}
+#include <__algorithm/move_backward.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/next_permutation.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/next_permutation.module.verify.cpp
new file mode 100644
index 0000000000000..08df0a706eab9
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/next_permutation.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/next_permutation.h'}}
+#include <__algorithm/next_permutation.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/none_of.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/none_of.module.verify.cpp
new file mode 100644
index 0000000000000..f421b9d53dd17
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/none_of.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/none_of.h'}}
+#include <__algorithm/none_of.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/nth_element.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/nth_element.module.verify.cpp
new file mode 100644
index 0000000000000..14e69fa16dcda
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/nth_element.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/nth_element.h'}}
+#include <__algorithm/nth_element.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partial_sort.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partial_sort.module.verify.cpp
new file mode 100644
index 0000000000000..9b189241eb417
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partial_sort.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/partial_sort.h'}}
+#include <__algorithm/partial_sort.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partial_sort_copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partial_sort_copy.module.verify.cpp
new file mode 100644
index 0000000000000..42242f705a3a3
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partial_sort_copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/partial_sort_copy.h'}}
+#include <__algorithm/partial_sort_copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition.module.verify.cpp
new file mode 100644
index 0000000000000..f7e213663adf1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/partition.h'}}
+#include <__algorithm/partition.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition_copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition_copy.module.verify.cpp
new file mode 100644
index 0000000000000..92462787e7c0d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition_copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/partition_copy.h'}}
+#include <__algorithm/partition_copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition_point.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition_point.module.verify.cpp
new file mode 100644
index 0000000000000..e22856ee26008
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/partition_point.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/partition_point.h'}}
+#include <__algorithm/partition_point.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/pop_heap.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/pop_heap.module.verify.cpp
new file mode 100644
index 0000000000000..f5fe44f277cf2
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/pop_heap.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/pop_heap.h'}}
+#include <__algorithm/pop_heap.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/prev_permutation.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/prev_permutation.module.verify.cpp
new file mode 100644
index 0000000000000..5d7c7dd72c035
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/prev_permutation.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/prev_permutation.h'}}
+#include <__algorithm/prev_permutation.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/push_heap.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/push_heap.module.verify.cpp
new file mode 100644
index 0000000000000..b1a2d743aa52d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/push_heap.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/push_heap.h'}}
+#include <__algorithm/push_heap.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove.module.verify.cpp
new file mode 100644
index 0000000000000..cf78bbcaef773
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/remove.h'}}
+#include <__algorithm/remove.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_copy.module.verify.cpp
new file mode 100644
index 0000000000000..ff7afca29842f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/remove_copy.h'}}
+#include <__algorithm/remove_copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_copy_if.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_copy_if.module.verify.cpp
new file mode 100644
index 0000000000000..55a21c529d411
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_copy_if.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/remove_copy_if.h'}}
+#include <__algorithm/remove_copy_if.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_if.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_if.module.verify.cpp
new file mode 100644
index 0000000000000..4309184ae51ea
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/remove_if.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/remove_if.h'}}
+#include <__algorithm/remove_if.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace.module.verify.cpp
new file mode 100644
index 0000000000000..ec81e421e68d1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/replace.h'}}
+#include <__algorithm/replace.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_copy.module.verify.cpp
new file mode 100644
index 0000000000000..cb95f4c97ad72
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/replace_copy.h'}}
+#include <__algorithm/replace_copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_copy_if.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_copy_if.module.verify.cpp
new file mode 100644
index 0000000000000..b67f7fa87fea9
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_copy_if.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/replace_copy_if.h'}}
+#include <__algorithm/replace_copy_if.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_if.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_if.module.verify.cpp
new file mode 100644
index 0000000000000..616fe024ae11e
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/replace_if.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/replace_if.h'}}
+#include <__algorithm/replace_if.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/reverse.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/reverse.module.verify.cpp
new file mode 100644
index 0000000000000..6ead238517dd9
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/reverse.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/reverse.h'}}
+#include <__algorithm/reverse.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/reverse_copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/reverse_copy.module.verify.cpp
new file mode 100644
index 0000000000000..8e174853797fb
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/reverse_copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/reverse_copy.h'}}
+#include <__algorithm/reverse_copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/rotate.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/rotate.module.verify.cpp
new file mode 100644
index 0000000000000..2cb958c868f65
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/rotate.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/rotate.h'}}
+#include <__algorithm/rotate.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/rotate_copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/rotate_copy.module.verify.cpp
new file mode 100644
index 0000000000000..453c9477691d2
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/rotate_copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/rotate_copy.h'}}
+#include <__algorithm/rotate_copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sample.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sample.module.verify.cpp
new file mode 100644
index 0000000000000..bce9021616a79
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sample.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/sample.h'}}
+#include <__algorithm/sample.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/search.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/search.module.verify.cpp
new file mode 100644
index 0000000000000..965e26e368eb1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/search.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/search.h'}}
+#include <__algorithm/search.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/search_n.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/search_n.module.verify.cpp
new file mode 100644
index 0000000000000..1b96ca21ba815
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/search_n.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/search_n.h'}}
+#include <__algorithm/search_n.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_
diff erence.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_
diff erence.module.verify.cpp
new file mode 100644
index 0000000000000..e620e30e54234
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_
diff erence.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/set_
diff erence.h'}}
+#include <__algorithm/set_
diff erence.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_intersection.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_intersection.module.verify.cpp
new file mode 100644
index 0000000000000..760995e23e55f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_intersection.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/set_intersection.h'}}
+#include <__algorithm/set_intersection.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_symmetric_
diff erence.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_symmetric_
diff erence.module.verify.cpp
new file mode 100644
index 0000000000000..9d9bdad0e3a00
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_symmetric_
diff erence.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/set_symmetric_
diff erence.h'}}
+#include <__algorithm/set_symmetric_
diff erence.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_union.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_union.module.verify.cpp
new file mode 100644
index 0000000000000..b33fa8af0f101
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/set_union.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/set_union.h'}}
+#include <__algorithm/set_union.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shift_left.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shift_left.module.verify.cpp
new file mode 100644
index 0000000000000..14f90a22a106f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shift_left.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/shift_left.h'}}
+#include <__algorithm/shift_left.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shift_right.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shift_right.module.verify.cpp
new file mode 100644
index 0000000000000..3a07bbda76ac3
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shift_right.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/shift_right.h'}}
+#include <__algorithm/shift_right.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shuffle.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shuffle.module.verify.cpp
new file mode 100644
index 0000000000000..3273d90243767
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/shuffle.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/shuffle.h'}}
+#include <__algorithm/shuffle.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sift_down.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sift_down.module.verify.cpp
new file mode 100644
index 0000000000000..d4ed87fcfcc6f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sift_down.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/sift_down.h'}}
+#include <__algorithm/sift_down.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sort.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sort.module.verify.cpp
new file mode 100644
index 0000000000000..42e369b23efb4
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sort.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/sort.h'}}
+#include <__algorithm/sort.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sort_heap.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sort_heap.module.verify.cpp
new file mode 100644
index 0000000000000..fbb405c8f7eaa
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/sort_heap.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/sort_heap.h'}}
+#include <__algorithm/sort_heap.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/stable_partition.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/stable_partition.module.verify.cpp
new file mode 100644
index 0000000000000..74edd38515349
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/stable_partition.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/stable_partition.h'}}
+#include <__algorithm/stable_partition.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/stable_sort.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/stable_sort.module.verify.cpp
new file mode 100644
index 0000000000000..999a0878a7a8f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/stable_sort.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/stable_sort.h'}}
+#include <__algorithm/stable_sort.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/swap_ranges.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/swap_ranges.module.verify.cpp
new file mode 100644
index 0000000000000..294a06b2cda0b
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/swap_ranges.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/swap_ranges.h'}}
+#include <__algorithm/swap_ranges.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/transform.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/transform.module.verify.cpp
new file mode 100644
index 0000000000000..b9f59dc17ad96
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/transform.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/transform.h'}}
+#include <__algorithm/transform.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unique.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unique.module.verify.cpp
new file mode 100644
index 0000000000000..c1ee21884b45c
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unique.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/unique.h'}}
+#include <__algorithm/unique.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unique_copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unique_copy.module.verify.cpp
new file mode 100644
index 0000000000000..b589e88d35615
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unique_copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/unique_copy.h'}}
+#include <__algorithm/unique_copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unwrap_iter.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unwrap_iter.module.verify.cpp
new file mode 100644
index 0000000000000..f6a80e2178460
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/unwrap_iter.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/unwrap_iter.h'}}
+#include <__algorithm/unwrap_iter.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/upper_bound.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/upper_bound.module.verify.cpp
new file mode 100644
index 0000000000000..25b065f2e9835
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/algorithm/upper_bound.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__algorithm/upper_bound.h'}}
+#include <__algorithm/upper_bound.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/availability.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/availability.module.verify.cpp
new file mode 100644
index 0000000000000..4f966e736a871
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/availability.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__availability'}}
+#include <__availability>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/bit_reference.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/bit_reference.module.verify.cpp
new file mode 100644
index 0000000000000..3676f7ad5c50e
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/bit_reference.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__bit_reference'}}
+#include <__bit_reference>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/bits.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/bits.module.verify.cpp
new file mode 100644
index 0000000000000..fa9f78495f918
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/bits.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__bits'}}
+#include <__bits>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/errc.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/errc.module.verify.cpp
new file mode 100644
index 0000000000000..8489223bce611
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/errc.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__errc'}}
+#include <__errc>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/format/format_error.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/format/format_error.module.verify.cpp
new file mode 100644
index 0000000000000..f6af9432c8ead
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/format/format_error.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__format/format_error.h'}}
+#include <__format/format_error.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/format/format_parse_context.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/format/format_parse_context.module.verify.cpp
new file mode 100644
index 0000000000000..308f66e8c570f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/format/format_parse_context.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__format/format_parse_context.h'}}
+#include <__format/format_parse_context.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/function_like.h.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/function_like.h.module.verify.cpp
new file mode 100644
index 0000000000000..f7fd96ebf176f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/function_like.h.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__function_like.h'}}
+#include <__function_like.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/binary_function.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/binary_function.module.verify.cpp
new file mode 100644
index 0000000000000..46be85ab992df
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/binary_function.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/binary_function.h'}}
+#include <__functional/binary_function.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/binary_negate.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/binary_negate.module.verify.cpp
new file mode 100644
index 0000000000000..4c9210165b664
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/binary_negate.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/binary_negate.h'}}
+#include <__functional/binary_negate.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/bind.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/bind.module.verify.cpp
new file mode 100644
index 0000000000000..b8616081b7ea1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/bind.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/bind.h'}}
+#include <__functional/bind.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/bind_front.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/bind_front.module.verify.cpp
new file mode 100644
index 0000000000000..4b2f25f93b941
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/bind_front.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/bind_front.h'}}
+#include <__functional/bind_front.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/binder1st.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/binder1st.module.verify.cpp
new file mode 100644
index 0000000000000..c639813b97859
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/binder1st.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/binder1st.h'}}
+#include <__functional/binder1st.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/binder2nd.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/binder2nd.module.verify.cpp
new file mode 100644
index 0000000000000..4f2ba80918727
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/binder2nd.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/binder2nd.h'}}
+#include <__functional/binder2nd.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/default_searcher.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/default_searcher.module.verify.cpp
new file mode 100644
index 0000000000000..7fe174a3f4a5d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/default_searcher.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/default_searcher.h'}}
+#include <__functional/default_searcher.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/function.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/function.module.verify.cpp
new file mode 100644
index 0000000000000..16bd1ddeb09c9
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/function.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/function.h'}}
+#include <__functional/function.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/hash.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/hash.module.verify.cpp
new file mode 100644
index 0000000000000..ecb2c0a39fa01
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/hash.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/hash.h'}}
+#include <__functional/hash.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/identity.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/identity.module.verify.cpp
new file mode 100644
index 0000000000000..b795b5ddc6e18
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/identity.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/identity.h'}}
+#include <__functional/identity.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/invoke.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/invoke.module.verify.cpp
new file mode 100644
index 0000000000000..a368dc1ce0356
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/invoke.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/invoke.h'}}
+#include <__functional/invoke.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/is_transparent.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/is_transparent.module.verify.cpp
new file mode 100644
index 0000000000000..3f226199bae5a
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/is_transparent.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/is_transparent.h'}}
+#include <__functional/is_transparent.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/mem_fn.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/mem_fn.module.verify.cpp
new file mode 100644
index 0000000000000..0d8e9c4816860
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/mem_fn.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/mem_fn.h'}}
+#include <__functional/mem_fn.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/mem_fun_ref.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/mem_fun_ref.module.verify.cpp
new file mode 100644
index 0000000000000..f28a1670f7ddd
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/mem_fun_ref.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/mem_fun_ref.h'}}
+#include <__functional/mem_fun_ref.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/not_fn.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/not_fn.module.verify.cpp
new file mode 100644
index 0000000000000..d0c50107d5128
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/not_fn.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/not_fn.h'}}
+#include <__functional/not_fn.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/operations.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/operations.module.verify.cpp
new file mode 100644
index 0000000000000..5f377080cb74c
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/operations.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/operations.h'}}
+#include <__functional/operations.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/perfect_forward.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/perfect_forward.module.verify.cpp
new file mode 100644
index 0000000000000..a08a3cf1943cc
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/perfect_forward.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/perfect_forward.h'}}
+#include <__functional/perfect_forward.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/pointer_to_binary_function.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/pointer_to_binary_function.module.verify.cpp
new file mode 100644
index 0000000000000..f98e81925cc69
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/pointer_to_binary_function.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/pointer_to_binary_function.h'}}
+#include <__functional/pointer_to_binary_function.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/pointer_to_unary_function.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/pointer_to_unary_function.module.verify.cpp
new file mode 100644
index 0000000000000..7196117d08e37
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/pointer_to_unary_function.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/pointer_to_unary_function.h'}}
+#include <__functional/pointer_to_unary_function.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/ranges_operations.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/ranges_operations.module.verify.cpp
new file mode 100644
index 0000000000000..17cb624fc70fb
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/ranges_operations.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/ranges_operations.h'}}
+#include <__functional/ranges_operations.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/reference_wrapper.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/reference_wrapper.module.verify.cpp
new file mode 100644
index 0000000000000..06b3bdd76d5ee
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/reference_wrapper.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/reference_wrapper.h'}}
+#include <__functional/reference_wrapper.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/unary_function.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/unary_function.module.verify.cpp
new file mode 100644
index 0000000000000..aa2b688d277aa
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/unary_function.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/unary_function.h'}}
+#include <__functional/unary_function.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/unary_negate.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/unary_negate.module.verify.cpp
new file mode 100644
index 0000000000000..0b1a9761f6393
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/unary_negate.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/unary_negate.h'}}
+#include <__functional/unary_negate.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/unwrap_ref.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/unwrap_ref.module.verify.cpp
new file mode 100644
index 0000000000000..804b2fb2221d3
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/unwrap_ref.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/unwrap_ref.h'}}
+#include <__functional/unwrap_ref.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/functional/weak_result_type.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/functional/weak_result_type.module.verify.cpp
new file mode 100644
index 0000000000000..8cc289342d266
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/functional/weak_result_type.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__functional/weak_result_type.h'}}
+#include <__functional/weak_result_type.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/access.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/access.module.verify.cpp
new file mode 100644
index 0000000000000..c0caedb4a4025
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/access.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/access.h'}}
+#include <__iterator/access.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/advance.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/advance.module.verify.cpp
new file mode 100644
index 0000000000000..9c2836c03c222
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/advance.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/advance.h'}}
+#include <__iterator/advance.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/back_insert_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/back_insert_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..a1a49b9c9adbb
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/back_insert_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/back_insert_iterator.h'}}
+#include <__iterator/back_insert_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/concepts.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/concepts.module.verify.cpp
new file mode 100644
index 0000000000000..6e34ff0c3bd1f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/concepts.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/concepts.h'}}
+#include <__iterator/concepts.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/data.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/data.module.verify.cpp
new file mode 100644
index 0000000000000..eabd8e712ba26
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/data.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/data.h'}}
+#include <__iterator/data.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/default_sentinel.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/default_sentinel.module.verify.cpp
new file mode 100644
index 0000000000000..1f0f817c0ae19
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/default_sentinel.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/default_sentinel.h'}}
+#include <__iterator/default_sentinel.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/distance.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/distance.module.verify.cpp
new file mode 100644
index 0000000000000..b9df11c968667
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/distance.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/distance.h'}}
+#include <__iterator/distance.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/empty.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/empty.module.verify.cpp
new file mode 100644
index 0000000000000..5543561643d57
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/empty.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/empty.h'}}
+#include <__iterator/empty.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/erase_if_container.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/erase_if_container.module.verify.cpp
new file mode 100644
index 0000000000000..b1ac8ff129557
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/erase_if_container.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/erase_if_container.h'}}
+#include <__iterator/erase_if_container.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/front_insert_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/front_insert_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..b18066442fd4a
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/front_insert_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/front_insert_iterator.h'}}
+#include <__iterator/front_insert_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/incrementable_traits.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/incrementable_traits.module.verify.cpp
new file mode 100644
index 0000000000000..c42bc62a2a693
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/incrementable_traits.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/incrementable_traits.h'}}
+#include <__iterator/incrementable_traits.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/insert_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/insert_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..b9a307c50b332
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/insert_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/insert_iterator.h'}}
+#include <__iterator/insert_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/istream_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/istream_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..df7989fd7b32d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/istream_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/istream_iterator.h'}}
+#include <__iterator/istream_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/istreambuf_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/istreambuf_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..8572c81aa92d1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/istreambuf_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/istreambuf_iterator.h'}}
+#include <__iterator/istreambuf_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iter_move.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iter_move.module.verify.cpp
new file mode 100644
index 0000000000000..ef98fd535e0f2
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iter_move.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/iter_move.h'}}
+#include <__iterator/iter_move.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iter_swap.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iter_swap.module.verify.cpp
new file mode 100644
index 0000000000000..110324b77b4f1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iter_swap.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/iter_swap.h'}}
+#include <__iterator/iter_swap.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iterator.module.verify.cpp
new file mode 100644
index 0000000000000..cb565d969ccda
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/iterator.h'}}
+#include <__iterator/iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iterator_traits.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iterator_traits.module.verify.cpp
new file mode 100644
index 0000000000000..9e4c0c42d88b0
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/iterator_traits.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/iterator_traits.h'}}
+#include <__iterator/iterator_traits.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/move_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/move_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..a73b44a65b3c6
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/move_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/move_iterator.h'}}
+#include <__iterator/move_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/next.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/next.module.verify.cpp
new file mode 100644
index 0000000000000..4098301762b58
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/next.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/next.h'}}
+#include <__iterator/next.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/ostream_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/ostream_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..9f522aa8d828a
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/ostream_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/ostream_iterator.h'}}
+#include <__iterator/ostream_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/ostreambuf_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/ostreambuf_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..ce9c257f54756
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/ostreambuf_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/ostreambuf_iterator.h'}}
+#include <__iterator/ostreambuf_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/prev.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/prev.module.verify.cpp
new file mode 100644
index 0000000000000..01ef28172d419
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/prev.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/prev.h'}}
+#include <__iterator/prev.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/projected.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/projected.module.verify.cpp
new file mode 100644
index 0000000000000..69f445fbe6f37
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/projected.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/projected.h'}}
+#include <__iterator/projected.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/readable_traits.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/readable_traits.module.verify.cpp
new file mode 100644
index 0000000000000..0c4c367a45f15
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/readable_traits.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/readable_traits.h'}}
+#include <__iterator/readable_traits.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/reverse_access.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/reverse_access.module.verify.cpp
new file mode 100644
index 0000000000000..1dd372bf634ac
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/reverse_access.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/reverse_access.h'}}
+#include <__iterator/reverse_access.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/reverse_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/reverse_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..eb0517abb03c1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/reverse_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/reverse_iterator.h'}}
+#include <__iterator/reverse_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/size.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/size.module.verify.cpp
new file mode 100644
index 0000000000000..8d7d496a5906d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/size.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/size.h'}}
+#include <__iterator/size.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/iterator/wrap_iter.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/wrap_iter.module.verify.cpp
new file mode 100644
index 0000000000000..d151d7264f655
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/iterator/wrap_iter.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__iterator/wrap_iter.h'}}
+#include <__iterator/wrap_iter.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/locale.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/locale.module.verify.cpp
new file mode 100644
index 0000000000000..b880842c0f44e
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/locale.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__locale'}}
+#include <__locale>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/addressof.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/addressof.module.verify.cpp
new file mode 100644
index 0000000000000..d596c76608579
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/addressof.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/addressof.h'}}
+#include <__memory/addressof.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocation_guard.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocation_guard.module.verify.cpp
new file mode 100644
index 0000000000000..715ebff8c04ba
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocation_guard.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/allocation_guard.h'}}
+#include <__memory/allocation_guard.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator.module.verify.cpp
new file mode 100644
index 0000000000000..9d20a0f61fa99
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/allocator.h'}}
+#include <__memory/allocator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator_arg_t.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator_arg_t.module.verify.cpp
new file mode 100644
index 0000000000000..d7d5e69938945
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator_arg_t.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/allocator_arg_t.h'}}
+#include <__memory/allocator_arg_t.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator_traits.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator_traits.module.verify.cpp
new file mode 100644
index 0000000000000..ab0a5758918f0
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/allocator_traits.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/allocator_traits.h'}}
+#include <__memory/allocator_traits.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/auto_ptr.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/auto_ptr.module.verify.cpp
new file mode 100644
index 0000000000000..b46f06db44c21
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/auto_ptr.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/auto_ptr.h'}}
+#include <__memory/auto_ptr.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/compressed_pair.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/compressed_pair.module.verify.cpp
new file mode 100644
index 0000000000000..0c54b9158ba8d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/compressed_pair.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/compressed_pair.h'}}
+#include <__memory/compressed_pair.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/construct_at.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/construct_at.module.verify.cpp
new file mode 100644
index 0000000000000..957636014204f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/construct_at.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/construct_at.h'}}
+#include <__memory/construct_at.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/pointer_safety.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/pointer_safety.module.verify.cpp
new file mode 100644
index 0000000000000..4edca13465918
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/pointer_safety.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/pointer_safety.h'}}
+#include <__memory/pointer_safety.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/pointer_traits.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/pointer_traits.module.verify.cpp
new file mode 100644
index 0000000000000..000ef0f3ebbae
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/pointer_traits.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/pointer_traits.h'}}
+#include <__memory/pointer_traits.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/raw_storage_iterator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/raw_storage_iterator.module.verify.cpp
new file mode 100644
index 0000000000000..6f575bc2e19cc
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/raw_storage_iterator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/raw_storage_iterator.h'}}
+#include <__memory/raw_storage_iterator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/shared_ptr.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/shared_ptr.module.verify.cpp
new file mode 100644
index 0000000000000..63edce9b9865b
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/shared_ptr.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/shared_ptr.h'}}
+#include <__memory/shared_ptr.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/temporary_buffer.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/temporary_buffer.module.verify.cpp
new file mode 100644
index 0000000000000..e9d343b348662
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/temporary_buffer.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/temporary_buffer.h'}}
+#include <__memory/temporary_buffer.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/uninitialized_algorithms.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/uninitialized_algorithms.module.verify.cpp
new file mode 100644
index 0000000000000..a20d34e780719
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/uninitialized_algorithms.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/uninitialized_algorithms.h'}}
+#include <__memory/uninitialized_algorithms.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/unique_ptr.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/unique_ptr.module.verify.cpp
new file mode 100644
index 0000000000000..b9a6bf514cd69
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/unique_ptr.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/unique_ptr.h'}}
+#include <__memory/unique_ptr.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/memory/uses_allocator.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/memory/uses_allocator.module.verify.cpp
new file mode 100644
index 0000000000000..b7804aa026da6
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/memory/uses_allocator.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__memory/uses_allocator.h'}}
+#include <__memory/uses_allocator.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/mutex_base.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/mutex_base.module.verify.cpp
new file mode 100644
index 0000000000000..0dd39407f7383
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/mutex_base.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__mutex_base'}}
+#include <__mutex_base>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/node_handle.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/node_handle.module.verify.cpp
new file mode 100644
index 0000000000000..01b9fa5e809a1
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/node_handle.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__node_handle'}}
+#include <__node_handle>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/random/uniform_int_distribution.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/random/uniform_int_distribution.module.verify.cpp
new file mode 100644
index 0000000000000..df36fd28cf737
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/random/uniform_int_distribution.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__random/uniform_int_distribution.h'}}
+#include <__random/uniform_int_distribution.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/access.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/access.module.verify.cpp
new file mode 100644
index 0000000000000..d7ed406863891
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/access.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/access.h'}}
+#include <__ranges/access.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/all.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/all.module.verify.cpp
new file mode 100644
index 0000000000000..b052cec217858
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/all.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/all.h'}}
+#include <__ranges/all.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/concepts.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/concepts.module.verify.cpp
new file mode 100644
index 0000000000000..9e2a7eead6696
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/concepts.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/concepts.h'}}
+#include <__ranges/concepts.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/copyable_box.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/copyable_box.module.verify.cpp
new file mode 100644
index 0000000000000..b1749eb3921ed
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/copyable_box.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/copyable_box.h'}}
+#include <__ranges/copyable_box.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/data.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/data.module.verify.cpp
new file mode 100644
index 0000000000000..2ffc98b1874a4
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/data.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/data.h'}}
+#include <__ranges/data.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/drop_view.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/drop_view.module.verify.cpp
new file mode 100644
index 0000000000000..4ae85f5e2b30d
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/drop_view.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/drop_view.h'}}
+#include <__ranges/drop_view.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/empty.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/empty.module.verify.cpp
new file mode 100644
index 0000000000000..9edeb03fb2be9
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/empty.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/empty.h'}}
+#include <__ranges/empty.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/empty_view.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/empty_view.module.verify.cpp
new file mode 100644
index 0000000000000..c4c8fce38f727
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/empty_view.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/empty_view.h'}}
+#include <__ranges/empty_view.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/enable_borrowed_range.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/enable_borrowed_range.module.verify.cpp
new file mode 100644
index 0000000000000..4d83c09288224
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/enable_borrowed_range.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/enable_borrowed_range.h'}}
+#include <__ranges/enable_borrowed_range.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/enable_view.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/enable_view.module.verify.cpp
new file mode 100644
index 0000000000000..1e0920b7dd12c
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/enable_view.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/enable_view.h'}}
+#include <__ranges/enable_view.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/ref_view.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/ref_view.module.verify.cpp
new file mode 100644
index 0000000000000..5c7169bdd6890
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/ref_view.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/ref_view.h'}}
+#include <__ranges/ref_view.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/size.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/size.module.verify.cpp
new file mode 100644
index 0000000000000..39fab7ea0b312
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/size.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/size.h'}}
+#include <__ranges/size.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/subrange.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/subrange.module.verify.cpp
new file mode 100644
index 0000000000000..53bf897a34bdf
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/subrange.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/subrange.h'}}
+#include <__ranges/subrange.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/transform_view.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/transform_view.module.verify.cpp
new file mode 100644
index 0000000000000..d014f30e87a6a
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/transform_view.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/transform_view.h'}}
+#include <__ranges/transform_view.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/ranges/view_interface.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/view_interface.module.verify.cpp
new file mode 100644
index 0000000000000..92cea7c2f7e56
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/ranges/view_interface.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__ranges/view_interface.h'}}
+#include <__ranges/view_interface.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/split_buffer.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/split_buffer.module.verify.cpp
new file mode 100644
index 0000000000000..b0136c85c8e49
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/split_buffer.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__split_buffer'}}
+#include <__split_buffer>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/std_stream.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/std_stream.module.verify.cpp
new file mode 100644
index 0000000000000..fe8b52e0962ed
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/std_stream.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__std_stream'}}
+#include <__std_stream>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/string.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/string.module.verify.cpp
new file mode 100644
index 0000000000000..b368079cf93f8
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/string.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__string'}}
+#include <__string>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/tuple.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/tuple.module.verify.cpp
new file mode 100644
index 0000000000000..d20d348b04787
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/tuple.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__tuple'}}
+#include <__tuple>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/__decay_copy.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/__decay_copy.module.verify.cpp
new file mode 100644
index 0000000000000..3398a0b31e4bf
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/__decay_copy.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/__decay_copy.h'}}
+#include <__utility/__decay_copy.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/as_const.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/as_const.module.verify.cpp
new file mode 100644
index 0000000000000..afa0a116b0886
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/as_const.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/as_const.h'}}
+#include <__utility/as_const.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/cmp.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/cmp.module.verify.cpp
new file mode 100644
index 0000000000000..0f491b538c223
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/cmp.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/cmp.h'}}
+#include <__utility/cmp.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/declval.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/declval.module.verify.cpp
new file mode 100644
index 0000000000000..8c9feed63a043
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/declval.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/declval.h'}}
+#include <__utility/declval.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/exchange.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/exchange.module.verify.cpp
new file mode 100644
index 0000000000000..047b8aeed12b6
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/exchange.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/exchange.h'}}
+#include <__utility/exchange.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/forward.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/forward.module.verify.cpp
new file mode 100644
index 0000000000000..ed4af64de985e
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/forward.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/forward.h'}}
+#include <__utility/forward.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/in_place.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/in_place.module.verify.cpp
new file mode 100644
index 0000000000000..ebf2019197e4f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/in_place.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/in_place.h'}}
+#include <__utility/in_place.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/integer_sequence.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/integer_sequence.module.verify.cpp
new file mode 100644
index 0000000000000..36208e7df162f
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/integer_sequence.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/integer_sequence.h'}}
+#include <__utility/integer_sequence.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/move.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/move.module.verify.cpp
new file mode 100644
index 0000000000000..e410bdb6da637
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/move.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/move.h'}}
+#include <__utility/move.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/pair.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/pair.module.verify.cpp
new file mode 100644
index 0000000000000..b847833a3e38c
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/pair.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/pair.h'}}
+#include <__utility/pair.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/piecewise_construct.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/piecewise_construct.module.verify.cpp
new file mode 100644
index 0000000000000..a804894bde901
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/piecewise_construct.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/piecewise_construct.h'}}
+#include <__utility/piecewise_construct.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/rel_ops.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/rel_ops.module.verify.cpp
new file mode 100644
index 0000000000000..94b198ea76b7e
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/rel_ops.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/rel_ops.h'}}
+#include <__utility/rel_ops.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/swap.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/swap.module.verify.cpp
new file mode 100644
index 0000000000000..0b5208f1a17f4
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/swap.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/swap.h'}}
+#include <__utility/swap.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/utility/to_underlying.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/utility/to_underlying.module.verify.cpp
new file mode 100644
index 0000000000000..553c29c582fa4
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/utility/to_underlying.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__utility/to_underlying.h'}}
+#include <__utility/to_underlying.h>

diff  --git a/libcxx/test/libcxx/diagnostics/detail.headers/variant/monostate.module.verify.cpp b/libcxx/test/libcxx/diagnostics/detail.headers/variant/monostate.module.verify.cpp
new file mode 100644
index 0000000000000..bb20cbbede3e0
--- /dev/null
+++ b/libcxx/test/libcxx/diagnostics/detail.headers/variant/monostate.module.verify.cpp
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by 'generate_private_header_tests.py'
+// and should not be edited manually.
+
+// expected-error@*:* {{use of private header from outside its module: '__variant/monostate.h'}}
+#include <__variant/monostate.h>

diff  --git a/libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/types.h b/libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/types.h
index 556023f505363..bcc3493679444 100644
--- a/libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/types.h
+++ b/libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/types.h
@@ -9,7 +9,7 @@
 #ifndef TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_COPY_WRAP_TYPES_H
 #define TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_COPY_WRAP_TYPES_H
 
-#include <__ranges/copyable_box.h>
+#include <ranges>
 #include <cassert>
 #include <concepts>
 #include <type_traits>

diff  --git a/libcxx/utils/CMakeLists.txt b/libcxx/utils/CMakeLists.txt
index 1a1fbe8dfa966..638ea7aa12924 100644
--- a/libcxx/utils/CMakeLists.txt
+++ b/libcxx/utils/CMakeLists.txt
@@ -11,8 +11,13 @@ add_custom_target(libcxx-generate-feature-test-macros
     COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_feature_test_macro_components.py"
     COMMENT "Generate the <version> header and tests for feature test macros.")
 
+add_custom_target(libcxx-generate-private-header-tests
+    COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_private_header_tests.py"
+    COMMENT "Generates tests for ensuring detail headers are private")
+
 add_custom_target(libcxx-generate-files
     DEPENDS libcxx-generate-public-header-transitive-inclusion-tests
             libcxx-generate-public-header-tests
             libcxx-generate-feature-test-macros
+            libcxx-generate-private-header-tests
     COMMENT "Create all the auto-generated files in libc++ and its tests.")

diff  --git a/libcxx/utils/generate_private_header_tests.py b/libcxx/utils/generate_private_header_tests.py
new file mode 100755
index 0000000000000..10acb9214961c
--- /dev/null
+++ b/libcxx/utils/generate_private_header_tests.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+
+import os
+import re
+import shutil
+from pathlib import Path
+
+
+def get_libcxx_paths():
+    utils_path = os.path.dirname(os.path.abspath(__file__))
+    script_name = os.path.basename(__file__)
+    assert os.path.exists(utils_path)
+    src_root = os.path.dirname(utils_path)
+    include_path = os.path.join(src_root, 'include')
+    assert os.path.exists(include_path)
+    docs_path = os.path.join(src_root, 'docs')
+    assert os.path.exists(docs_path)
+    detail_header_test_root = os.path.join(src_root, 'test', 'libcxx',
+                                           'diagnostics', 'detail.headers')
+    assert os.path.exists(detail_header_test_root)
+    shutil.rmtree(detail_header_test_root)
+    Path(f'{detail_header_test_root}').mkdir()
+    assert os.path.exists(detail_header_test_root)
+    return script_name, src_root, include_path, docs_path, detail_header_test_root
+
+
+script_name, source_root, include_path, docs_path, detail_header_test_root = get_libcxx_paths(
+)
+
+
+def generate_test(header):
+    return f'''// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-build
+
+// WARNING: This test was generated by '{script_name}'
+// and should not be edited manually.
+
+// expected-error@*:* {{{{use of private header from outside its module: '{header}'}}}}
+#include <{header}>
+'''
+
+
+def relative_path(path):
+    return path.as_posix()[len(include_path + '/'):]
+
+
+def is_still_public(path):
+    rp = relative_path(path)
+    return not rp.startswith('__support') and rp not in [
+        "__bsd_locale_defaults.h", "__bsd_locale_fallbacks.h", "__config",
+        "__config_site.in", "__debug", "__hash_table", "__functional_base",
+        "__libcpp_version", "__nullptr", "__threading_support", "__tree",
+        "__undef_macros"
+    ]
+
+
+def main():
+    paths = [
+        relative_path(p) for p in Path(include_path).rglob('*')
+        if relative_path(p).startswith('__') and not p.is_dir()
+        and is_still_public(p)
+    ]
+    for path in paths:
+        path_with_subdir = re.search(r'__(\w+)/(\w+)', path)
+        directory = path_with_subdir.group(1) + '/' if path_with_subdir else ""
+        file = path_with_subdir.group(2) if path_with_subdir else path[2:]
+        path_to_write = f'{detail_header_test_root}/{directory}{file}.module.verify.cpp'
+        Path(f'{detail_header_test_root}/{directory}').mkdir(exist_ok=True)
+        assert os.path.exists(f'{detail_header_test_root}/{directory}')
+        with open(path_to_write, 'w') as f:
+            f.write(generate_test(path))
+
+
+if __name__ == '__main__':
+    main()


        


More information about the libcxx-commits mailing list