[all-commits] [llvm/llvm-project] d6832a: [libc++][modules] Modularize <cstddef> (#107254)

Louis Dionne via All-commits all-commits at lists.llvm.org
Thu Sep 5 05:28:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6832a611a7c4ec36f08b1cfe9af850dad32da2e
      https://github.com/llvm/llvm-project/commit/d6832a611a7c4ec36f08b1cfe9af850dad32da2e
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2024-09-05 (Thu, 05 Sep 2024)

  Changed paths:
    M libcxx/include/CMakeLists.txt
    M libcxx/include/__algorithm/ranges_minmax.h
    M libcxx/include/__atomic/atomic.h
    M libcxx/include/__charconv/to_chars_integral.h
    A libcxx/include/__cstddef/byte.h
    A libcxx/include/__cstddef/max_align_t.h
    A libcxx/include/__cstddef/nullptr_t.h
    A libcxx/include/__cstddef/ptrdiff_t.h
    A libcxx/include/__cstddef/size_t.h
    M libcxx/include/__exception/nested_exception.h
    M libcxx/include/__fwd/array.h
    M libcxx/include/__fwd/complex.h
    M libcxx/include/__fwd/pair.h
    M libcxx/include/__fwd/span.h
    M libcxx/include/__fwd/subrange.h
    M libcxx/include/__fwd/tuple.h
    M libcxx/include/__iterator/concepts.h
    M libcxx/include/__iterator/iterator_traits.h
    M libcxx/include/__iterator/wrap_iter.h
    M libcxx/include/__mdspan/layout_stride.h
    M libcxx/include/__memory/pointer_traits.h
    M libcxx/include/__memory/shared_ptr.h
    M libcxx/include/__memory/unique_ptr.h
    M libcxx/include/__memory/uses_allocator.h
    M libcxx/include/__random/mersenne_twister_engine.h
    M libcxx/include/__random/seed_seq.h
    M libcxx/include/__random/subtract_with_carry_engine.h
    M libcxx/include/__ranges/subrange.h
    M libcxx/include/__string/constexpr_c_functions.h
    M libcxx/include/__tuple/tuple_size.h
    M libcxx/include/__type_traits/aligned_storage.h
    M libcxx/include/__type_traits/aligned_union.h
    M libcxx/include/__type_traits/alignment_of.h
    M libcxx/include/__type_traits/extent.h
    M libcxx/include/__type_traits/is_allocator.h
    M libcxx/include/__type_traits/is_array.h
    M libcxx/include/__type_traits/is_bounded_array.h
    M libcxx/include/__type_traits/is_nothrow_destructible.h
    M libcxx/include/__type_traits/is_null_pointer.h
    M libcxx/include/__type_traits/is_swappable.h
    M libcxx/include/__type_traits/rank.h
    M libcxx/include/__type_traits/remove_all_extents.h
    M libcxx/include/__type_traits/remove_extent.h
    M libcxx/include/__type_traits/type_list.h
    M libcxx/include/__utility/in_place.h
    M libcxx/include/__utility/pair.h
    M libcxx/include/__utility/swap.h
    M libcxx/include/any
    M libcxx/include/cstddef
    M libcxx/include/cstdio
    M libcxx/include/cstdlib
    M libcxx/include/cstring
    M libcxx/include/ctime
    M libcxx/include/cuchar
    M libcxx/include/cwchar
    M libcxx/include/experimental/__simd/reference.h
    M libcxx/include/experimental/__simd/scalar.h
    M libcxx/include/experimental/__simd/simd.h
    M libcxx/include/experimental/__simd/simd_mask.h
    M libcxx/include/experimental/__simd/vec_ext.h
    M libcxx/include/module.modulemap
    M libcxx/include/typeinfo
    M libcxx/include/unordered_map
    M libcxx/include/unordered_set
    M libcxx/test/libcxx/transitive_includes/cxx03.csv
    M libcxx/test/libcxx/transitive_includes/cxx11.csv
    M libcxx/test/libcxx/transitive_includes/cxx14.csv
    M libcxx/test/libcxx/transitive_includes/cxx17.csv
    M libcxx/test/libcxx/transitive_includes/cxx20.csv
    M libcxx/test/libcxx/transitive_includes/cxx23.csv
    M libcxx/test/libcxx/transitive_includes/cxx26.csv
    M libcxx/test/std/numerics/bit/bit.pow.two/bit_ceil.pass.cpp
    M libcxx/test/std/numerics/bit/bit.pow.two/bit_floor.pass.cpp
    M libcxx/test/std/numerics/bit/bit.pow.two/bit_width.pass.cpp
    M libcxx/test/std/numerics/bit/bit.pow.two/has_single_bit.pass.cpp
    M libcxx/test/std/numerics/bit/bitops.count/countl_one.pass.cpp
    M libcxx/test/std/numerics/bit/bitops.count/countl_zero.pass.cpp
    M libcxx/test/std/numerics/bit/bitops.count/countr_one.pass.cpp
    M libcxx/test/std/numerics/bit/bitops.count/countr_zero.pass.cpp
    M libcxx/test/std/numerics/bit/bitops.count/popcount.pass.cpp
    M libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp
    M libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp
    M libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
    M libcxx/utils/libcxx/test/modules.py

  Log Message:
  -----------
  [libc++][modules] Modularize <cstddef> (#107254)

Many headers include `<cstddef>` just for size_t, and pulling in
additional content (e.g. the traits used for std::byte) is unnecessary.
To solve this problem, this patch splits up `<cstddef>` into
subcomponents so that headers can include only the parts that they
actually require.

This has the added benefit of making the modules build a lot stricter
with respect to IWYU, and also providing a canonical location where we
define `std::size_t` and friends (which were previously defined in
multiple headers like `<cstddef>` and `<ctime>`).

After this patch, there's still many places in the codebase where we
include `<cstddef>` when `<__cstddef/size_t.h>` would be sufficient.
This patch focuses on removing `<cstddef>` includes from __type_traits
to make these headers non-circular with `<cstddef>`. Additional
refactorings can be tackled separately.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list