llvm-project
b9a2658a - [libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002)

Comment changes are shownComment changes are hidden
Commit
202 days ago
[libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002) This patch implements the forwarding to frozen C++03 headers as discussed in https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc. In the RFC, we initially proposed selecting the right headers from the Clang driver, however consensus seemed to steer towards handling this in the library itself. This patch implements that direction. At a high level, the changes basically amount to making each public header look like this: ``` // inside <vector> #ifdef _LIBCPP_CXX03_LANG # include <__cxx03/vector> #else // normal <vector> content #endif ``` In most cases, public headers are simple umbrella headers so there isn't much code in the #else branch. In other cases, the #else branch contains the actual implementation of the header.
Author
Parents
  • .github/workflows
    • File
      libcxx-build-and-test.yaml
  • libcxx
    • cmake/caches
      • File
        Generic-cxx03-frozen.cmake
    • include
      • File
        CMakeLists.txt
      • __cxx03
        • File
          CMakeLists.txt
        • __config
        • __configuration
          • File
            abi.h
          • File
            compiler.h
          • File
            config_site_shim.h
          • File
            language.h
          • File
            platform.h
        • __locale_dir/locale_base_api
          • File
            bsd_locale_fallbacks.h
        • __thread/support
          • File
            pthread.h
        • climits
        • locale
        • module.modulemap
        • version
      • algorithm
      • any
      • array
      • atomic
      • barrier
      • bit
      • bitset
      • cassert
      • ccomplex
      • cctype
      • cerrno
      • cfenv
      • cfloat
      • charconv
      • chrono
      • cinttypes
      • ciso646
      • climits
      • clocale
      • cmath
      • codecvt
      • compare
      • complex
      • File
        complex.h
      • concepts
      • condition_variable
      • coroutine
      • csetjmp
      • csignal
      • cstdalign
      • cstdarg
      • cstdbool
      • cstddef
      • cstdint
      • cstdio
      • cstdlib
      • cstring
      • ctgmath
      • ctime
      • File
        ctype.h
      • cuchar
      • cwchar
      • cwctype
      • deque
      • File
        errno.h
      • exception
      • execution
      • expected
      • experimental
        • iterator
        • memory
        • propagate_const
        • simd
        • type_traits
        • utility
      • ext
        • hash_map
        • hash_set
      • File
        fenv.h
      • filesystem
      • flat_map
      • File
        float.h
      • format
      • forward_list
      • fstream
      • functional
      • future
      • initializer_list
      • File
        inttypes.h
      • iomanip
      • ios
      • iosfwd
      • iostream
      • istream
      • iterator
      • latch
      • limits
      • list
      • locale
      • map
      • File
        math.h
      • mdspan
      • memory
      • memory_resource
      • mutex
      • new
      • numbers
      • numeric
      • optional
      • ostream
      • print
      • queue
      • random
      • ranges
      • ratio
      • regex
      • scoped_allocator
      • semaphore
      • set
      • shared_mutex
      • source_location
      • span
      • sstream
      • stack
      • File
        stdatomic.h
      • File
        stdbool.h
      • File
        stddef.h
      • stdexcept
      • File
        stdio.h
      • File
        stdlib.h
      • stop_token
      • streambuf
      • string
      • File
        string.h
      • string_view
      • strstream
      • syncstream
      • system_error
      • File
        tgmath.h
      • thread
      • tuple
      • type_traits
      • typeindex
      • typeinfo
      • File
        uchar.h
      • unordered_map
      • unordered_set
      • utility
      • valarray
      • variant
      • vector
      • version
      • File
        wchar.h
      • File
        wctype.h
    • test
      • libcxx
        • algorithms
          • File
            half_positive.pass.cpp
        • assertions
          • File
            customize_verbose_abort.link-time.pass.cpp
          • File
            default_verbose_abort.pass.cpp
          • modes
            • File
              none.pass.cpp
          • File
            single_expression.pass.cpp
        • atomics/atomics.syn
          • File
            compatible_with_stdatomic.compile.pass.cpp
        • File
          clang_modules_include.gen.py
        • containers
          • associative
            • File
              tree_balance_after_insert.pass.cpp
            • File
              tree_key_value_traits.pass.cpp
            • File
              tree_left_rotate.pass.cpp
            • File
              tree_remove.pass.cpp
            • File
              tree_right_rotate.pass.cpp
            • unord.map
              • File
                abi.compile.pass.cpp
            • unord.set
              • File
                abi.compile.pass.cpp
          • File
            container_traits.compile.pass.cpp
          • unord
            • File
              key_value_traits.pass.cpp
            • File
              next_pow2.pass.cpp
            • File
              next_prime.pass.cpp
        • depr/depr.c.headers
          • File
            extern_c.pass.cpp
        • File
          header_inclusions.gen.py
        • input.output
          • file.streams/fstreams
            • filebuf
              • File
                traits_mismatch.verify.cpp
            • File
              traits_mismatch.verify.cpp
          • iostream.format
            • input.streams
              • File
                traits_mismatch.verify.cpp
            • output.streams
              • File
                traits_mismatch.verify.cpp
          • string.streams
            • stringbuf
              • File
                const_sso_buffer.pass.cpp
            • File
              traits_mismatch.verify.cpp
        • iterators
          • File
            aliasing_iterator.pass.cpp
          • bounded_iter
            • File
              arithmetic.pass.cpp
            • File
              comparison.pass.cpp
            • File
              pointer_traits.pass.cpp
            • File
              types.compile.pass.cpp
          • File
            contiguous_iterators.conv.compile.pass.cpp
          • File
            contiguous_iterators.verify.cpp
          • iterator.primitives/iterator.operations
            • File
              prev.verify.cpp
        • language.support/support.dynamic
          • File
            libcpp_deallocate.sh.cpp
        • lint
          • File
            lint_cmakelists.sh.py
        • memory
          • File
            allocation_guard.pass.cpp
          • File
            swap_allocator.pass.cpp
        • numerics
          • File
            bit.ops.pass.cpp
          • File
            clamp_to_integral.pass.cpp
          • complex.number
            • File
              cmplx.over.pow.pass.cpp
        • selftest
          • File
            test_macros.pass.cpp
        • strings/c.strings
          • File
            constexpr_memmove.pass.cpp
        • File
          transitive_includes.gen.py
        • type_traits
          • File
            datasizeof.compile.pass.cpp
          • File
            is_constant_evaluated.pass.cpp
          • File
            is_trivially_comparable.compile.pass.cpp
          • File
            is_trivially_relocatable.compile.pass.cpp
        • utilities
          • File
            exception_guard.odr.sh.cpp
          • File
            is_pointer_in_range.pass.cpp
          • File
            is_valid_range.pass.cpp
          • meta
            • File
              meta_base.pass.cpp
          • File
            no_destroy.pass.cpp
          • template.bitset
            • File
              includes.pass.cpp
          • utility
            • File
              private_constructor_tag.compile.pass.cpp
      • std
        • containers/sequences
          • array
            • array.fill
              • File
                fill.verify.cpp
            • array.swap
              • File
                swap.verify.cpp
            • array.tuple
              • File
                get.verify.cpp
              • File
                tuple_element.verify.cpp
            • File
              size_and_alignment.compile.pass.cpp
          • forwardlist
            • File
              types.pass.cpp
          • list
            • File
              types.pass.cpp
          • vector/vector.cons
            • File
              exceptions.pass.cpp
        • input.output
          • file.streams/fstreams
            • fstream.cons
              • File
                default.pass.cpp
              • File
                move.pass.cpp
              • File
                pointer.pass.cpp
              • File
                string.pass.cpp
            • ifstream.cons
              • File
                default.pass.cpp
              • File
                move.pass.cpp
              • File
                pointer.pass.cpp
              • File
                string.pass.cpp
            • ofstream.cons
              • File
                default.pass.cpp
              • File
                move.pass.cpp
              • File
                pointer.pass.cpp
              • File
                string.pass.cpp
          • iostreams.base/ios/basic.ios.members
            • File
              copyfmt.pass.cpp
          • string.streams
            • istringstream/istringstream.cons
              • File
                default.pass.cpp
              • File
                move.pass.cpp
              • File
                string.pass.cpp
            • ostringstream/ostringstream.cons
              • File
                default.pass.cpp
              • File
                move.pass.cpp
              • File
                string.pass.cpp
            • stringbuf/stringbuf.cons
              • File
                default.pass.cpp
            • stringstream/stringstream.cons
              • File
                default.pass.cpp
              • File
                move.pass.cpp
              • File
                string.pass.cpp
        • language.support/support.runtime
          • File
            cstdalign.compile.pass.cpp
        • numerics/c.math
          • File
            isnormal.pass.cpp
          • File
            signbit.pass.cpp
        • re/re.iter/re.tokiter/re.tokiter.cnstr
          • File
            init.pass.cpp
        • strings
          • basic.string
            • File
              char.bad.verify.cpp
          • string.view
            • File
              char.bad.verify.cpp
        • utilities/template.bitset/bitset.members
          • File
            nonstdmem.uglified.compile.pass.cpp
      • support
        • File
          test_macros.h
      • tools/clang_tidy_checks
        • File
          proper_version_checks.cpp
    • utils
      • ci
        • run-buildbot
      • File
        generate_feature_test_macro_components.py
      • libcxx/test
        • File
          params.py
    • vendor/llvm
      • default_assertion_handler.in