[all-commits] [llvm/llvm-project] 571178: [libc++][Modules] Make top level modules for all C...

Ian Anderson via All-commits all-commits at lists.llvm.org
Thu Jul 20 12:49:34 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 571178a21a8bc105bf86cf4bf92f842e07792e1a
      https://github.com/llvm/llvm-project/commit/571178a21a8bc105bf86cf4bf92f842e07792e1a
  Author: Ian Anderson <iana at apple.com>
  Date:   2023-07-20 (Thu, 20 Jul 2023)

  Changed paths:
    M libcxx/docs/ReleaseNotes/17.rst
    M libcxx/include/__stop_token/intrusive_shared_ptr.h
    M libcxx/include/__thread/formatter.h
    M libcxx/include/__threading_support
    M libcxx/include/__utility/pair.h
    M libcxx/include/module.modulemap.in
    M libcxx/test/libcxx/algorithms/cpp17_iterator_concepts.verify.cpp
    M libcxx/test/libcxx/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp
    M libcxx/test/libcxx/iterators/iterator.requirements/iterator.concepts/cpp20_iter_concepts.pass.cpp
    R libcxx/test/libcxx/lint/lint_modulemap.sh.py
    M libcxx/test/libcxx/modules_include.gen.py
    R libcxx/test/libcxx/private_headers.gen.py
    M libcxx/test/libcxx/ranges/range.utility.helpers/different_from.compile.pass.cpp
    M libcxx/test/libcxx/strings/c.strings/constexpr.cstring.compile.pass.cpp
    M libcxx/test/libcxx/strings/c.strings/constexpr_memmove.pass.cpp
    M libcxx/test/libcxx/thread/thread.stoptoken/atomic_unique_lock.pass.cpp
    M libcxx/test/libcxx/thread/thread.stoptoken/intrusive_list_view.pass.cpp
    M libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp
    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/libcxx/type_traits/datasizeof.compile.pass.cpp
    M libcxx/test/libcxx/type_traits/is_trivially_comparable.compile.pass.cpp
    M libcxx/test/libcxx/utilities/assert.exception_guard.no_exceptions.pass.cpp
    M libcxx/test/libcxx/utilities/exception_guard.odr.sh.cpp
    M libcxx/test/libcxx/utilities/is_pointer_in_range.pass.cpp

  Log Message:
  -----------
  [libc++][Modules] Make top level modules for all C++ headers with OS/clang versions

The headers that include_next compiler and OS headers need to be in different top level modules in order to avoid module cycles. e.g. libc++'s stdlib.h will #include_next stdlib.h from the compiler and then the C library. Either of those are likely to include stddef.h, which will come back up to the libc++ module map and create a module cycle. Putting stdlib.h and stddef.h (and the rest of the C standard library headers) in top level modules resolves this by letting the order go cxx_stdlib_h -> os_stdlib_h -> cxx_stddef_h -> os_stddef_h.

All of those headers' dependencies then need to be moved into top level modules themselves to avoid module cycles between the new top level level cstd modules. This starts to get complicated, as the libc++ C headers, by standard, have to include many of the C++ headers, which include the private detail headers, which are intertwined. e.g. some `__algorithm` headers include `__memory` headers and vice versa.

Make top level modules for all of the libc++ headers to easily guarantee that the modules aren't cyclic.

Add enough module exports to fix `check-cxx` and `run-buildbot generic-modules`.

`__stop_token/intrusive_shared_ptr.h` uses `__atomic/atomic.h` but has no include path to it. Add that include.
`math.h` absorbs `bits/atomic_wide_counter.h` on some platforms that don't have modules, work around that by including `math.h` in `__threading_support`.
<mutex> doesn't actually require threads, there are a few pieces like once_flag that work without threads. Remove the requirement from its module.
AIX is no longer able to support modular builds.

Reviewed By: ldionne, #libc

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




More information about the All-commits mailing list