[all-commits] [llvm/llvm-project] 8ff2d6: [libc++] Reduces the number of transitive includes.

mordante via All-commits all-commits at lists.llvm.org
Wed Aug 31 10:50:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ff2d6af6906261567d8c10be62711ce899fb485
      https://github.com/llvm/llvm-project/commit/8ff2d6af6906261567d8c10be62711ce899fb485
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    A libcxx/docs/DesignDocs/HeaderRemovalPolicy.rst
    M libcxx/docs/ReleaseNotes.rst
    M libcxx/docs/index.rst
    M libcxx/include/algorithm
    M libcxx/include/any
    M libcxx/include/array
    M libcxx/include/atomic
    M libcxx/include/bit
    M libcxx/include/charconv
    M libcxx/include/coroutine
    M libcxx/include/deque
    M libcxx/include/experimental/simd
    M libcxx/include/experimental/unordered_map
    M libcxx/include/ext/hash_map
    M libcxx/include/ext/hash_set
    M libcxx/include/forward_list
    M libcxx/include/functional
    M libcxx/include/future
    M libcxx/include/iterator
    M libcxx/include/list
    M libcxx/include/locale
    M libcxx/include/map
    M libcxx/include/memory
    M libcxx/include/mutex
    M libcxx/include/numeric
    M libcxx/include/optional
    M libcxx/include/ostream
    M libcxx/include/random
    M libcxx/include/regex
    M libcxx/include/set
    M libcxx/include/span
    M libcxx/include/stack
    M libcxx/include/string
    M libcxx/include/string_view
    M libcxx/include/thread
    M libcxx/include/tuple
    M libcxx/include/typeindex
    M libcxx/include/unordered_map
    M libcxx/include/unordered_set
    M libcxx/include/utility
    M libcxx/include/valarray
    M libcxx/include/variant
    M libcxx/include/vector
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.algorithm
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.any
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.array
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.atomic
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.barrier
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.bitset
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.ccomplex
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.codecvt
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.complex
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.condition_variable
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.ctgmath
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.deque
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_algorithm
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_coroutine
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_deque
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_forward_list
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_functional
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_list
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_map
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_memory_resource
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_regex
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_set
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_simd
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_string
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_unordered_map
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_unordered_set
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.experimental_vector
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.ext_hash_map
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.ext_hash_set
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.filesystem
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.format
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.forward_list
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.fstream
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.functional
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.future
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.iomanip
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.ios
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.iostream
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.istream
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.latch
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.list
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.locale
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.map
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.memory
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.mutex
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.numeric
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.optional
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.ostream
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.queue
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.random
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.ranges
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.regex
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.scoped_allocator
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.semaphore
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.set
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.shared_mutex
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.span
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.sstream
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.stack
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.streambuf
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.string
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.string_view
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.strstream
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.system_error
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.thread
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.unordered_map
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.unordered_set
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.valarray
    M libcxx/test/libcxx/transitive_includes/cxx20/expected.vector
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.algorithm
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.any
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.array
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.atomic
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.barrier
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.bit
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.bitset
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.ccomplex
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.charconv
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.codecvt
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.complex
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.condition_variable
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.coroutine
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.ctgmath
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.deque
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_algorithm
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_coroutine
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_deque
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_forward_list
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_functional
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_iterator
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_list
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_map
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_memory_resource
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_regex
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_set
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_simd
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_string
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_unordered_map
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_unordered_set
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_utility
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.experimental_vector
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.ext_hash_map
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.ext_hash_set
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.filesystem
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.format
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.forward_list
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.fstream
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.functional
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.future
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.iomanip
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.ios
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.iostream
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.istream
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.iterator
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.latch
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.list
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.locale
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.map
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.memory
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.mutex
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.numeric
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.optional
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.ostream
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.queue
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.random
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.ranges
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.regex
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.scoped_allocator
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.semaphore
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.set
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.shared_mutex
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.span
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.sstream
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.stack
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.streambuf
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.string
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.string_view
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.strstream
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.system_error
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.thread
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.tuple
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.typeindex
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.unordered_map
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.unordered_set
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.utility
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.valarray
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.variant
    M libcxx/test/libcxx/transitive_includes/cxx2b/expected.vector
    M libcxx/utils/graph_header_deps.py

  Log Message:
  -----------
  [libc++] Reduces the number of transitive includes.

This defines a new policy for removal of transitive includes.
The goal of the policy it to make it relatively easy to remove
headers when needed, but avoid breaking developers using and
vendors shipping libc++.

The method used is to guard transitive includes based on the
C++ language version. For the upcoming C++23 we can remove
headers when we want, but for other language versions we try
to keep it to a minimum.

In this code the transitive include of `<chrono>` is removed
since D128577 introduces a header cycle between `<format>`
and `<chrono>`. This cycle is indirectly required by the
Standard. Our cycle dependency tool basically is a grep based
tool, so it needs some hints to ignore cycles. With the input
of our transitive include tests we can create a better tool.
However that's out of the scope of this patch.

Note the flag `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` remains
unchanged. So users can still opt-out of transitives includes
entirely.

Reviewed By: #libc, ldionne, philnik

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




More information about the All-commits mailing list